diff --git a/subworkflows/nf-core/bam_rseqc/main.nf b/subworkflows/nf-core/bam_rseqc/main.nf index bf530f09d23..043321a13c2 100644 --- a/subworkflows/nf-core/bam_rseqc/main.nf +++ b/subworkflows/nf-core/bam_rseqc/main.nf @@ -13,168 +13,173 @@ include { RSEQC_TIN } from '../../../modules/nf-core/rseqc/tin/ma workflow BAM_RSEQC { take: - ch_bam_bai // channel: [ val(meta), [ bam, bai ] ] - ch_bed // file: /path/to/genome.bed + bam_bai // channel: [ val(meta), [ bam, bai ] ] + bed // channel: [ genome.bed ] rseqc_modules // list: rseqc modules to run main: - ch_versions = Channel.empty() + bam = bam_bai.map{ [ it[0], it[1] ] } - ch_bam_bai - .map { [ it[0], it[1] ] } - .set { ch_bam } + versions = Channel.empty() // // Run RSeQC bam_stat.py // - ch_bamstat = Channel.empty() + bamstat_txt = Channel.empty() + if ('bam_stat' in rseqc_modules) { - RSEQC_BAMSTAT ( ch_bam ) - ch_bamstat = RSEQC_BAMSTAT.out.txt - ch_versions = ch_versions.mix(RSEQC_BAMSTAT.out.versions.first()) + RSEQC_BAMSTAT(bam) + bamstat_txt = RSEQC_BAMSTAT.out.txt + versions = versions.mix(RSEQC_BAMSTAT.out.versions.first()) } // // Run RSeQC inner_distance.py // - ch_innerdistance = Channel.empty() - ch_innerdistance_distance = Channel.empty() - ch_innerdistance_freq = Channel.empty() - ch_innerdistance_mean = Channel.empty() - ch_innerdistance_pdf = Channel.empty() - ch_innerdistance_rscript = Channel.empty() + innerdistance_all = Channel.empty() + innerdistance_distance = Channel.empty() + innerdistance_freq = Channel.empty() + innerdistance_mean = Channel.empty() + innerdistance_pdf = Channel.empty() + innerdistance_rscript = Channel.empty() + if ('inner_distance' in rseqc_modules) { - RSEQC_INNERDISTANCE ( ch_bam, ch_bed ) - ch_innerdistance_distance = RSEQC_INNERDISTANCE.out.distance - ch_innerdistance_freq = RSEQC_INNERDISTANCE.out.freq - ch_innerdistance_mean = RSEQC_INNERDISTANCE.out.mean - ch_innerdistance_pdf = RSEQC_INNERDISTANCE.out.pdf - ch_innerdistance_rscript = RSEQC_INNERDISTANCE.out.rscript - ch_innerdistance = ch_innerdistance_distance.mix(ch_innerdistance_freq, ch_innerdistance_mean, ch_innerdistance_pdf, ch_innerdistance_rscript) - ch_versions = ch_versions.mix(RSEQC_INNERDISTANCE.out.versions.first()) + RSEQC_INNERDISTANCE(bam, bed) + innerdistance_distance = RSEQC_INNERDISTANCE.out.distance + innerdistance_freq = RSEQC_INNERDISTANCE.out.freq + innerdistance_mean = RSEQC_INNERDISTANCE.out.mean + innerdistance_pdf = RSEQC_INNERDISTANCE.out.pdf + innerdistance_rscript = RSEQC_INNERDISTANCE.out.rscript + innerdistance_all = innerdistance_distance.mix(innerdistance_freq, innerdistance_mean, innerdistance_pdf, innerdistance_rscript) + versions = versions.mix(RSEQC_INNERDISTANCE.out.versions.first()) } // // Run RSeQC infer_experiment.py // - ch_inferexperiment = Channel.empty() + inferexperiment_txt = Channel.empty() if ('infer_experiment' in rseqc_modules) { - RSEQC_INFEREXPERIMENT ( ch_bam, ch_bed ) - ch_inferexperiment = RSEQC_INFEREXPERIMENT.out.txt - ch_versions = ch_versions.mix(RSEQC_INFEREXPERIMENT.out.versions.first()) + RSEQC_INFEREXPERIMENT(bam, bed) + inferexperiment_txt = RSEQC_INFEREXPERIMENT.out.txt + versions = versions.mix(RSEQC_INFEREXPERIMENT.out.versions.first()) } // // Run RSeQC junction_annotation.py // - ch_junctionannotation = Channel.empty() - ch_junctionannotation_bed = Channel.empty() - ch_junctionannotation_interact_bed = Channel.empty() - ch_junctionannotation_xls = Channel.empty() - ch_junctionannotation_pdf = Channel.empty() - ch_junctionannotation_events_pdf = Channel.empty() - ch_junctionannotation_rscript = Channel.empty() - ch_junctionannotation_log = Channel.empty() + junctionannotation_all = Channel.empty() + junctionannotation_bed = Channel.empty() + junctionannotation_interact_bed = Channel.empty() + junctionannotation_xls = Channel.empty() + junctionannotation_pdf = Channel.empty() + junctionannotation_events_pdf = Channel.empty() + junctionannotation_rscript = Channel.empty() + junctionannotation_log = Channel.empty() + if ('junction_annotation' in rseqc_modules) { - RSEQC_JUNCTIONANNOTATION ( ch_bam, ch_bed ) - ch_junctionannotation_bed = RSEQC_JUNCTIONANNOTATION.out.bed - ch_junctionannotation_interact_bed = RSEQC_JUNCTIONANNOTATION.out.interact_bed - ch_junctionannotation_xls = RSEQC_JUNCTIONANNOTATION.out.xls - ch_junctionannotation_pdf = RSEQC_JUNCTIONANNOTATION.out.pdf - ch_junctionannotation_events_pdf = RSEQC_JUNCTIONANNOTATION.out.events_pdf - ch_junctionannotation_rscript = RSEQC_JUNCTIONANNOTATION.out.rscript - ch_junctionannotation_log = RSEQC_JUNCTIONANNOTATION.out.log - ch_junctionannotation = ch_junctionannotation_bed.mix(ch_junctionannotation_interact_bed, ch_junctionannotation_xls, ch_junctionannotation_pdf, ch_junctionannotation_events_pdf, ch_junctionannotation_rscript, ch_junctionannotation_log) - ch_versions = ch_versions.mix(RSEQC_JUNCTIONANNOTATION.out.versions.first()) + RSEQC_JUNCTIONANNOTATION(bam, bed) + junctionannotation_bed = RSEQC_JUNCTIONANNOTATION.out.bed + junctionannotation_interact_bed = RSEQC_JUNCTIONANNOTATION.out.interact_bed + junctionannotation_xls = RSEQC_JUNCTIONANNOTATION.out.xls + junctionannotation_pdf = RSEQC_JUNCTIONANNOTATION.out.pdf + junctionannotation_events_pdf = RSEQC_JUNCTIONANNOTATION.out.events_pdf + junctionannotation_rscript = RSEQC_JUNCTIONANNOTATION.out.rscript + junctionannotation_log = RSEQC_JUNCTIONANNOTATION.out.log + junctionannotation_all = junctionannotation_bed.mix(junctionannotation_interact_bed, junctionannotation_xls, junctionannotation_pdf, junctionannotation_events_pdf, junctionannotation_rscript, junctionannotation_log) + versions = versions.mix(RSEQC_JUNCTIONANNOTATION.out.versions.first()) } // // Run RSeQC junction_saturation.py // - ch_junctionsaturation = Channel.empty() - ch_junctionsaturation_pdf = Channel.empty() - ch_junctionsaturation_rscript = Channel.empty() + junctionsaturation_all = Channel.empty() + junctionsaturation_pdf = Channel.empty() + junctionsaturation_rscript = Channel.empty() + if ('junction_saturation' in rseqc_modules) { - RSEQC_JUNCTIONSATURATION ( ch_bam, ch_bed ) - ch_junctionsaturation_pdf = RSEQC_JUNCTIONSATURATION.out.pdf - ch_junctionsaturation_rscript = RSEQC_JUNCTIONSATURATION.out.rscript - ch_junctionsaturation = ch_junctionsaturation_pdf.mix(ch_junctionsaturation_rscript) - ch_versions = ch_versions.mix(RSEQC_JUNCTIONSATURATION.out.versions.first()) + RSEQC_JUNCTIONSATURATION(bam, bed) + junctionsaturation_pdf = RSEQC_JUNCTIONSATURATION.out.pdf + junctionsaturation_rscript = RSEQC_JUNCTIONSATURATION.out.rscript + junctionsaturation_all = junctionsaturation_pdf.mix(junctionsaturation_rscript) + versions = versions.mix(RSEQC_JUNCTIONSATURATION.out.versions.first()) } // // Run RSeQC read_distribution.py // - ch_readdistribution = Channel.empty() + readdistribution_txt = Channel.empty() + if ('read_distribution' in rseqc_modules) { - RSEQC_READDISTRIBUTION ( ch_bam, ch_bed ) - ch_readdistribution = RSEQC_READDISTRIBUTION.out.txt - ch_versions = ch_versions.mix(RSEQC_READDISTRIBUTION.out.versions.first()) + RSEQC_READDISTRIBUTION(bam, bed) + readdistribution_txt = RSEQC_READDISTRIBUTION.out.txt + versions = versions.mix(RSEQC_READDISTRIBUTION.out.versions.first()) } // // Run RSeQC read_duplication.py // - ch_readduplication = Channel.empty() - ch_readduplication_seq_xls = Channel.empty() - ch_readduplication_pos_xls = Channel.empty() - ch_readduplication_pdf = Channel.empty() - ch_readduplication_rscript = Channel.empty() + readduplication_all = Channel.empty() + readduplication_seq_xls = Channel.empty() + readduplication_pos_xls = Channel.empty() + readduplication_pdf = Channel.empty() + readduplication_rscript = Channel.empty() + if ('read_duplication' in rseqc_modules) { - RSEQC_READDUPLICATION ( ch_bam ) - ch_readduplication_seq_xls = RSEQC_READDUPLICATION.out.seq_xls - ch_readduplication_pos_xls = RSEQC_READDUPLICATION.out.pos_xls - ch_readduplication_pdf = RSEQC_READDUPLICATION.out.pdf - ch_readduplication_rscript = RSEQC_READDUPLICATION.out.rscript - ch_readduplication = ch_readduplication_seq_xls.mix(ch_readduplication_pos_xls, ch_readduplication_pdf, ch_readduplication_rscript) - ch_versions = ch_versions.mix(RSEQC_READDUPLICATION.out.versions.first()) + RSEQC_READDUPLICATION(bam ) + readduplication_seq_xls = RSEQC_READDUPLICATION.out.seq_xls + readduplication_pos_xls = RSEQC_READDUPLICATION.out.pos_xls + readduplication_pdf = RSEQC_READDUPLICATION.out.pdf + readduplication_rscript = RSEQC_READDUPLICATION.out.rscript + readduplication_all = readduplication_seq_xls.mix(readduplication_pos_xls, readduplication_pdf, readduplication_rscript) + versions = versions.mix(RSEQC_READDUPLICATION.out.versions.first()) } // // Run RSeQC tin.py // - ch_tin = Channel.empty() + tin_txt = Channel.empty() + if ('tin' in rseqc_modules) { - RSEQC_TIN ( ch_bam_bai, ch_bed ) - ch_tin = RSEQC_TIN.out.txt - ch_versions = ch_versions.mix(RSEQC_TIN.out.versions.first()) + RSEQC_TIN(bam_bai, bed) + tin_txt = RSEQC_TIN.out.txt + versions = versions.mix(RSEQC_TIN.out.versions.first()) } emit: - ch_bamstat // channel: [ val(meta), txt ] + bamstat_txt // channel: [ val(meta), txt ] - ch_innerdistance - ch_innerdistance_distance // channel: [ val(meta), txt ] - ch_innerdistance_freq // channel: [ val(meta), txt ] - ch_innerdistance_mean // channel: [ val(meta), txt ] - ch_innerdistance_pdf // channel: [ val(meta), pdf ] - ch_innerdistance_rscript // channel: [ val(meta), r ] + innerdistance_all // channel: [ val(meta), {txt, pdf, r} ] + innerdistance_distance // channel: [ val(meta), txt ] + innerdistance_freq // channel: [ val(meta), txt ] + innerdistance_mean // channel: [ val(meta), txt ] + innerdistance_pdf // channel: [ val(meta), pdf ] + innerdistance_rscript // channel: [ val(meta), r ] - ch_inferexperiment // channel: [ val(meta), txt ] + inferexperiment_txt // channel: [ val(meta), txt ] - ch_junctionannotation - ch_junctionannotation_bed // channel: [ val(meta), bed ] - ch_junctionannotation_interact_bed // channel: [ val(meta), bed ] - ch_junctionannotation_xls // channel: [ val(meta), xls ] - ch_junctionannotation_pdf // channel: [ val(meta), pdf ] - ch_junctionannotation_events_pdf // channel: [ val(meta), pdf ] - ch_junctionannotation_rscript // channel: [ val(meta), r ] - ch_junctionannotation_log // channel: [ val(meta), log ] + junctionannotation_all // channel: [ val(meta), {bed, xls, pdf, r, log} ] + junctionannotation_bed // channel: [ val(meta), bed ] + junctionannotation_interact_bed // channel: [ val(meta), bed ] + junctionannotation_xls // channel: [ val(meta), xls ] + junctionannotation_pdf // channel: [ val(meta), pdf ] + junctionannotation_events_pdf // channel: [ val(meta), pdf ] + junctionannotation_rscript // channel: [ val(meta), r ] + junctionannotation_log // channel: [ val(meta), log ] - ch_junctionsaturation - ch_junctionsaturation_pdf // channel: [ val(meta), pdf ] - ch_junctionsaturation_rscript // channel: [ val(meta), r ] + junctionsaturation_all // channel: [ val(meta), {pdf, r} ] + junctionsaturation_pdf // channel: [ val(meta), pdf ] + junctionsaturation_rscript // channel: [ val(meta), r ] - ch_readdistribution // channel: [ val(meta), txt ] + readdistribution_txt // channel: [ val(meta), txt ] - ch_readduplication - ch_readduplication_seq_xls // channel: [ val(meta), xls ] - ch_readduplication_pos_xls // channel: [ val(meta), xls ] - ch_readduplication_pdf // channel: [ val(meta), pdf ] - ch_readduplication_rscript // channel: [ val(meta), r ] + readduplication_all // channel: [ val(meta), {xls, pdf, r} ] + readduplication_seq_xls // channel: [ val(meta), xls ] + readduplication_pos_xls // channel: [ val(meta), xls ] + readduplication_pdf // channel: [ val(meta), pdf ] + readduplication_rscript // channel: [ val(meta), r ] - ch_tin // channel: [ val(meta), txt ] + tin_txt // channel: [ val(meta), txt ] - versions = ch_versions // channel: [ versions.yml ] + versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/bam_rseqc/meta.yml b/subworkflows/nf-core/bam_rseqc/meta.yml index 2fef887378a..6e76ff560a4 100644 --- a/subworkflows/nf-core/bam_rseqc/meta.yml +++ b/subworkflows/nf-core/bam_rseqc/meta.yml @@ -46,107 +46,107 @@ input: List of rseqc modules to run e.g. [ 'bam_stat', 'infer_experiment' ] output: - - ch_bamstat: + - bamstat_txt: type: file description: bam statistics report pattern: "*.bam_stat.txt" - - ch_innerdistance: + - innerdistance_all: type: file description: All the output files from RSEQC_INNERDISTANCE pattern: "*.{txt,pdf,R}" - - ch_innerdistance_distance: + - innerdistance_distance: type: file description: the inner distances pattern: "*.inner_distance.txt" - - ch_innerdistance_freq: + - innerdistance_freq: type: file description: frequencies of different insert sizes pattern: "*.inner_distance_freq.txt" - - ch_innerdistance_mean: + - innerdistance_mean: type: file description: mean/median values of inner distances pattern: "*.inner_distance_mean.txt" - - ch_innerdistance_pdf: + - innerdistance_pdf: type: file description: distribution plot of inner distances pattern: "*.inner_distance_plot.pdf" - - ch_innerdistance_rscript: + - innerdistance_rscript: type: file description: script to reproduce the plot pattern: "*.inner_distance_plot.R" - - ch_inferexperiment: + - inferexperiment_txt: type: file description: infer_experiment results report pattern: "*.infer_experiment.txt" - - ch_junctionannotation: + - junctionannotation_all: type: file description: All the output files from RSEQC_JUNCTIONANNOTATION pattern: "*.{bed,xls,pdf,R,log}" - - ch_junctionannotation_bed: + - junctionannotation_bed: type: file description: bed file of annotated junctions pattern: "*.junction.bed" - - ch_junctionannotation_interact_bed: + - junctionannotation_interact_bed: type: file description: Interact bed file pattern: "*.Interact.bed" - - ch_junctionannotation_xls: + - junctionannotation_xls: type: file description: xls file with junction information pattern: "*.xls" - - ch_junctionannotation_pdf: + - junctionannotation_pdf: type: file description: junction plot pattern: "*.junction.pdf" - - ch_junctionannotation_events_pdf: + - junctionannotation_events_pdf: type: file description: events plot pattern: "*.events.pdf" - - ch_junctionannotation_rscript: + - junctionannotation_rscript: type: file description: Rscript to reproduce the plots pattern: "*.r" - - ch_junctionannotation_log: + - junctionannotation_log: type: file description: Log file generated by tool pattern: "*.log" - - ch_junctionsaturation: + - junctionsaturation_all: type: file description: All the output files from RSEQC_JUNCTIONSATURATION pattern: "*.{pdf,R}" - - ch_junctionsaturation_pdf: + - junctionsaturation_pdf: type: file description: Junction saturation report pattern: "*.pdf" - - ch_junctionsaturation_rscript: + - junctionsaturation_rscript: type: file description: Junction saturation R-script pattern: "*.r" - - ch_readdistribution: + - readdistribution_txt: type: file description: the read distribution report pattern: "*.read_distribution.txt" - - ch_readduplication: + - readduplication_all: type: file description: All the output files from RSEQC_READDUPLICATION pattern: "*.{xls,pdf,R}" - - ch_readduplication_seq_xls: + - readduplication_seq_xls: type: file description: Read duplication rate determined from mapping position of read pattern: "*seq.DupRate.xls" - - ch_readduplication_pos_xls: + - readduplication_pos_xls: type: file description: Read duplication rate determined from sequence of read pattern: "*pos.DupRate.xls" - - ch_readduplication_pdf: + - readduplication_pdf: type: file description: plot of duplication rate pattern: "*.pdf" - - ch_readduplication_rscript: + - readduplication_rscript: type: file description: script to reproduce the plot pattern: "*.R" - - ch_tin: + - tin_txt: type: file description: TXT file containing tin.py results summary pattern: "*.txt" diff --git a/subworkflows/nf-core/bam_rseqc/tests/main.nf.test b/subworkflows/nf-core/bam_rseqc/tests/main.nf.test index bd84bebffd8..cc1cea4ec69 100644 --- a/subworkflows/nf-core/bam_rseqc/tests/main.nf.test +++ b/subworkflows/nf-core/bam_rseqc/tests/main.nf.test @@ -38,26 +38,26 @@ nextflow_workflow { then { assertAll( { assert workflow.success}, - { assert snapshot(workflow.out.ch_bamstat).match("bamstat")}, + { assert snapshot(workflow.out.bamstat_txt).match("bamstat_txt")}, - { assert snapshot(workflow.out.ch_innerdistance.findAll { it[1].endsWith('.pdf') == false }).match("inner_distance")}, - { assert workflow.out.ch_innerdistance.any { it[1].endsWith('.pdf') && file(it[1]).exists() } }, + { assert snapshot(workflow.out.innerdistance_all.findAll { it[1].endsWith('.pdf') == false }).match("innerdistance_all")}, + { assert workflow.out.innerdistance_all.any { it[1].endsWith('.pdf') && file(it[1]).exists() } }, - { assert snapshot(workflow.out.ch_inferexperiment).match("inferexperiment")}, + { assert snapshot(workflow.out.inferexperiment_txt).match("inferexperiment_txt")}, - { assert snapshot(workflow.out.ch_junctionannotation.findAll { + { assert snapshot(workflow.out.junctionannotation_all.findAll { it[1].endsWith('.xls') == false && - it[1].endsWith('.r') == false }).match("junction_annotation")}, + it[1].endsWith('.r') == false }).match("junctionannotation_all")}, - { assert snapshot(workflow.out.ch_junctionsaturation.findAll { it[1].endsWith('.pdf') == false }).match("junction_saturation")}, - { assert workflow.out.ch_junctionsaturation.any { it[1].endsWith('.pdf') && file(it[1]).exists() } }, + { assert snapshot(workflow.out.junctionsaturation_all.findAll { it[1].endsWith('.pdf') == false }).match("junctionsaturation_all")}, + { assert workflow.out.junctionsaturation_all.any { it[1].endsWith('.pdf') && file(it[1]).exists() } }, - { assert snapshot(workflow.out.ch_readdistribution).match("readdistribution")}, + { assert snapshot(workflow.out.readdistribution_txt).match("readdistribution_txt")}, - { assert snapshot(workflow.out.ch_readduplication.findAll { it[1].endsWith('.pdf') == false }).match("read_duplication")}, - { assert workflow.out.ch_readduplication.any { it[1].endsWith('.pdf') && file(it[1]).exists() } }, + { assert snapshot(workflow.out.readduplication_all.findAll { it[1].endsWith('.pdf') == false }).match("readduplication_all")}, + { assert workflow.out.readduplication_all.any { it[1].endsWith('.pdf') && file(it[1]).exists() } }, - { assert snapshot(workflow.out.ch_tin).match("tin")}, + { assert snapshot(workflow.out.tin_txt).match("tin_txt")}, { assert snapshot(workflow.out.versions).match("versions")}, ) } @@ -84,14 +84,14 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert workflow.out.ch_bamstat.size() == 0 }, - { assert workflow.out.ch_innerdistance.size() == 0 }, - { assert workflow.out.ch_inferexperiment.size() == 0 }, - { assert workflow.out.ch_junctionannotation.size() == 0 }, - { assert workflow.out.ch_junctionsaturation.size() == 0 }, - { assert workflow.out.ch_readdistribution.size() == 0 }, - { assert workflow.out.ch_readduplication.size() == 0 }, - { assert workflow.out.ch_tin.size() == 0 }, + { assert workflow.out.bamstat_txt.size() == 0 }, + { assert workflow.out.innerdistance_all.size() == 0 }, + { assert workflow.out.inferexperiment_txt.size() == 0 }, + { assert workflow.out.junctionannotation_all.size() == 0 }, + { assert workflow.out.junctionsaturation_all.size() == 0 }, + { assert workflow.out.readdistribution_txt.size() == 0 }, + { assert workflow.out.readduplication_all.size() == 0 }, + { assert workflow.out.tin_txt.size() == 0 }, { assert workflow.out.versions.size() == 0 }, ) } diff --git a/subworkflows/nf-core/bam_rseqc/tests/main.nf.test.snap b/subworkflows/nf-core/bam_rseqc/tests/main.nf.test.snap index f80f50b2e83..1680e55c9b4 100644 --- a/subworkflows/nf-core/bam_rseqc/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_rseqc/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "inner_distance": { + "innerdistance_all": { "content": [ [ [ @@ -30,7 +30,7 @@ ], "timestamp": "2023-12-08T14:37:45.734509133" }, - "junction_saturation": { + "junctionsaturation_all": { "content": [ [ [ @@ -71,7 +71,7 @@ ], "timestamp": "2023-12-08T14:37:45.935155313" }, - "bamstat": { + "bamstat_txt": { "content": [ [ [ @@ -97,7 +97,7 @@ ], "timestamp": "2023-12-08T14:37:45.747507043" }, - "read_duplication": { + "readduplication_all": { "content": [ [ [ @@ -122,7 +122,7 @@ ], "timestamp": "2023-12-08T14:37:45.927253593" }, - "junction_annotation": { + "junctionannotation_all": { "content": [ [ [ @@ -135,7 +135,7 @@ ], "timestamp": "2023-12-14T17:42:43.31783911" }, - "readdistribution": { + "readdistribution_txt": { "content": [ [ [ @@ -148,4 +148,4 @@ ], "timestamp": "2023-12-08T14:37:45.841855468" } -} \ No newline at end of file +}