Skip to content

Commit

Permalink
granie edited
Browse files Browse the repository at this point in the history
  • Loading branch information
janursa committed Aug 21, 2024
1 parent ea6fba5 commit 7f91a8f
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 17 deletions.
38 changes: 38 additions & 0 deletions src/api/comp_method_r.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
functionality:
namespace: "methods_r"
info:
type: methods_r
type_info:
label: Method r
summary: A GRN inference method
description: |
A method for inferring GRN from expression data.
arguments:
- name: --multiomics_rna
type: file
required: false
direction: input
default: resources_test/grn-benchmark/multiomics_rna.rds
- name: --multiomics_atac
type: file
required: false
direction: input
default: resources_test/grn-benchmark/multiomics_atac.rds
- name: --prediction
__merge__: file_prediction.yaml
required: false
direction: output
default: output/grn.csv
- name: --temp_dir
type: string
direction: input
default: output/temdir
- name: --num_workers
type: integer
direction: input
default: 4
test_resources:
- type: python_script
path: /src/common/component_tests/run_and_check_output.py
- path: /resources/grn-benchmark
dest: resources/grn-benchmark
16 changes: 1 addition & 15 deletions src/methods/multi_omics/granie/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__merge__: ../../../api/comp_method.yaml
__merge__: ../../../api/comp_method_r.yaml


functionality:
Expand All @@ -11,20 +11,6 @@ functionality:
GRN inference using GRaNIE
documentation_url: https://grp-zaugg.embl-community.io/GRaNIE/
arguments:
- name: --file_rna
type: file
required: false
direction: input
description: "Path to the RNA data file (e.g., rna.rds)."
default: resources_test/grn-benchmark/multiomics_r/rna.rds

- name: --file_atac
type: file
required: false
direction: input
description: "Path to the ATAC data file (e.g., atac.rds)."
default: resources_test/grn-benchmark/multiomics_r/atac.rds

- name: --normRNA
type: string
required: false
Expand Down
4 changes: 2 additions & 2 deletions src/methods/multi_omics/granie/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ if (!file.exists(file_RNA)) {
if (par$forceRerun | !file.exists(file_seurat)) {

# Sparse matrix
rna.m = readRDS(par$file_rna)
rna.m = readRDS(par$perturbation_rna)

seurat_object <- CreateSeuratObject(count = rna.m, project = "PBMC", min.cells = 1, min.features = 1, assay = "RNA")

# RangedSummarizedExperiment
atac = readRDS(par$file_atac)
atac = readRDS(par$perturbation_atac)

# Extract counts and metadata from the RangedSummarizedExperiment
atac_counts <- assays(atac)$counts
Expand Down
21 changes: 21 additions & 0 deletions src/methods/multi_omics/granie_ns/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

__merge__: ../../../api/comp_method.yaml

functionality:
name: grn_inference_granie
namespace: "workflows"
info:
label: grn_inference_granie
summary: "Infers GRNs from multiomics data using granie."

resources:
- type: nextflow_script
path: main.nf
entrypoint: run_wf
dependencies:
- name: grn_methods/granie

platforms:
- type: nextflow
directives:
label: [ hightime, midmem, highcpu ]
21 changes: 21 additions & 0 deletions src/methods/multi_omics/granie_ns/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
workflow run_wf {
take:
input_ch

main:
output_ch = input_ch

| granie.run(
fromState: [
multiomics_rna: "multiomics_rna",
multiomics_atac: "multiomics_atac",
num_workers: "num_workers"
],
toState: [prediction:"prediction"]
)

| setState(["prediction"])

emit:
output_ch
}
35 changes: 35 additions & 0 deletions src/methods/multi_omics/granie_ns/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)"
RUN_ID="scglue"
resources_dir="s3://openproblems-data/resources/grn"
publish_dir="s3://openproblems-data/resources/grn/results/${RUN_ID}"

num_workers=20

param_file="./params/${RUN_ID}.yaml"

cat > $param_file << HERE
param_list:
- id: ${RUN_ID}
multiomics_rna: ${resources_dir}/grn-benchmark/multiomics_rna.h5ad
multiomics_atac: ${resources_dir}/grn-benchmark/multiomics_atac.h5ad
annotation_file: ${resources_dir}/supplementary/gencode.v45.annotation.gtf.gz
motif_file: ${resources_dir}/supplementary/JASPAR2022-hg38.bed.gz
num_workers: $num_workers
temp_dir: ./tmp/grn
output_state: "state.yaml"
publish_dir: "$publish_dir"
HERE



./tw-windows-x86_64.exe launch `
https://github.com/openproblems-bio/task_grn_benchmark.git `
--revision build/main `
--pull-latest `
--main-script target/nextflow/workflows/grn_inference_scglue/main.nf `
--workspace 53907369739130 `
--compute-env 6TeIFgV5OY4pJCk8I0bfOh `
--params-file ./params/scglue.yaml `
--config src/common/nextflow_helpers/labels_tw.config

0 comments on commit 7f91a8f

Please sign in to comment.