From af86bb2e68e029e9e08cdc4ac78695967f7f6599 Mon Sep 17 00:00:00 2001 From: Stephanie Yang Date: Mon, 28 Oct 2024 16:36:26 +0100 Subject: [PATCH] Modify differential/main.nf to include limma --- assets/schema_tools.json | 4 ++-- assets/tools_samplesheet.csv | 2 ++ subworkflows/local/differential/main.nf | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/assets/schema_tools.json b/assets/schema_tools.json index 347a14f0..dcbbe9f8 100644 --- a/assets/schema_tools.json +++ b/assets/schema_tools.json @@ -12,9 +12,9 @@ }, "diff_method": { "type": "string", - "errorMessage": "choose a differential analysis method (eg. deseq2, propd) or none", + "errorMessage": "choose a differential analysis method (eg. deseq2, limma, propd) or none", "meta": ["diff_method"], - "enum": ["propd", "deseq2", "none"] + "enum": ["propd", "deseq2", "limma", "none"] }, "args_diff": { "type": "string", diff --git a/assets/tools_samplesheet.csv b/assets/tools_samplesheet.csv index 1345355a..2289918d 100644 --- a/assets/tools_samplesheet.csv +++ b/assets/tools_samplesheet.csv @@ -5,6 +5,8 @@ propd_grea,propd,,,,grea, propd_ora,propd,,,,gprofiler2, deseq2_gsea,deseq2,,,,gsea, deseq2_ora,deseq2,,,,gprofiler2, +limma,limma,,,,, +limma_gsea,limma,,,,gsea, pcorbshrink,,,propr,--metric pcor.bshrink,, propr,,,propr,--metric rho,, cor,,,propr,--metric cor,, diff --git a/subworkflows/local/differential/main.nf b/subworkflows/local/differential/main.nf index bd45178d..94cec0a7 100644 --- a/subworkflows/local/differential/main.nf +++ b/subworkflows/local/differential/main.nf @@ -3,6 +3,7 @@ // include { PROPR_PROPD as PROPD } from "../../../modules/local/propr/propd/main.nf" include { DESEQ2_DIFFERENTIAL } from '../../../modules/nf-core/deseq2/differential/main' +include { LIMMA_DIFFERENTIAL } from '../../../modules/nf-core/limma/differential/main' def correct_meta_data = { meta, data, pathway -> def meta_clone = meta.clone() + pathway @@ -32,6 +33,7 @@ workflow DIFFERENTIAL { .branch { propd: it[1]["diff_method"] == "propd" deseq2: it[1]["diff_method"] == "deseq2" + limma: it[1]["diff_method"] == "limma" } .set { ch_tools_single } @@ -89,6 +91,28 @@ workflow DIFFERENTIAL { // ch_results = ch_results // .mix(DESEQ2_DIFFERENTIAL.out.results) + // ---------------------------------------------------- + // Perform differential analysis with limma + // ---------------------------------------------------- + + ch_counts + .join(ch_samplesheet) //samplesheet + counts have the same meta + .combine(ch_contrasts) // meta is different + .combine(ch_tools_single.limma) + .multiMap { + meta_data, counts, samplesheet, meta_contrast, contrast_variable, reference, target, pathway, meta_tools -> + def meta = meta_data.clone() + meta_contrast.clone() + meta_tools.clone() + input1: [ meta, contrast_variable, reference, target ] + input2: [ meta, samplesheet, counts ] + pathway: [ meta, pathway ] + } + .set { ch_limma } + + LIMMA_DIFFERENTIAL(ch_limma.input1.unique(), ch_limma.input2.unique()) + + ch_results_genewise = LIMMA_DIFFERENTIAL.out.results + .join(ch_limma.pathway).map(correct_meta_data).mix(ch_results_genewise) + emit: results_pairwise = ch_results_pairwise results_pairwise_filtered = ch_results_pairwise_filtered