From 8f3550dd88b354ea33aba8f6684d8cc685a0bad3 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Thu, 18 May 2023 19:17:09 -0400 Subject: [PATCH 1/4] Add patch to multiqc module so that it can now accept a meta map as input --- conf/modules.config | 2 +- modules.json | 3 ++- modules/nf-core/multiqc/main.nf | 2 +- modules/nf-core/multiqc/meta.yml | 6 ++++++ modules/nf-core/multiqc/multiqc.diff | 30 ++++++++++++++++++++++++++++ subworkflows/local/qc.nf | 14 ++++++++++--- workflows/forte.nf | 2 +- 7 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 modules/nf-core/multiqc/multiqc.diff diff --git a/conf/modules.config b/conf/modules.config index 0bed051..3d9df5a 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -35,7 +35,7 @@ process { ] } - withName: '.*:QC:MULTIQC' { + withName: '.*:QC:MULTIQC_COLLECT' { publishDir = [ path: { "${params.outdir}/multiqc" }, mode: params.publish_dir_mode, diff --git a/modules.json b/modules.json index e6b5152..0c13a1a 100644 --- a/modules.json +++ b/modules.json @@ -48,7 +48,8 @@ "multiqc": { "branch": "master", "git_sha": "ee80d14721e76e2e079103b8dcd5d57129e584ba", - "installed_by": ["modules"] + "installed_by": ["modules"], + "patch": "modules/nf-core/multiqc/multiqc.diff" }, "picard/collecthsmetrics": { "branch": "master", diff --git a/modules/nf-core/multiqc/main.nf b/modules/nf-core/multiqc/main.nf index 4b60474..5fc35f0 100644 --- a/modules/nf-core/multiqc/main.nf +++ b/modules/nf-core/multiqc/main.nf @@ -7,7 +7,7 @@ process MULTIQC { 'quay.io/biocontainers/multiqc:1.14--pyhdfd78af_0' }" input: - path multiqc_files, stageAs: "?/*" + tuple val(meta), path(multiqc_files, stageAs: "?/*") path(multiqc_config) path(extra_multiqc_config) path(multiqc_logo) diff --git a/modules/nf-core/multiqc/meta.yml b/modules/nf-core/multiqc/meta.yml index ebc29b2..d8d9b50 100644 --- a/modules/nf-core/multiqc/meta.yml +++ b/modules/nf-core/multiqc/meta.yml @@ -14,6 +14,12 @@ tools: licence: ["GPL-3.0-or-later"] input: + - meta: + type: + type: map + description: | + Groovy Map containing meta information + e.g. [ id:'test' ] - multiqc_files: type: file description: | diff --git a/modules/nf-core/multiqc/multiqc.diff b/modules/nf-core/multiqc/multiqc.diff new file mode 100644 index 0000000..1645613 --- /dev/null +++ b/modules/nf-core/multiqc/multiqc.diff @@ -0,0 +1,30 @@ +Changes in module 'nf-core/multiqc' +--- modules/nf-core/multiqc/meta.yml ++++ modules/nf-core/multiqc/meta.yml +@@ -14,6 +14,12 @@ + licence: ["GPL-3.0-or-later"] + + input: ++ - meta: ++ type: ++ type: map ++ description: | ++ Groovy Map containing meta information ++ e.g. [ id:'test' ] + - multiqc_files: + type: file + description: | + +--- modules/nf-core/multiqc/main.nf ++++ modules/nf-core/multiqc/main.nf +@@ -7,7 +7,7 @@ + 'quay.io/biocontainers/multiqc:1.14--pyhdfd78af_0' }" + + input: +- path multiqc_files, stageAs: "?/*" ++ tuple val(meta), path(multiqc_files, stageAs: "?/*") + path(multiqc_config) + path(extra_multiqc_config) + path(multiqc_logo) + +************************************************************ diff --git a/subworkflows/local/qc.nf b/subworkflows/local/qc.nf index db71f5f..18ef59c 100644 --- a/subworkflows/local/qc.nf +++ b/subworkflows/local/qc.nf @@ -2,7 +2,10 @@ ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config include { PICARD_COLLECTRNASEQMETRICS } from '../../modules/nf-core/picard/collectrnaseqmetrics/main' include { PICARD_COLLECTHSMETRICS } from '../../modules/nf-core/picard/collecthsmetrics/main' -include { MULTIQC } from '../../modules/nf-core/multiqc/main' +include { + MULTIQC ; + MULTIQC as MULTIQC_COLLECT +} from '../../modules/nf-core/multiqc/main' workflow QC { @@ -47,8 +50,6 @@ workflow QC { multiqc_ch = PICARD_COLLECTRNASEQMETRICS.out.metrics .mix(fastp_json) .mix(PICARD_COLLECTHSMETRICS.out.metrics) - .map{meta, multiqc_files -> multiqc_files } - .collect() MULTIQC( multiqc_ch, @@ -57,6 +58,13 @@ workflow QC { [] ) + MULTIQC_COLLECT( + multiqc_ch.map{meta, multiqc_files -> multiqc_files}.collect().map{[[:],it]}, + ch_multiqc_config.collect().ifEmpty([]), + [], + [] + ) + emit: ch_versions diff --git a/workflows/forte.nf b/workflows/forte.nf index a957d48..e90917e 100644 --- a/workflows/forte.nf +++ b/workflows/forte.nf @@ -153,7 +153,7 @@ workflow FORTE { ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml')) ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect()) - ch_multiqc_files.collect() + ch_multiqc_files.collect().map{ files -> [[:], files] } MULTIQC ( ch_multiqc_files.collect(), From e1a9ca491d3434da5e44476d1034f683df321390 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Thu, 1 Jun 2023 18:03:16 -0400 Subject: [PATCH 2/4] Remove mentions of anoronh4/forte from multiqc config --- assets/pipeline_multiqc_config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/pipeline_multiqc_config.yml b/assets/pipeline_multiqc_config.yml index 97e49f4..dee69fd 100644 --- a/assets/pipeline_multiqc_config.yml +++ b/assets/pipeline_multiqc_config.yml @@ -1,12 +1,12 @@ report_comment: > - This report has been generated by the anoronh4/forte + This report has been generated by the mskcc/forte analysis pipeline. report_section_order: - "anoronh4-forte-methods-description": + "mskcc-forte-methods-description": order: -1000 software_versions: order: -1001 - "anoronh4-forte-summary": + "mskcc-forte-summary": order: -1002 export_plots: true From a0102b9a4ab7b8305ddbb383fdfbf0144ba270c4 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Thu, 1 Jun 2023 22:21:58 -0400 Subject: [PATCH 3/4] Duplicated QC subworkflow for dedup bam and dup bam --- conf/modules.config | 40 +++++++++++++++++++++++++++++++++++++++- subworkflows/local/qc.nf | 14 +++++++++----- workflows/forte.nf | 28 +++++++++++++++++++++------- 3 files changed, 69 insertions(+), 13 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 3d9df5a..4de0e8a 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -35,7 +35,13 @@ process { ] } - withName: '.*:QC:MULTIQC_COLLECT' { + withName: '.*:QC_DEDUP:MULTIQC_COLLECT' { + ext.args = { + [ + "--cl-config \"subtitle: 'Deduplicated Bam'\"", + "-n dedupbam_multiqc_report" + ].join(" ") + } publishDir = [ path: { "${params.outdir}/multiqc" }, mode: params.publish_dir_mode, @@ -43,6 +49,38 @@ process { ] } + withName: '.*:QC_DUP:MULTIQC_COLLECT' { + ext.args = { + [ + "--cl-config \"subtitle: 'Non-deduplicated Bam'\"", + "-n dupbam_multiqc_report" + ].join(" ") + } + publishDir = [ + path: { "${params.outdir}/multiqc" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QC_DEDUP:MULTIQC' { + ext.args = { + [ + "--cl-config \"subtitle: 'Deduplicated Bam'\"", + "-n dedupbam_multiqc_report" + ].join(" ") + } + } + + withName: '.*:QC_DUP:MULTIQC' { + ext.args = { + [ + "--cl-config \"subtitle: 'Non-deduplicated Bam'\"", + "-n dupbam_multiqc_report" + ].join(" ") + } + } + withName: SAMPLESHEET_CHECK { publishDir = [ path: { "${params.outdir}/pipeline_info" }, diff --git a/subworkflows/local/qc.nf b/subworkflows/local/qc.nf index 18ef59c..c23c715 100644 --- a/subworkflows/local/qc.nf +++ b/subworkflows/local/qc.nf @@ -12,12 +12,13 @@ workflow QC { take: bam bai + multiqc_files refflat rrna_intervals fai dict baits - fastp_json + main: fasta = params.fasta @@ -47,19 +48,22 @@ workflow QC { dict.map{ dict -> [[:],dict]} ) - multiqc_ch = PICARD_COLLECTRNASEQMETRICS.out.metrics - .mix(fastp_json) + multiqc_files = multiqc_files + .mix(PICARD_COLLECTRNASEQMETRICS.out.metrics) .mix(PICARD_COLLECTHSMETRICS.out.metrics) + .map{ meta, file -> + [meta.subMap(['sample']),file] + } MULTIQC( - multiqc_ch, + multiqc_files.groupTuple(by:[0]), ch_multiqc_config.collect().ifEmpty([]), [], [] ) MULTIQC_COLLECT( - multiqc_ch.map{meta, multiqc_files -> multiqc_files}.collect().map{[[:],it]}, + multiqc_files.map{meta, multiqc_files -> multiqc_files}.collect().map{[[:],it]}, ch_multiqc_config.collect().ifEmpty([]), [], [] diff --git a/workflows/forte.nf b/workflows/forte.nf index e90917e..7119eb0 100644 --- a/workflows/forte.nf +++ b/workflows/forte.nf @@ -55,7 +55,10 @@ include { PREPROCESS_READS } from '../subworkflows/local/prepro include { ALIGN_READS } from '../subworkflows/local/align_reads' include { MERGE_READS } from '../subworkflows/local/merge_reads' include { MULTIQC } from '../modules/nf-core/multiqc/main' -include { QC } from '../subworkflows/local/qc' +include { + QC as QC_DUP ; + QC as QC_DEDUP +} from '../subworkflows/local/qc' include { QUANTIFICATION } from '../subworkflows/local/quantification' include { FUSION } from '../subworkflows/local/fusion' @@ -123,17 +126,28 @@ workflow FORTE { ) ch_versions = ch_versions.mix(FUSION.out.ch_versions) - QC( + QC_DEDUP( ALIGN_READS.out.bam, ALIGN_READS.out.bai, + PREPROCESS_READS.out.fastp_json, PREPARE_REFERENCES.out.refflat, PREPARE_REFERENCES.out.rrna_interval_list, PREPARE_REFERENCES.out.fasta_fai, PREPARE_REFERENCES.out.fasta_dict, - BAIT_INPUTS.out.baits, - PREPROCESS_READS.out.fastp_json + BAIT_INPUTS.out.baits + ) + ch_versions = ch_versions.mix(QC_DEDUP.out.ch_versions) + + QC_DUP( + ALIGN_READS.out.bam_withdup, + ALIGN_READS.out.bai_withdup, + PREPROCESS_READS.out.fastp_json, + PREPARE_REFERENCES.out.refflat, + PREPARE_REFERENCES.out.rrna_interval_list, + PREPARE_REFERENCES.out.fasta_fai, + PREPARE_REFERENCES.out.fasta_dict, + BAIT_INPUTS.out.baits ) - ch_versions = ch_versions.mix(QC.out.ch_versions) CUSTOM_DUMPSOFTWAREVERSIONS ( ch_versions.unique().collectFile(name: 'collated_versions.yml') @@ -153,10 +167,10 @@ workflow FORTE { ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml')) ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect()) - ch_multiqc_files.collect().map{ files -> [[:], files] } + ch_multiqc_files = ch_multiqc_files.collect().map{ files -> [[:], files] } MULTIQC ( - ch_multiqc_files.collect(), + ch_multiqc_files, ch_multiqc_config.collect().ifEmpty([]), ch_multiqc_custom_config.collect().ifEmpty([]), ch_multiqc_logo.collect().ifEmpty([]) From 421a6b912217c9ee5e79f628a7154059e253e908 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Thu, 1 Jun 2023 23:14:56 -0400 Subject: [PATCH 4/4] fix linting errors --- modules/nf-core/multiqc/meta.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/nf-core/multiqc/meta.yml b/modules/nf-core/multiqc/meta.yml index d8d9b50..c25a1af 100644 --- a/modules/nf-core/multiqc/meta.yml +++ b/modules/nf-core/multiqc/meta.yml @@ -15,7 +15,6 @@ tools: input: - meta: - type: type: map description: | Groovy Map containing meta information