From 7f91a8f88722023bd1507442b19168beff1c2bb2 Mon Sep 17 00:00:00 2001 From: jalil Date: Wed, 21 Aug 2024 20:34:36 +0200 Subject: [PATCH] granie edited --- src/api/comp_method_r.yaml | 38 +++++++++++++++++++ .../multi_omics/granie/config.vsh.yaml | 16 +------- src/methods/multi_omics/granie/script.R | 4 +- .../multi_omics/granie_ns/config.vsh.yaml | 21 ++++++++++ src/methods/multi_omics/granie_ns/main.nf | 21 ++++++++++ src/methods/multi_omics/granie_ns/run.sh | 35 +++++++++++++++++ 6 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 src/api/comp_method_r.yaml create mode 100644 src/methods/multi_omics/granie_ns/config.vsh.yaml create mode 100644 src/methods/multi_omics/granie_ns/main.nf create mode 100644 src/methods/multi_omics/granie_ns/run.sh diff --git a/src/api/comp_method_r.yaml b/src/api/comp_method_r.yaml new file mode 100644 index 000000000..79145722e --- /dev/null +++ b/src/api/comp_method_r.yaml @@ -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 \ No newline at end of file diff --git a/src/methods/multi_omics/granie/config.vsh.yaml b/src/methods/multi_omics/granie/config.vsh.yaml index 151c545cc..b61dab82e 100644 --- a/src/methods/multi_omics/granie/config.vsh.yaml +++ b/src/methods/multi_omics/granie/config.vsh.yaml @@ -1,4 +1,4 @@ -__merge__: ../../../api/comp_method.yaml +__merge__: ../../../api/comp_method_r.yaml functionality: @@ -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 diff --git a/src/methods/multi_omics/granie/script.R b/src/methods/multi_omics/granie/script.R index c8709be90..752e1b0c4 100644 --- a/src/methods/multi_omics/granie/script.R +++ b/src/methods/multi_omics/granie/script.R @@ -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 diff --git a/src/methods/multi_omics/granie_ns/config.vsh.yaml b/src/methods/multi_omics/granie_ns/config.vsh.yaml new file mode 100644 index 000000000..187ef77af --- /dev/null +++ b/src/methods/multi_omics/granie_ns/config.vsh.yaml @@ -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 ] diff --git a/src/methods/multi_omics/granie_ns/main.nf b/src/methods/multi_omics/granie_ns/main.nf new file mode 100644 index 000000000..b4c4c9bdc --- /dev/null +++ b/src/methods/multi_omics/granie_ns/main.nf @@ -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 +} diff --git a/src/methods/multi_omics/granie_ns/run.sh b/src/methods/multi_omics/granie_ns/run.sh new file mode 100644 index 000000000..c4abb32db --- /dev/null +++ b/src/methods/multi_omics/granie_ns/run.sh @@ -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 \ No newline at end of file