Skip to content

Commit

Permalink
Modify differential/main.nf to include limma
Browse files Browse the repository at this point in the history
  • Loading branch information
syangaskhan committed Oct 28, 2024
1 parent 3c8be72 commit af86bb2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/schema_tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions assets/tools_samplesheet.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,,
24 changes: 24 additions & 0 deletions subworkflows/local/differential/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af86bb2

Please sign in to comment.