Skip to content

Commit 4b3e42b

Browse files
authored
Merge pull request #857 from nf-core/workflow_outputs2
Replace ch_publish/subworkflow_results with named channels for scatter genome outputs
2 parents b540088 + 5f5e47b commit 4b3e42b

13 files changed

Lines changed: 163 additions & 304 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,17 @@ Use `<process_or_alias>_<emit_name>` (lowercase, underscored) inside the subwork
165165
| Layer | Convention | Example |
166166
| ------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------- |
167167
| Subworkflow `emit:` | `<process_or_alias>_<emit_name>` | `mosdepth_global_txt` |
168-
| `raredisease.nf` variable | `ch_<subworkflow>_<emit_name>` | `ch_qc_bam_mosdepth_global_txt` |
168+
| `raredisease.nf` variable | `ch_<subworkflow>_<semantic_suffix>` | `ch_qc_bam_mosdepth_global_txt` |
169169
| `NFCORE_RAREDISEASE` emit | `<subworkflow>_<emit_name>` | `qc_bam_mosdepth_global_txt` |
170170
| `publish:` entry | one entry per destination, mixing all channels for that destination | `qc_bam = NFCORE_RAREDISEASE.out.qc_bam_mosdepth_global_txt.mix(...)` |
171171

172+
The **semantic suffix** is the part of the emit name that describes what the data is, not which tool produced it. When the subworkflow emit name starts with a process/module name, drop that prefix in the `raredisease.nf` variable if the remainder is unambiguous within the subworkflow's outputs:
173+
174+
- `scatter_genome` emits `gatk4_splitintervals_split_intervals` → variable is `ch_scatter_genome_split_intervals` (drop `gatk4_splitintervals_`)
175+
- `qc_bam` emits `mosdepth_global_txt` → variable stays `ch_qc_bam_mosdepth_global_txt` (`global_txt` alone would be ambiguous among the many txt outputs in that subworkflow)
176+
177+
When in doubt, keep enough of the process name to remain unambiguous.
178+
172179
> **Note:** Some subworkflows still use the legacy `ch_publish`/`subworkflow_results` pattern and are being migrated incrementally. Until a subworkflow is migrated, follow the existing pattern for that subworkflow so it continues to publish correctly via `subworkflow_results`.
173180
174181
### Configuration

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### `Changed`
1111

