Skip to content

Commit

Permalink
minor code restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlang committed Sep 20, 2024
1 parent b71b83e commit 4a41e66
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
35 changes: 22 additions & 13 deletions subworkflows/local/differential/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,48 @@ workflow DIFFERENTIAL {
ch_tools

main:
ch_tools
.branch {
propd: it[0]["diff_method"] == "propd"
deseq2: it[0]["diff_method"] == "deseq2"
}
.set { ch_tools_single }


// Perform differential analysis with PROPD
ch_counts
.join(ch_samplesheet)
.first()
.combine(ch_tools)
.combine(ch_tools_single.propd)
.combine(ch_contrasts)
.map {
meta_counts, counts, samplesheet, tools, meta_contrast, contrast_variable, reference, target ->
meta_counts, counts, tools, meta_contrast, contrast_variable, reference, target ->
def meta = meta_counts.clone() + tools.clone()
meta.args_diff = (meta.args_diff ?: "") + " --group_col $contrast_variable"
[ meta, samplesheet, counts ]
[ meta, counts ]
}
.unique()
.branch {
propd: it[0]["diff_method"] == "propd"
return [it[0], it[2]]
deseq2: it[0]["diff_method"] == "deseq2"
}
.set { ch_counts_tools }
.set { ch_counts_propd }

PROPD(
ch_counts_tools.propd,
ch_counts_propd,
ch_samplesheet.first()
)
ch_results = PROPD.out.results
ch_adjacency = PROPD.out.adj

// Perform differential analysis with DESeq2
// ToDo: In order to use deseq2 the downstream processes need to be updated to process the output correctly
// if (params.transcript_length_matrix) { ch_transcript_lengths = Channel.of([ exp_meta, file(params.transcript_length_matrix, checkIfExists: true)]).first() } else { ch_transcript_lengths = [[],[]] }
// if (params.control_features) { ch_control_features = Channel.of([ exp_meta, file(params.control_features, checkIfExists: true)]).first() } else { ch_control_features = [[],[]] }

// ch_samplesheet
// .join(ch_counts)
// .first()
// .combine(ch_tools_single.deseq2)
// .set { ch_counts_deseq2 }

// DESEQ2_DIFFERENTIAL (
// ch_contrasts,
// ch_counts_tools.deseq2,
// ch_counts_deseq2,
// ch_control_features,
// ch_transcript_lengths
// )
Expand Down
6 changes: 3 additions & 3 deletions workflows/differentialabundance.nf
Original file line number Diff line number Diff line change
Expand Up @@ -365,20 +365,20 @@ workflow DIFFERENTIALABUNDANCE {

if (params.pathway == "all") {
ch_tools
.set{ ch_tools_single }
.set{ ch_tools_filtered }
} else {
ch_tools
.filter{
it[0]["pathway_name"] in params.pathway.tokenize(',')
}
.set{ ch_tools_single }
.set{ ch_tools_filtered }
}

EXPERIMENTAL(
ch_contrasts,
VALIDATOR.out.sample_meta,
CUSTOM_MATRIXFILTER.out.filtered,
ch_tools_single
ch_tools_filtered
)

ch_norm = Channel.empty()
Expand Down

0 comments on commit 4a41e66

Please sign in to comment.