Skip to content

Commit 743f2aa

Browse files
annotate diff results only when study type = rnaseq or affy
1 parent 0097bfc commit 743f2aa

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

workflows/differentialabundance.nf

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -513,20 +513,23 @@ workflow DIFFERENTIALABUNDANCE {
513513
// ========================================================================
514514
// Annotate differential results with feature metadata using csvtk_join
515515
// ========================================================================
516-
517516
// Prepare input for annotation - combine differential results with feature metadata
518517
ch_annotation_input = ch_differential_results
518+
.filter { tuple ->
519+
def meta = tuple[0]
520+
def study_type = meta?.params?.study_type
521+
return study_type == 'rnaseq' || study_type == 'affy_array'
522+
}
523+
524+
ch_annotation_input
519525
.combine(ch_validated_featuremeta, by: 0) // Join by meta_key (first element)
520526
.map { meta_key, meta_with_contrast, results_file, features_file ->
521527
// Return: [meta_with_contrast, [results_file, features_file]]
522-
// This structure matches your module input: meta, [matrix, features]
523528
[meta_with_contrast, [results_file, features_file]]
524529
}
530+
.set { ch_final_annotation_input }
525531

526-
// Run csvtk_join to annotate results
527-
CSVTK_JOIN(
528-
ch_annotation_input
529-
)
532+
CSVTK_JOIN(ch_final_annotation_input)
530533

531534
ch_versions = ch_versions
532535
.mix(CSVTK_JOIN.out.versions)
@@ -811,11 +814,6 @@ workflow DIFFERENTIALABUNDANCE {
811814
.groupTuple() // [ meta, [meta with contrast], [differential results], [differential model] ]
812815
.map { [it[0], it.tail().tail().flatten()] } // [ meta, [differential results and models] ]
813816

814-
// Create a separate channel for annotated results grouped by paramset
815-
// ch_differential_annotated_grouped = ch_differential_results_annotated.transpose()
816-
// .groupTuple() // [ meta, [meta with contrast], [annotated results] ]
817-
// .map { [it[0], it.tail().flatten()] } // [ meta, [annotated results] ]
818-
819817
ch_functional_grouped = ch_functional_results
820818
.groupTuple() // [ meta, [meta with contrast], [functional results] ]
821819
.map { [it[0], it.tail().tail().flatten()] } // [ meta, [functional results] ]

0 commit comments

Comments
 (0)