12+
- Refactor scatter_genome subworkflow: alias GAWK as `GENOME_FAI_TO_BED`, remove `val_save_reference` parameter, move interval flattening into `annotate_genome_snvs` [#857](https://github.com/nf-core/raredisease/pull/857)
1213
- Replace `ch_publish`/`subworkflow_results` with named typed channel emits for qc_bam subworkflow [#853](https://github.com/nf-core/raredisease/pull/853)
1314
- Replace `ch_publish`/`subworkflow_results` with named typed channel emits for alignment and subsample-MT subworkflows [#850](https://github.com/nf-core/raredisease/pull/850)
1415

conf/modules/scatter_genome.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
process {
1919

20-
withName: '.*SCATTER_GENOME:GAWK' {
20+
withName: '.*SCATTER_GENOME:GENOME_FAI_TO_BED' {
2121
ext.args2 = { '\'BEGIN {SEP="\t"}; {print \$1 SEP "0" SEP \$2}\'' }
2222
ext.suffix = "bed"
2323
}

main.nf

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,14 @@ workflow NFCORE_RAREDISEASE {
364364
//
365365
// Create chromosome bed and intervals for splitting and gathering operations
366366
//
367-
ch_scatter_split_intervals = channel.empty()
368-
ch_scatter_genome_publish = channel.empty()
367+
ch_scatter_genome_split_intervals = channel.empty()
369368
if (!skip_snv_annotation) {
370369
SCATTER_GENOME (
371370
ch_genome_dictionary,
372371
ch_genome_fai,
373-
ch_genome_fasta,
374-
params.save_reference
372+
ch_genome_fasta
375373
)
376-
ch_scatter_split_intervals = SCATTER_GENOME.out.split_intervals
377-
ch_scatter_genome_publish = SCATTER_GENOME.out.publish
374+
ch_scatter_genome_split_intervals = SCATTER_GENOME.out.gatk4_splitintervals_split_intervals
378375
}
379376

380377
RAREDISEASE (
@@ -432,7 +429,7 @@ workflow NFCORE_RAREDISEASE {
432429
ch_sambamba_bed,
433430
ch_sample_id_map,
434431
ch_samples,
435-
ch_scatter_split_intervals,
432+
ch_scatter_genome_split_intervals,
436433
ch_score_config_mt,
437434
ch_score_config_snv,
438435
ch_score_config_sv,
@@ -532,48 +529,48 @@ workflow NFCORE_RAREDISEASE {
532529
val_vep_cache_version
533530
)
534531
emit:
535-
align_fastp_out = RAREDISEASE.out.align_fastp_out // channel: [ val(meta), path(json|html|log|reads|reads_fail|reads_merged) ]
536-
align_genome_marked_bam = RAREDISEASE.out.align_genome_marked_bam // channel: [ val(meta), path(bam) ]
537-
align_genome_marked_bai = RAREDISEASE.out.align_genome_marked_bai // channel: [ val(meta), path(bai) ]
538-
align_genome_marked_cram = RAREDISEASE.out.align_genome_marked_cram // channel: [ val(meta), path(cram) ]
539-
align_genome_marked_crai = RAREDISEASE.out.align_genome_marked_crai // channel: [ val(meta), path(crai) ]
540-
align_markdup_metrics = RAREDISEASE.out.align_markdup_metrics // channel: [ val(meta), path(metrics) ]
541-
multiqc_report = RAREDISEASE.out.multiqc_report // channel: /path/to/multiqc_report.html
542-
qc_bam_chromograph_cov_plots = RAREDISEASE.out.qc_bam_chromograph_cov_plots // channel: [ val(meta), path(png) ]
543-
qc_bam_mosdepth_global_txt = RAREDISEASE.out.qc_bam_mosdepth_global_txt // channel: [ val(meta), path(txt) ]
544-
qc_bam_mosdepth_per_base_bed = RAREDISEASE.out.qc_bam_mosdepth_per_base_bed // channel: [ val(meta), path(bed.gz) ]
545-
qc_bam_mosdepth_per_base_csi = RAREDISEASE.out.qc_bam_mosdepth_per_base_csi // channel: [ val(meta), path(csi) ]
546-
qc_bam_mosdepth_per_base_d4 = RAREDISEASE.out.qc_bam_mosdepth_per_base_d4 // channel: [ val(meta), path(d4) ]
547-
qc_bam_mosdepth_quantized_bed = RAREDISEASE.out.qc_bam_mosdepth_quantized_bed // channel: [ val(meta), path(bed.gz) ]
548-
qc_bam_mosdepth_quantized_csi = RAREDISEASE.out.qc_bam_mosdepth_quantized_csi // channel: [ val(meta), path(csi) ]
549-
qc_bam_mosdepth_regions_bed = RAREDISEASE.out.qc_bam_mosdepth_regions_bed // channel: [ val(meta), path(bed.gz) ]
550-
qc_bam_mosdepth_regions_csi = RAREDISEASE.out.qc_bam_mosdepth_regions_csi // channel: [ val(meta), path(csi) ]
551-
qc_bam_mosdepth_regions_txt = RAREDISEASE.out.qc_bam_mosdepth_regions_txt // channel: [ val(meta), path(txt) ]
552-
qc_bam_mosdepth_summary_txt = RAREDISEASE.out.qc_bam_mosdepth_summary_txt // channel: [ val(meta), path(txt) ]
553-
qc_bam_mosdepth_thresholds_bed = RAREDISEASE.out.qc_bam_mosdepth_thresholds_bed // channel: [ val(meta), path(bed.gz) ]
554-
qc_bam_mosdepth_thresholds_csi = RAREDISEASE.out.qc_bam_mosdepth_thresholds_csi // channel: [ val(meta), path(csi) ]
555-
qc_bam_ngsbits_samplegender_tsv = RAREDISEASE.out.qc_bam_ngsbits_samplegender_tsv // channel: [ val(meta), path(tsv) ]
556-
qc_bam_picard_collecthsmetrics_metrics = RAREDISEASE.out.qc_bam_picard_collecthsmetrics_metrics // channel: [ val(meta), path(metrics) ]
557-
qc_bam_picard_collectmultiplemetrics_metrics = RAREDISEASE.out.qc_bam_picard_collectmultiplemetrics_metrics // channel: [ val(meta), path(metrics) ]
558-
qc_bam_picard_collectmultiplemetrics_pdf = RAREDISEASE.out.qc_bam_picard_collectmultiplemetrics_pdf // channel: [ val(meta), path(pdf) ]
559-
qc_bam_sambamba_depth_bed = RAREDISEASE.out.qc_bam_sambamba_depth_bed // channel: [ val(meta), path(bed) ]
560-
qc_bam_tiddit_cov_cov = RAREDISEASE.out.qc_bam_tiddit_cov_cov // channel: [ val(meta), path(bed) ]
561-
qc_bam_tiddit_cov_wig = RAREDISEASE.out.qc_bam_tiddit_cov_wig // channel: [ val(meta), path(wig) ]
562-
qc_bam_ucsc_wigtobigwig_bw = RAREDISEASE.out.qc_bam_ucsc_wigtobigwig_bw // channel: [ val(meta), path(bw) ]
563-
qc_bam_verifybamid_ancestry = RAREDISEASE.out.qc_bam_verifybamid_ancestry // channel: [ val(meta), path(ancestry) ]
564-
qc_bam_verifybamid_bed = RAREDISEASE.out.qc_bam_verifybamid_bed // channel: [ val(meta), path(bed) ]
565-
qc_bam_verifybamid_log = RAREDISEASE.out.qc_bam_verifybamid_log // channel: [ val(meta), path(log) ]
566-
qc_bam_verifybamid_mu = RAREDISEASE.out.qc_bam_verifybamid_mu // channel: [ val(meta), path(mu) ]
567-
qc_bam_verifybamid_self_sm = RAREDISEASE.out.qc_bam_verifybamid_self_sm // channel: [ val(meta), path(selfSM) ]
568-
qc_bam_verifybamid_ud = RAREDISEASE.out.qc_bam_verifybamid_ud // channel: [ val(meta), path(ud) ]
569-
qc_bam_wgsmetrics_wg = RAREDISEASE.out.qc_bam_wgsmetrics_wg // channel: [ val(meta), path(metrics) ]
570-
qc_bam_wgsmetrics_y = RAREDISEASE.out.qc_bam_wgsmetrics_y // channel: [ val(meta), path(metrics) ]
571-
subsample_mt_bai = RAREDISEASE.out.subsample_mt_bai // channel: [ val(meta), path(bai) ]
572-
subsample_mt_bam = RAREDISEASE.out.subsample_mt_bam // channel: [ val(meta), path(bam) ]
573-
publish = RAREDISEASE.out.publish
574-
.mix(ch_scatter_genome_publish)
575-
.mix(ch_pedfile_publish)
576-
.mix(ch_references.publish) // channel: [ val(destination), val(value) ]
532+
align_fastp_out = RAREDISEASE.out.align_fastp_out // channel: [ val(meta), path(json|html|log|reads|reads_fail|reads_merged) ]
533+
align_genome_marked_bam = RAREDISEASE.out.align_genome_marked_bam // channel: [ val(meta), path(bam) ]
534+
align_genome_marked_bai = RAREDISEASE.out.align_genome_marked_bai // channel: [ val(meta), path(bai) ]
535+
align_genome_marked_cram = RAREDISEASE.out.align_genome_marked_cram // channel: [ val(meta), path(cram) ]
536+
align_genome_marked_crai = RAREDISEASE.out.align_genome_marked_crai // channel: [ val(meta), path(crai) ]
537+
align_markdup_metrics = RAREDISEASE.out.align_markdup_metrics // channel: [ val(meta), path(metrics) ]
538+
multiqc_report = RAREDISEASE.out.multiqc_report // channel: /path/to/multiqc_report.html
539+
scatter_genome_split_intervals = ch_scatter_genome_split_intervals // channel: [ val(meta), path(interval_list) ]
540+
qc_bam_chromograph_cov_plots = RAREDISEASE.out.qc_bam_chromograph_cov_plots // channel: [ val(meta), path(png) ]
541+
qc_bam_mosdepth_global_txt = RAREDISEASE.out.qc_bam_mosdepth_global_txt // channel: [ val(meta), path(txt) ]
542+
qc_bam_mosdepth_per_base_bed = RAREDISEASE.out.qc_bam_mosdepth_per_base_bed // channel: [ val(meta), path(bed.gz) ]
543+
qc_bam_mosdepth_per_base_csi = RAREDISEASE.out.qc_bam_mosdepth_per_base_csi // channel: [ val(meta), path(csi) ]
544+
qc_bam_mosdepth_per_base_d4 = RAREDISEASE.out.qc_bam_mosdepth_per_base_d4 // channel: [ val(meta), path(d4) ]
545+
qc_bam_mosdepth_quantized_bed = RAREDISEASE.out.qc_bam_mosdepth_quantized_bed // channel: [ val(meta), path(bed.gz) ]
546+
qc_bam_mosdepth_quantized_csi = RAREDISEASE.out.qc_bam_mosdepth_quantized_csi // channel: [ val(meta), path(csi) ]
547+
qc_bam_mosdepth_regions_bed = RAREDISEASE.out.qc_bam_mosdepth_regions_bed // channel: [ val(meta), path(bed.gz) ]
548+
qc_bam_mosdepth_regions_csi = RAREDISEASE.out.qc_bam_mosdepth_regions_csi // channel: [ val(meta), path(csi) ]
549+
qc_bam_mosdepth_regions_txt = RAREDISEASE.out.qc_bam_mosdepth_regions_txt // channel: [ val(meta), path(txt) ]
550+
qc_bam_mosdepth_summary_txt = RAREDISEASE.out.qc_bam_mosdepth_summary_txt // channel: [ val(meta), path(txt) ]
551+
qc_bam_mosdepth_thresholds_bed = RAREDISEASE.out.qc_bam_mosdepth_thresholds_bed // channel: [ val(meta), path(bed.gz) ]
552+
qc_bam_mosdepth_thresholds_csi = RAREDISEASE.out.qc_bam_mosdepth_thresholds_csi // channel: [ val(meta), path(csi) ]
553+
qc_bam_ngsbits_samplegender_tsv = RAREDISEASE.out.qc_bam_ngsbits_samplegender_tsv // channel: [ val(meta), path(tsv) ]
554+
qc_bam_picard_collecthsmetrics_metrics = RAREDISEASE.out.qc_bam_picard_collecthsmetrics_metrics // channel: [ val(meta), path(metrics) ]
555+
qc_bam_picard_collectmultiplemetrics_metrics = RAREDISEASE.out.qc_bam_picard_collectmultiplemetrics_metrics // channel: [ val(meta), path(metrics) ]
556+
qc_bam_picard_collectmultiplemetrics_pdf = RAREDISEASE.out.qc_bam_picard_collectmultiplemetrics_pdf // channel: [ val(meta), path(pdf) ]
557+
qc_bam_sambamba_depth_bed = RAREDISEASE.out.qc_bam_sambamba_depth_bed // channel: [ val(meta), path(bed) ]
558+
qc_bam_tiddit_cov_cov = RAREDISEASE.out.qc_bam_tiddit_cov_cov // channel: [ val(meta), path(bed) ]
559+
qc_bam_tiddit_cov_wig = RAREDISEASE.out.qc_bam_tiddit_cov_wig // channel: [ val(meta), path(wig) ]
560+
qc_bam_ucsc_wigtobigwig_bw = RAREDISEASE.out.qc_bam_ucsc_wigtobigwig_bw // channel: [ val(meta), path(bw) ]
561+
qc_bam_verifybamid_ancestry = RAREDISEASE.out.qc_bam_verifybamid_ancestry // channel: [ val(meta), path(ancestry) ]
562+
qc_bam_verifybamid_bed = RAREDISEASE.out.qc_bam_verifybamid_bed // channel: [ val(meta), path(bed) ]
563+
qc_bam_verifybamid_log = RAREDISEASE.out.qc_bam_verifybamid_log // channel: [ val(meta), path(log) ]
564+
qc_bam_verifybamid_mu = RAREDISEASE.out.qc_bam_verifybamid_mu // channel: [ val(meta), path(mu) ]
565+
qc_bam_verifybamid_self_sm = RAREDISEASE.out.qc_bam_verifybamid_self_sm // channel: [ val(meta), path(selfSM) ]
566+
qc_bam_verifybamid_ud = RAREDISEASE.out.qc_bam_verifybamid_ud // channel: [ val(meta), path(ud) ]
567+
qc_bam_wgsmetrics_wg = RAREDISEASE.out.qc_bam_wgsmetrics_wg // channel: [ val(meta), path(metrics) ]
568+
qc_bam_wgsmetrics_y = RAREDISEASE.out.qc_bam_wgsmetrics_y // channel: [ val(meta), path(metrics) ]
569+
subsample_mt_bai = RAREDISEASE.out.subsample_mt_bai // channel: [ val(meta), path(bai) ]
570+
subsample_mt_bam = RAREDISEASE.out.subsample_mt_bam // channel: [ val(meta), path(bam) ]
571+
publish = RAREDISEASE.out.publish
572+
.mix(ch_pedfile_publish)
573+
.mix(ch_references.publish) // channel: [ val(destination), val(value) ]
577574
}
578575
/*
579576
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -762,6 +759,7 @@ workflow {
762759
.mix(NFCORE_RAREDISEASE.out.qc_bam_verifybamid_ud)
763760
.mix(NFCORE_RAREDISEASE.out.qc_bam_wgsmetrics_wg)
764761
.mix(NFCORE_RAREDISEASE.out.qc_bam_wgsmetrics_y)
762+
processed_references = NFCORE_RAREDISEASE.out.scatter_genome_split_intervals
765763
subworkflow_results = NFCORE_RAREDISEASE.out.publish
766764
}
767765

@@ -778,6 +776,10 @@ output {
778776
qc_bam {
779777
path { _meta, _file -> "qc_bam/" }
780778
}
779+
processed_references {
780+
path { _meta, _file -> "processed_references/" }
781+
enabled params.save_reference
782+
}
781783
subworkflow_results {
782784
path { destination, _value -> destination }
783785
}

subworkflows/local/annotate_genome_snvs/main.nf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ workflow ANNOTATE_GENOME_SNVS {
2727
ch_genome_fasta // channel: [mandatory] [ val(meta), path(fasta) ]
2828
ch_gnomad_af // channel: [optional] [ path(tab), path(tbi) ]
2929
ch_samples // channel: [mandatory] [ val(sample_meta) ]
30-
ch_split_intervals // channel: [mandatory] [ path(intervals) ]
30+
ch_split_intervals // channel: [mandatory] [ val(meta), path(interval_list) ]
3131
ch_vcf // channel: [mandatory] [ val(meta), path(vcf), path(tbi) ]
3232
ch_vcfanno_extra // channel: [mandatory] [ [path(vcf),path(index)] ]
3333
ch_vcfanno_lua // channel: [mandatory] [ path(lua) ]
@@ -62,9 +62,13 @@ workflow ANNOTATE_GENOME_SNVS {
6262
// The remainder:true join pads cases without rohcall output with a single null, giving
6363
// tuples of length 4 (no rohcall) vs 5 (rohcall). After combining with an interval both
6464
// grow by one, so size==6 means this case has probands and a rohcall-annotated VCF.
65+
ch_split_intervals
66+
.flatMap { _meta, intervals -> intervals.collect{ interval -> [interval] } }
67+
.set { ch_split_intervals_flat }
68+
6569
ch_vcf
6670
.join(ZIP_TABIX_ROHCALL.out.gz_index, remainder: true)
67-
.combine(ch_split_intervals)
71+
.combine(ch_split_intervals_flat)
6872
.map { it ->
6973
def meta = it[0]
7074
def vcf = it[1]

0 commit comments

Comments
 (0)