diff --git a/CHANGELOG.md b/CHANGELOG.md index 4826d3015e..baf7361613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#520](https://github.com/nf-core/sarek/pull/520) - Improve annotation subworkflows - [#537](https://github.com/nf-core/sarek/pull/537) - Update workflow figure - [#539](https://github.com/nf-core/sarek/pull/539) - Update `CITATIONS.md` +- [#544](https://github.com/nf-core/sarek/pull/544) - `Mutect2` is no longer compatible with `--no_intervals` ### Fixed diff --git a/conf/modules.config b/conf/modules.config index ddc3cad4d2..baf058e8cd 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -737,7 +737,8 @@ process{ } //MUTECT2 - withName: 'GATK4_CALCULATECONTAMINATION' { + withName: 'CALCULATECONTAMINATION' { + ext.args = { "-tumor-segmentation ${meta.id}.segmentation.table" } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, @@ -747,7 +748,6 @@ process{ withName: 'CONCAT_MUTECT2.*' { publishDir = [ - enabled: !params.no_intervals, mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, pattern: "*{vcf.gz,vcf.gz.tbi}" @@ -763,20 +763,42 @@ process{ ] } - withName: 'GATHERPILEUPSUMMARIES.*' { - ext.prefix = { "${meta.id}.table" } - ext.when = { "${!params.no_intervals}"} + withName: 'GATHERPILEUPSUMMARIES' { + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: 'GATHERPILEUPSUMMARIES' { publishDir = [ - enabled: !params.no_intervals, mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } + withName: 'GATHERPILEUPSUMMARIES_.*' { + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/${meta.tumor_id}_vs_${meta.normal_id}/mutect2" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + withName: 'GETPILEUPSUMMARIES.*' { publishDir = [ - enabled: params.no_intervals, + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, + pattern: "*.table", + saveAs: { meta.num_intervals > 1 ? null : it } + ] + } + + withName: 'LEARNREADORIENTATIONMODEL'{ + ext.prefix = { "${meta.id}.artifactprior" } + publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } @@ -784,7 +806,7 @@ process{ } withName: 'MERGEMUTECTSTATS' { - ext.prefix = { "${meta.id}.vcf.gz" } + ext.prefix = { "${meta.id}" } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, @@ -794,12 +816,12 @@ process{ withName: 'MUTECT2'{ ext.when = { params.tools && params.tools.contains('mutect2') } - ext.args = { params.ignore_soft_clipped_bases ? "--dont-use-soft-clipped-bases true" : "" } + ext.args = { params.ignore_soft_clipped_bases ? "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${meta.id}.f1r2.tar.gz" : "--f1r2-tar-gz ${meta.id}.f1r2.tar.gz" } publishDir = [ - enabled: params.no_intervals, mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, - pattern: "*{gz,gz.tbi,stats}" + pattern: "*{vcf.gz,vcf.gz.tbi,stats}", + saveAs: { meta.num_intervals > 1 ? null : it } ] } @@ -884,34 +906,11 @@ process{ } //MUTECT2 - withName: 'CALCULATECONTAMINATION' { - //ext.args = { params.ignore_soft_clipped_bases ? "--dont-use-soft-clipped-bases true" : "" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - withName: 'NFCORE_SAREK:SAREK:PAIR_VARIANT_CALLING:GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING:GATHERPILEUPSUMMARIES.*' { - ext.prefix = { "${meta.id}.table" } - publishDir = [ - enabled: !params.no_intervals, - mode: params.publish_dir_mode, - //use ${meta.tumor_id}_vs_${meta_normal_id} to publish in the same directory as the remainders of the - //somatic output whilst keeping the filename prefix identifiable for status type - path: { "${params.outdir}/variant_calling/${meta.tumor_id}_vs_${meta.normal_id}/mutect2" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: 'LEARNREADORIENTATIONMODEL' { - ext.prefix = { "${meta.id}.learnreadorientationmodel" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/${meta.id}/mutect2" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] + withName: 'NFCORE_SAREK:SAREK:PAIR_VARIANT_CALLING:GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING:MUTECT2' { + ext.args = { params.ignore_soft_clipped_bases ? + "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${meta.id}.f1r2.tar.gz --normal-sample ${meta.patient}_${meta.normal_id}" : + "--f1r2-tar-gz ${meta.id}.f1r2.tar.gz --normal-sample ${meta.patient}_${meta.normal_id}" } } //MSISENSORPRO diff --git a/modules.json b/modules.json index d792373f86..2f80d79252 100644 --- a/modules.json +++ b/modules.json @@ -79,70 +79,70 @@ "git_sha": "e745e167c1020928ef20ea1397b6b4d230681b4d" }, "gatk4/applybqsr": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/applybqsrspark": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/applyvqsr": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/baserecalibrator": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/baserecalibratorspark": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "fd7ee6799abf1bd5228b4b59ce541f3aeaa2280b" }, "gatk4/calculatecontamination": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/createsequencedictionary": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/estimatelibrarycomplexity": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/filtermutectcalls": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/gatherbqsrreports": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/gatherpileupsummaries": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/genomicsdbimport": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/genotypegvcfs": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/getpileupsummaries": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "f40cfefc0899fd6bb6adc300142ca6c3a35573ff" }, "gatk4/haplotypecaller": { - "git_sha": "68f1c27169946f931ea4318911de5681f88b2961" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/intervallisttobed": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/learnreadorientationmodel": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/markduplicates": { - "git_sha": "0511e7fbbfa4ba41940d33b687b1cc90227b4eb8" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/markduplicatesspark": { "git_sha": "e04970b7d249365cafa5a52912f9a28840481c05" }, "gatk4/mergemutectstats": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/mutect2": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "gatk4/variantrecalibrator": { - "git_sha": "409af2f27cbe45109acc7fee70718d2bf20aa449" + "git_sha": "169b2b96c1167f89ab07127b7057c1d90a6996c7" }, "manta/germline": { "git_sha": "ffedf09b6e84b479c9c901274f74bb33f3777243" @@ -172,7 +172,7 @@ "git_sha": "897c33d5da084b61109500ee44c01da2d3e4e773" }, "samtools/bam2fq": { - "git_sha": "897c33d5da084b61109500ee44c01da2d3e4e773" + "git_sha": "5510ea39fe638594bc26ac34cadf4a84bf27d159" }, "samtools/collatefastq": { "git_sha": "705f8c9ac4dfdf07666e71abde28f267e2dfd5eb" @@ -196,7 +196,7 @@ "git_sha": "897c33d5da084b61109500ee44c01da2d3e4e773" }, "samtools/view": { - "git_sha": "897c33d5da084b61109500ee44c01da2d3e4e773" + "git_sha": "6b64f9cb6c3dd3577931cc3cd032d6fb730000ce" }, "seqkit/split2": { "git_sha": "e745e167c1020928ef20ea1397b6b4d230681b4d" diff --git a/modules/nf-core/modules/ascat/main.nf b/modules/nf-core/modules/ascat/main.nf index 3b53bc0991..fc5b4315df 100644 --- a/modules/nf-core/modules/ascat/main.nf +++ b/modules/nf-core/modules/ascat/main.nf @@ -53,7 +53,7 @@ process ASCAT { ascat.prepareHTS( tumourseqfile = "$input_tumor", normalseqfile = "$input_normal", - tumourname = "Tumour", + tumourname = "meta.sample_id", normalname = "Normal", allelecounter_exe = "alleleCounter", alleles.prefix = "$allele_files", diff --git a/modules/nf-core/modules/gatk4/applybqsr/main.nf b/modules/nf-core/modules/gatk4/applybqsr/main.nf index 7a64dab252..a0e2c45ca0 100644 --- a/modules/nf-core/modules/gatk4/applybqsr/main.nf +++ b/modules/nf-core/modules/gatk4/applybqsr/main.nf @@ -2,10 +2,10 @@ process GATK4_APPLYBQSR { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(input_index), path(bqsr_table), path(intervals) diff --git a/modules/nf-core/modules/gatk4/applybqsrspark/main.nf b/modules/nf-core/modules/gatk4/applybqsrspark/main.nf index 04303c09cd..9d7891ba1e 100644 --- a/modules/nf-core/modules/gatk4/applybqsrspark/main.nf +++ b/modules/nf-core/modules/gatk4/applybqsrspark/main.nf @@ -2,10 +2,10 @@ process GATK4_APPLYBQSR_SPARK { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(input_index), path(bqsr_table), path(intervals) diff --git a/modules/nf-core/modules/gatk4/applyvqsr/main.nf b/modules/nf-core/modules/gatk4/applyvqsr/main.nf index 8b2358093a..d3da833213 100644 --- a/modules/nf-core/modules/gatk4/applyvqsr/main.nf +++ b/modules/nf-core/modules/gatk4/applyvqsr/main.nf @@ -2,10 +2,10 @@ process GATK4_APPLYVQSR { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(vcf), path(vcf_tbi), path(recal), path(recal_index), path(tranches) diff --git a/modules/nf-core/modules/gatk4/baserecalibrator/main.nf b/modules/nf-core/modules/gatk4/baserecalibrator/main.nf index 766a833895..fb26d3da73 100644 --- a/modules/nf-core/modules/gatk4/baserecalibrator/main.nf +++ b/modules/nf-core/modules/gatk4/baserecalibrator/main.nf @@ -2,10 +2,10 @@ process GATK4_BASERECALIBRATOR { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(input_index), path(intervals) diff --git a/modules/nf-core/modules/gatk4/baserecalibratorspark/main.nf b/modules/nf-core/modules/gatk4/baserecalibratorspark/main.nf index 70c7018171..79988b72c3 100644 --- a/modules/nf-core/modules/gatk4/baserecalibratorspark/main.nf +++ b/modules/nf-core/modules/gatk4/baserecalibratorspark/main.nf @@ -2,10 +2,10 @@ process GATK4_BASERECALIBRATOR_SPARK { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0' : - 'broadinstitute/gatk:4.2.3.0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(input_index), path(intervals) diff --git a/modules/nf-core/modules/gatk4/calculatecontamination/main.nf b/modules/nf-core/modules/gatk4/calculatecontamination/main.nf index 197fe6c2e8..c289684edb 100644 --- a/modules/nf-core/modules/gatk4/calculatecontamination/main.nf +++ b/modules/nf-core/modules/gatk4/calculatecontamination/main.nf @@ -2,10 +2,10 @@ process GATK4_CALCULATECONTAMINATION { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(pileup), path(matched) diff --git a/modules/nf-core/modules/gatk4/createsequencedictionary/main.nf b/modules/nf-core/modules/gatk4/createsequencedictionary/main.nf index dbf3704842..13fa9e8100 100644 --- a/modules/nf-core/modules/gatk4/createsequencedictionary/main.nf +++ b/modules/nf-core/modules/gatk4/createsequencedictionary/main.nf @@ -2,10 +2,10 @@ process GATK4_CREATESEQUENCEDICTIONARY { tag "$fasta" label 'process_medium' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: path fasta diff --git a/modules/nf-core/modules/gatk4/estimatelibrarycomplexity/main.nf b/modules/nf-core/modules/gatk4/estimatelibrarycomplexity/main.nf index caa34630a0..46e09a95bb 100644 --- a/modules/nf-core/modules/gatk4/estimatelibrarycomplexity/main.nf +++ b/modules/nf-core/modules/gatk4/estimatelibrarycomplexity/main.nf @@ -2,10 +2,10 @@ process GATK4_ESTIMATELIBRARYCOMPLEXITY { tag "$meta.id" label 'process_medium' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input) diff --git a/modules/nf-core/modules/gatk4/filtermutectcalls/main.nf b/modules/nf-core/modules/gatk4/filtermutectcalls/main.nf index c1c82e0b5f..91f6defa9a 100644 --- a/modules/nf-core/modules/gatk4/filtermutectcalls/main.nf +++ b/modules/nf-core/modules/gatk4/filtermutectcalls/main.nf @@ -2,10 +2,10 @@ process GATK4_FILTERMUTECTCALLS { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(vcf), path(vcf_tbi), path(stats), path(orientationbias), path(segmentation), path(table), val(estimate) diff --git a/modules/nf-core/modules/gatk4/gatherbqsrreports/main.nf b/modules/nf-core/modules/gatk4/gatherbqsrreports/main.nf index 1f5f2e1bbc..231bd39e6a 100644 --- a/modules/nf-core/modules/gatk4/gatherbqsrreports/main.nf +++ b/modules/nf-core/modules/gatk4/gatherbqsrreports/main.nf @@ -2,10 +2,10 @@ process GATK4_GATHERBQSRREPORTS { tag "$meta.id" label 'process_medium' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(table) diff --git a/modules/nf-core/modules/gatk4/gatherpileupsummaries/main.nf b/modules/nf-core/modules/gatk4/gatherpileupsummaries/main.nf index f5e9cf22a0..0b763f4169 100644 --- a/modules/nf-core/modules/gatk4/gatherpileupsummaries/main.nf +++ b/modules/nf-core/modules/gatk4/gatherpileupsummaries/main.nf @@ -2,10 +2,10 @@ process GATK4_GATHERPILEUPSUMMARIES { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: diff --git a/modules/nf-core/modules/gatk4/genomicsdbimport/main.nf b/modules/nf-core/modules/gatk4/genomicsdbimport/main.nf index d2b78899ae..810f2b63b1 100644 --- a/modules/nf-core/modules/gatk4/genomicsdbimport/main.nf +++ b/modules/nf-core/modules/gatk4/genomicsdbimport/main.nf @@ -2,10 +2,10 @@ process GATK4_GENOMICSDBIMPORT { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(vcf), path(tbi), path(interval_file), val(interval_value), path(wspace) diff --git a/modules/nf-core/modules/gatk4/genotypegvcfs/main.nf b/modules/nf-core/modules/gatk4/genotypegvcfs/main.nf index 0df88d662e..11024b1b23 100644 --- a/modules/nf-core/modules/gatk4/genotypegvcfs/main.nf +++ b/modules/nf-core/modules/gatk4/genotypegvcfs/main.nf @@ -2,10 +2,10 @@ process GATK4_GENOTYPEGVCFS { tag "$meta.id" label 'process_high' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(gvcf), path(gvcf_index), path(intervals), path(intervals_index) diff --git a/modules/nf-core/modules/gatk4/getpileupsummaries/main.nf b/modules/nf-core/modules/gatk4/getpileupsummaries/main.nf index c0946f7167..1c05617049 100644 --- a/modules/nf-core/modules/gatk4/getpileupsummaries/main.nf +++ b/modules/nf-core/modules/gatk4/getpileupsummaries/main.nf @@ -2,10 +2,10 @@ process GATK4_GETPILEUPSUMMARIES { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(index), path(intervals) @@ -40,7 +40,7 @@ process GATK4_GETPILEUPSUMMARIES { --variant $variants \\ --output ${prefix}.pileups.table \\ $reference_command \\ - $sites_command \\ + $interval_command \\ --tmp-dir . \\ $args diff --git a/modules/nf-core/modules/gatk4/haplotypecaller/main.nf b/modules/nf-core/modules/gatk4/haplotypecaller/main.nf index 2cd9e7d4e3..6dd3f69e48 100644 --- a/modules/nf-core/modules/gatk4/haplotypecaller/main.nf +++ b/modules/nf-core/modules/gatk4/haplotypecaller/main.nf @@ -2,10 +2,10 @@ process GATK4_HAPLOTYPECALLER { tag "$meta.id" label 'process_medium' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(input_index), path(intervals) diff --git a/modules/nf-core/modules/gatk4/intervallisttobed/main.nf b/modules/nf-core/modules/gatk4/intervallisttobed/main.nf index c0f9df635d..84f3c472ea 100644 --- a/modules/nf-core/modules/gatk4/intervallisttobed/main.nf +++ b/modules/nf-core/modules/gatk4/intervallisttobed/main.nf @@ -2,10 +2,10 @@ process GATK4_INTERVALLISTTOBED { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(intervals) diff --git a/modules/nf-core/modules/gatk4/learnreadorientationmodel/main.nf b/modules/nf-core/modules/gatk4/learnreadorientationmodel/main.nf index 717cf21122..8c4ac94e6f 100644 --- a/modules/nf-core/modules/gatk4/learnreadorientationmodel/main.nf +++ b/modules/nf-core/modules/gatk4/learnreadorientationmodel/main.nf @@ -2,10 +2,10 @@ process GATK4_LEARNREADORIENTATIONMODEL { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(f1r2) diff --git a/modules/nf-core/modules/gatk4/markduplicates/main.nf b/modules/nf-core/modules/gatk4/markduplicates/main.nf index 2650925b7b..97a8c3e1e4 100644 --- a/modules/nf-core/modules/gatk4/markduplicates/main.nf +++ b/modules/nf-core/modules/gatk4/markduplicates/main.nf @@ -2,10 +2,10 @@ process GATK4_MARKDUPLICATES { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(bam) diff --git a/modules/nf-core/modules/gatk4/mergemutectstats/main.nf b/modules/nf-core/modules/gatk4/mergemutectstats/main.nf index 409e06f6a3..54311df7f5 100644 --- a/modules/nf-core/modules/gatk4/mergemutectstats/main.nf +++ b/modules/nf-core/modules/gatk4/mergemutectstats/main.nf @@ -2,10 +2,10 @@ process GATK4_MERGEMUTECTSTATS { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(stats) diff --git a/modules/nf-core/modules/gatk4/mutect2/main.nf b/modules/nf-core/modules/gatk4/mutect2/main.nf index 4a1f576880..abec0d73d3 100644 --- a/modules/nf-core/modules/gatk4/mutect2/main.nf +++ b/modules/nf-core/modules/gatk4/mutect2/main.nf @@ -2,10 +2,10 @@ process GATK4_MUTECT2 { tag "$meta.id" label 'process_medium' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(input), path(input_index), path(intervals) @@ -57,4 +57,18 @@ process GATK4_MUTECT2 { gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi + touch ${prefix}.vcf.gz.stats + touch ${prefix}.f1r2.tar.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') + END_VERSIONS + """ } diff --git a/modules/nf-core/modules/gatk4/variantrecalibrator/main.nf b/modules/nf-core/modules/gatk4/variantrecalibrator/main.nf index cdcc1221f7..120aeade7a 100644 --- a/modules/nf-core/modules/gatk4/variantrecalibrator/main.nf +++ b/modules/nf-core/modules/gatk4/variantrecalibrator/main.nf @@ -2,10 +2,10 @@ process GATK4_VARIANTRECALIBRATOR { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : - 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" input: tuple val(meta), path(vcf), path(tbi) diff --git a/modules/nf-core/modules/samtools/bam2fq/main.nf b/modules/nf-core/modules/samtools/bam2fq/main.nf index 5d6aa79d46..9301d1d33c 100644 --- a/modules/nf-core/modules/samtools/bam2fq/main.nf +++ b/modules/nf-core/modules/samtools/bam2fq/main.nf @@ -45,7 +45,7 @@ process SAMTOOLS_BAM2FQ { bam2fq \\ $args \\ -@ $task.cpus \\ - $inputbam >${prefix}_interleaved.fq.gz + $inputbam | gzip --no-name > ${prefix}_interleaved.fq.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/modules/samtools/view/main.nf b/modules/nf-core/modules/samtools/view/main.nf index 5f14fbbf2c..55194e887f 100644 --- a/modules/nf-core/modules/samtools/view/main.nf +++ b/modules/nf-core/modules/samtools/view/main.nf @@ -8,7 +8,7 @@ process SAMTOOLS_VIEW { 'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }" input: - tuple val(meta), path(input) + tuple val(meta), path(input), path(index) path fasta output: @@ -41,4 +41,16 @@ process SAMTOOLS_VIEW { samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.bam + touch ${prefix}.cram + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS + """ } diff --git a/modules/nf-core/modules/samtools/view/meta.yml b/modules/nf-core/modules/samtools/view/meta.yml index 5604bfa7cd..a8b43ecce6 100644 --- a/modules/nf-core/modules/samtools/view/meta.yml +++ b/modules/nf-core/modules/samtools/view/meta.yml @@ -25,6 +25,10 @@ input: type: file description: BAM/CRAM/SAM file pattern: "*.{bam,cram,sam}" + - index: + type: optional file + description: BAM.BAI/CRAM.CRAI file + pattern: "*.{.bai,.crai}" - fasta: type: optional file description: Reference file the CRAM was created with diff --git a/nextflow_schema.json b/nextflow_schema.json index d72264c160..e5e029de25 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -57,14 +57,14 @@ "type": "string", "fa_icon": "fas fa-toolbox", "description": "Tools to use for variant calling and/or for annotation.", - "help_text": "Multiple separated with commas.\n\nGermline variant calling can currently only be performed with the following variant callers:\n- FreeBayes, HaplotypeCaller, Manta, mpileup, Strelka, TIDDIT\n\nSomatic variant calling can currently only be performed with the following variant callers:\n- ASCAT, Control-FREEC, FreeBayes, Manta, MSIsensorpro, Mutect2, Strelka\n\nTumor-only somatic variant calling can currently only be performed with the following variant callers:\n- Control-FREEC, Manta, mpileup, Mutect2, TIDDIT\n\nAnnotation is done using snpEff, VEP, or even both consecutively.\n\n> **NB** As Sarek will use bgzip and tabix to compress and index VCF files annotated, it expects VCF files to be sorted.\n\n\n\n`DNAseq`, `DNAscope` and `TNscope` are only available with `--sentieon`\n\n> **NB** tools can be specified with no concern for case.", + "help_text": "Multiple separated with commas.\n\nGermline variant calling can currently only be performed with the following variant callers:\n- FreeBayes, HaplotypeCaller, Manta, mpileup, Strelka, TIDDIT\n\nSomatic variant calling can currently only be performed with the following variant callers:\n- ASCAT, Control-FREEC, FreeBayes, Manta, MSIsensorpro, Mutect2, Strelka\n\n**NB** Mutect2 for somatic variant calling cannot be combined with `--no_intervals`\n\nTumor-only somatic variant calling can currently only be performed with the following variant callers:\n- Control-FREEC, Manta, mpileup, Mutect2, TIDDIT\n\nAnnotation is done using snpEff, VEP, or even both consecutively.\n\n> **NB** As Sarek will use bgzip and tabix to compress and index VCF files annotated, it expects VCF files to be sorted.\n\n\n\n`DNAseq`, `DNAscope` and `TNscope` are only available with `--sentieon`\n\n> **NB** tools can be specified with no concern for case.", "pattern": "^((ascat|cnvkit|controlfreec|deepvariant|dnascope|dnaseq|freebayes|haplotypecaller|manta|merge|mpileup|msisensorpro|mutect2|snpeff|strelka|tiddit|tnscope|vep)*,?)*$" }, "no_intervals": { "type": "boolean", "fa_icon": "fas fa-ban", "description": "Disable usage of intervals.", - "help_text": "Intervals are part of the genome chopped up, used to speed up preprocessing and variant calling." + "help_text": "Intervals are part of the genome chopped up, used to speed up preprocessing and variant calling. Cannot be combined with `--tools mutect2`" }, "nucleotides_per_second": { "type": "number", diff --git a/subworkflows/local/pair_variant_calling.nf b/subworkflows/local/pair_variant_calling.nf index 41d21b6c24..72441bb89e 100644 --- a/subworkflows/local/pair_variant_calling.nf +++ b/subworkflows/local/pair_variant_calling.nf @@ -147,27 +147,26 @@ workflow PAIR_VARIANT_CALLING { msisensorpro_output = msisensorpro_output.mix(MSISENSORPRO_MSI_SOMATIC.out.output_report) } - // if (tools.contains('mutect2')) { - // cram_pair_intervals.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai, intervals -> - // [meta, [normal_cram, tumor_cram], [normal_crai, tumor_crai], intervals, ['normal']] - // }.set{cram_pair_mutect2} - - // GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING( - // cram_pair_mutect2, - // fasta, - // fasta_fai, - // dict, - // germline_resource, - // germline_resource_tbi, - // panel_of_normals, - // panel_of_normals_tbi, - // intervals_bed_combine_gz, - // num_intervals - // ) - - // mutect2_vcf = GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING.out.mutect2_vcf - // ch_versions = ch_versions.mix(GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING.out.versions) - // } + if (tools.contains('mutect2')) { + cram_pair_mutect2 = cram_pair_intervals.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai, intervals -> + [meta, [normal_cram, tumor_cram], [normal_crai, tumor_crai], intervals] + } + + GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING( + cram_pair_mutect2, + fasta, + fasta_fai, + dict, + germline_resource, + germline_resource_tbi, + panel_of_normals, + panel_of_normals_tbi, + intervals_bed_combine_gz + ) + + mutect2_vcf = GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING.out.filtered_vcf + ch_versions = ch_versions.mix(GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING.out.versions) + } // if (tools.contains('tiddit')) { // } diff --git a/subworkflows/local/tumor_variant_calling.nf b/subworkflows/local/tumor_variant_calling.nf index c3ebcf1fb9..f382cb79d0 100644 --- a/subworkflows/local/tumor_variant_calling.nf +++ b/subworkflows/local/tumor_variant_calling.nf @@ -101,25 +101,20 @@ workflow TUMOR_ONLY_VARIANT_CALLING { ch_versions = ch_versions.mix(RUN_FREEBAYES.out.versions) } - // if (tools.contains('mutect2')) { - - // which_norm = [] - // cram_recalibrated_intervals.map{ meta, cram, crai, intervals -> [meta, cram, crai, intervals, which_norm]}.set{cram_recalibrated_mutect2} - // GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING(cram_recalibrated_mutect2, - // fasta, - // fasta_fai, - // dict, - // germline_resource, - // germline_resource_tbi, - // panel_of_normals, - // panel_of_normals_tbi, - // intervals_bed_combine_gz, - // num_intervals) - - // mutect2_vcf = GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING.out.mutect2_vcf - // ch_versions = ch_versions.mix(GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING.out.versions) - - // } + if (tools.contains('mutect2')) { + GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING(cram_recalibrated_intervals, + fasta, + fasta_fai, + dict, + germline_resource, + germline_resource_tbi, + panel_of_normals, + panel_of_normals_tbi, + intervals_bed_combine_gz) + + mutect2_vcf = GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING.out.filtered_vcf + ch_versions = ch_versions.mix(GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING.out.versions) + } if (tools.contains('manta')){ RUN_MANTA_TUMORONLY(cram_recalibrated_intervals_gz_tbi, diff --git a/subworkflows/nf-core/gatk4/tumor_normal_somatic_variant_calling/main.nf b/subworkflows/nf-core/gatk4/tumor_normal_somatic_variant_calling/main.nf index 1d6620df4d..19e4a37350 100644 --- a/subworkflows/nf-core/gatk4/tumor_normal_somatic_variant_calling/main.nf +++ b/subworkflows/nf-core/gatk4/tumor_normal_somatic_variant_calling/main.nf @@ -2,17 +2,17 @@ // Run GATK mutect2 in tumor normal mode, getepileupsummaries, calculatecontamination, learnreadorientationmodel and filtermutectcalls // -include { TABIX_BGZIP as BGZIP_MUTECT2 } from '../../../../modules/nf-core/modules/tabix/bgzip/main' +include { TABIX_BGZIP as BGZIP_VC_MUTECT2 } from '../../../../modules/nf-core/modules/tabix/bgzip/main' include { CONCAT_VCF as CONCAT_MUTECT2 } from '../../../../modules/local/concat_vcf/main' -include { GATK4_MUTECT2 as MUTECT2 } from '../../../../modules/nf-core/modules/gatk4/mutect2/main' -include { GATK4_MERGEMUTECTSTATS as MERGEMUTECTSTATS } from '../../../../modules/nf-core/modules/gatk4/mergemutectstats/main' -include { GATK4_LEARNREADORIENTATIONMODEL as LEARNREADORIENTATIONMODEL } from '../../../../modules/nf-core/modules/gatk4/learnreadorientationmodel/main' -include { GATK4_GATHERPILEUPSUMMARIES as GATHERPILEUPSUMMARIES_TUMOR } from '../../../../modules/nf-core/modules/gatk4/gatherpileupsummaries/main' -include { GATK4_GATHERPILEUPSUMMARIES as GATHERPILEUPSUMMARIES_NORMAL} from '../../../../modules/nf-core/modules/gatk4/gatherpileupsummaries/main' -include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES_TUMOR } from '../../../../modules/nf-core/modules/gatk4/getpileupsummaries/main' -include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES_NORMAL } from '../../../../modules/nf-core/modules/gatk4/getpileupsummaries/main' include { GATK4_CALCULATECONTAMINATION as CALCULATECONTAMINATION } from '../../../../modules/nf-core/modules/gatk4/calculatecontamination/main' include { GATK4_FILTERMUTECTCALLS as FILTERMUTECTCALLS } from '../../../../modules/nf-core/modules/gatk4/filtermutectcalls/main' +include { GATK4_GATHERPILEUPSUMMARIES as GATHERPILEUPSUMMARIES_NORMAL} from '../../../../modules/nf-core/modules/gatk4/gatherpileupsummaries/main' +include { GATK4_GATHERPILEUPSUMMARIES as GATHERPILEUPSUMMARIES_TUMOR } from '../../../../modules/nf-core/modules/gatk4/gatherpileupsummaries/main' +include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES_NORMAL } from '../../../../modules/nf-core/modules/gatk4/getpileupsummaries/main' +include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES_TUMOR } from '../../../../modules/nf-core/modules/gatk4/getpileupsummaries/main' +include { GATK4_LEARNREADORIENTATIONMODEL as LEARNREADORIENTATIONMODEL } from '../../../../modules/nf-core/modules/gatk4/learnreadorientationmodel/main' +include { GATK4_MERGEMUTECTSTATS as MERGEMUTECTSTATS } from '../../../../modules/nf-core/modules/gatk4/mergemutectstats/main' +include { GATK4_MUTECT2 as MUTECT2 } from '../../../../modules/nf-core/modules/gatk4/mutect2/main' workflow GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING { take: @@ -24,8 +24,7 @@ workflow GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING { germline_resource_tbi // channel: /path/to/germline/index panel_of_normals // channel: /path/to/panel/of/normals panel_of_normals_tbi // channel: /path/to/panel/of/normals/index - intervals_bed_combine_gz - num_intervals + intervals_bed_combine_gz // Combined intervals file for merging! main: ch_versions = Channel.empty() @@ -33,141 +32,198 @@ workflow GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING { // //Perform variant calling using mutect2 module in tumor single mode. // - MUTECT2 ( input, false, false, false, fasta, fai, dict, germline_resource, germline_resource_tbi, panel_of_normals, panel_of_normals_tbi ) - ch_versions = ch_versions.mix(MUTECT2.out.versions) - - // - //Generate pileup summary tables using getepileupsummaries. tumor sample should always be passed in as the first input and input list entries of ch_mutect2_in, - //to ensure correct file order for calculatecontamination. - input.multiMap{ meta, input_list, input_index_list, intervals, which_norm -> - tumor: [ meta, input_list[1], input_index_list[1], intervals ] - normal: [ meta, input_list[0], input_index_list[0], intervals ] - }.set{pileup} - - GETPILEUPSUMMARIES_TUMOR ( pileup.tumor, fasta, fai, dict, germline_resource, germline_resource_tbi ) - GETPILEUPSUMMARIES_NORMAL ( pileup.normal, fasta, fai, dict, germline_resource, germline_resource_tbi ) - ch_versions = ch_versions.mix(GETPILEUPSUMMARIES_NORMAL.out.versions) + MUTECT2(input, + fasta, + fai, + dict, + germline_resource, + germline_resource_tbi, + panel_of_normals, + panel_of_normals_tbi) // Figure out if using intervals or no_intervals MUTECT2.out.vcf.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 - }.set{ mutect2_vcf } + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }.set{ mutect2_vcf_branch } MUTECT2.out.tbi.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 - }.set{ mutect2_tbi } + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }.set{ mutect2_tbi_branch } MUTECT2.out.stats.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 - }.set{ mutect2_stats } - - GETPILEUPSUMMARIES_NORMAL.out.table.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 - }set{ pileup_table_normal } - - GETPILEUPSUMMARIES_TUMOR.out.table.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 - }set{ pileup_table_tumor } + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }.set{ mutect2_stats_branch } + MUTECT2.out.f1r2.branch{ + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }.set{ mutect2_f1r2_branch } //Only when using intervals - //Merge Mutect2 VCF - BGZIP_MUTECT2(MUTECT2.out.vcf) + BGZIP_VC_MUTECT2(mutect2_vcf_branch.intervals) CONCAT_MUTECT2( - BGZIP_MUTECT2.out.output.map{ meta, vcf -> - [[id: meta.tumor_id + "_vs_" + meta.normal_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], vcf] - }.groupTuple(size: num_intervals), + BGZIP_VC_MUTECT2.out.output + .map{ meta, vcf -> + new_meta = meta.clone() + new_meta.id = new_meta.tumor_id + "_vs_" + new_meta.normal_id + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, vcf] + }.groupTuple(), fai, intervals_bed_combine_gz) mutect2_vcf = Channel.empty().mix( CONCAT_MUTECT2.out.vcf, - mutect2_vcf.no_intervals) + mutect2_vcf_branch.no_intervals) mutect2_tbi = Channel.empty().mix( CONCAT_MUTECT2.out.tbi, - mutect2_tbi.no_intervals) - - ch_versions = ch_versions.mix(BGZIP_MUTECT2.out.versions) - ch_versions = ch_versions.mix(CONCAT_MUTECT2.out.versions) + mutect2_tbi_branch.no_intervals) //Merge Muteect2 Stats - MERGEMUTECTSTATS(mutect2_stats.intervals.map{ meta, stats -> - [[id: meta.tumor_id + "_vs_" + meta.normal_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], stats] - }.groupTuple(size: num_intervals)) + MERGEMUTECTSTATS( + mutect2_stats_branch.intervals + .map{ meta, stats -> + new_meta = meta.clone() + new_meta.id = new_meta.tumor_id + "_vs_" + new_meta.normal_id + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, stats] + }.groupTuple()) mutect2_stats = Channel.empty().mix( MERGEMUTECTSTATS.out.stats, - mutect2_stats.no_intervals) + mutect2_stats_branch.no_intervals) + + // + //Generate artifactpriors using learnreadorientationmodel on the f1r2 output of mutect2. + // + LEARNREADORIENTATIONMODEL( + mutect2_f1r2_branch.intervals + .map{ meta, f1r2 -> + new_meta = meta.clone() + new_meta.id = new_meta.tumor_id + "_vs_" + new_meta.normal_id + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, f1r2] + }.groupTuple()) + + // + //Generate pileup summary tables using getepileupsummaries. tumor sample should always be passed in as the first input and input list entries of ch_mutect2_in, + //to ensure correct file order for calculatecontamination. + pileup = input.multiMap{ meta, input_list, input_index_list, intervals -> + tumor: [ meta, input_list[1], input_index_list[1], intervals ] + normal: [ meta, input_list[0], input_index_list[0], intervals ] + } + + GETPILEUPSUMMARIES_TUMOR ( pileup.tumor.map{ + meta, cram, crai, intervals -> + new_meta = meta.clone() + new_meta.id = new_meta.num_intervals <= 1 ? new_meta.tumor_id : new_meta.tumor_id + "_" + intervals.baseName + [new_meta, cram, crai, intervals] + }, + fasta, fai, dict, germline_resource, germline_resource_tbi ) + + GETPILEUPSUMMARIES_NORMAL ( pileup.normal.map{ + meta, cram, crai, intervals -> + new_meta = meta.clone() + new_meta.id = new_meta.num_intervals <= 1 ? new_meta.normal_id : new_meta.normal_id + "_" + intervals.baseName + [new_meta, cram, crai, intervals] + }, + fasta, fai, dict, germline_resource, germline_resource_tbi ) + + GETPILEUPSUMMARIES_NORMAL.out.table.branch{ + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }set{ pileup_table_normal } + + GETPILEUPSUMMARIES_TUMOR.out.table.branch{ + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }set{ pileup_table_tumor } //Merge Pileup Summaries GATHERPILEUPSUMMARIES_NORMAL( - GETPILEUPSUMMARIES_NORMAL.out.table.map{ meta, table -> - [[id: meta.normal_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], table] - }.groupTuple(size: num_intervals), + GETPILEUPSUMMARIES_NORMAL.out.table + .map{ meta, table -> + new_meta = meta.clone() + new_meta.id = new_meta.normal_id + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, table] + }.groupTuple(), dict) gather_table_normal = Channel.empty().mix( - GATHERPILEUPSUMMARIES_NORMAL.out.table.map{ meta, table -> - [[id: meta.tumor_id + "_vs_" + meta.normal_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], table] - }, - pileup_table_normal.no_intervals) - - GATHERPILEUPSUMMARIES_TUMOR( GETPILEUPSUMMARIES_TUMOR.out.table.map{ meta, table -> - [[id: meta.tumor_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], table] - }.groupTuple(size: num_intervals), + GATHERPILEUPSUMMARIES_NORMAL.out.table, + pileup_table_normal.no_intervals).map{ meta, table -> + new_meta = meta.clone() + new_meta.id = new_meta.tumor_id + "_vs_" + new_meta.normal_id + [new_meta, table] + } + + GATHERPILEUPSUMMARIES_TUMOR( + GETPILEUPSUMMARIES_TUMOR.out.table + .map{ meta, table -> + new_meta = meta.clone() + new_meta.id = new_meta.tumor_id + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, table] + }.groupTuple(), dict) gather_table_tumor = Channel.empty().mix( - GATHERPILEUPSUMMARIES_TUMOR.out.table.map{ meta, table -> - [[id: meta.tumor_id + "_vs_" + meta.normal_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], table] - }, - pileup_table_tumor.no_intervals) - - // - //Generate artifactpriors using learnreadorientationmodel on the f1r2 output of mutect2. - // - MUTECT2.out.f1r2.map{ meta, f1f2 -> - [[id: meta.tumor_id + "_vs_" + meta.normal_id, normal_id: meta.normal_id, tumor_id: meta.tumor_id, gender: meta.gender, patient: meta.patient ], f1f2] - }.groupTuple(size: num_intervals) - .set{ch_learnread_in} - - LEARNREADORIENTATIONMODEL (ch_learnread_in) - ch_versions = ch_versions.mix(LEARNREADORIENTATIONMODEL.out.versions) + GATHERPILEUPSUMMARIES_TUMOR.out.table, + pileup_table_tumor.no_intervals).map{ meta, table -> + new_meta = meta.clone() + new_meta.id = new_meta.tumor_id + "_vs_" + new_meta.normal_id + [new_meta, table] + } // //Contamination and segmentation tables created using calculatecontamination on the pileup summary table. // - ch_calccon_in = gather_table_tumor.join(gather_table_normal) - CALCULATECONTAMINATION ( ch_calccon_in, true ) - ch_versions = ch_versions.mix(CALCULATECONTAMINATION.out.versions) + CALCULATECONTAMINATION ( gather_table_tumor.join(gather_table_normal) ) // //Mutect2 calls filtered by filtermutectcalls using the artifactpriors, contamination and segmentation tables. // + mutect2_vcf.view() + mutect2_tbi.view() + LEARNREADORIENTATIONMODEL.out.artifactprior.view() + CALCULATECONTAMINATION.out.segmentation.view() + CALCULATECONTAMINATION.out.contamination.view() ch_filtermutect = mutect2_vcf.join(mutect2_tbi) .join(mutect2_stats) .join(LEARNREADORIENTATIONMODEL.out.artifactprior) .join(CALCULATECONTAMINATION.out.segmentation) .join(CALCULATECONTAMINATION.out.contamination) - ch_filtermutect.map{ meta, vcf, tbi, stats, orientation, seg, cont -> - [meta, vcf, tbi, stats, orientation, seg, cont, []] - }.set{ch_filtermutect_in} + ch_filtermutect_in = ch_filtermutect.map{ meta, vcf, tbi, stats, orientation, seg, cont -> [meta, vcf, tbi, stats, orientation, seg, cont, []] } FILTERMUTECTCALLS ( ch_filtermutect_in, fasta, fai, dict ) - ch_versions = ch_versions.mix(FILTERMUTECTCALLS.out.versions) + + ch_versions = ch_versions.mix(BGZIP_VC_MUTECT2.out.versions) + ch_versions = ch_versions.mix(CONCAT_MUTECT2.out.versions) + ch_versions = ch_versions.mix(CALCULATECONTAMINATION.out.versions) + ch_versions = ch_versions.mix(FILTERMUTECTCALLS.out.versions) + ch_versions = ch_versions.mix(GETPILEUPSUMMARIES_NORMAL.out.versions) + ch_versions = ch_versions.mix(GETPILEUPSUMMARIES_TUMOR.out.versions) + ch_versions = ch_versions.mix(GATHERPILEUPSUMMARIES_NORMAL.out.versions) + ch_versions = ch_versions.mix(GATHERPILEUPSUMMARIES_TUMOR.out.versions) + ch_versions = ch_versions.mix(LEARNREADORIENTATIONMODEL.out.versions) + ch_versions = ch_versions.mix(MERGEMUTECTSTATS.out.versions) + ch_versions = ch_versions.mix(MUTECT2.out.versions) emit: mutect2_vcf = mutect2_vcf // channel: [ val(meta), [ vcf ] ] mutect2_stats = mutect2_stats // channel: [ val(meta), [ stats ] ] - mutect2_f1r2 = MUTECT2.out.f1r2 // channel: [ val(meta), [ f1r2 ] ] artifact_priors = LEARNREADORIENTATIONMODEL.out.artifactprior // channel: [ val(meta), [ artifactprior ] ] @@ -177,7 +233,9 @@ workflow GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING { contamination_table = CALCULATECONTAMINATION.out.contamination // channel: [ val(meta), [ contamination ] ] segmentation_table = CALCULATECONTAMINATION.out.segmentation // channel: [ val(meta), [ segmentation ] ] - filtered_vcf = FILTERMUTECTCALLS.out.vcf // channel: [ val(meta), [ vcf ] ] + filtered_vcf = FILTERMUTECTCALLS.out.vcf.map{ meta, vcf -> + meta.variantcaller = "Mutect2" + [meta, vcf]} // channel: [ val(meta), [ vcf ] ] filtered_tbi = FILTERMUTECTCALLS.out.tbi // channel: [ val(meta), [ tbi ] ] filtered_stats = FILTERMUTECTCALLS.out.stats // channel: [ val(meta), [ stats ] ] diff --git a/subworkflows/nf-core/gatk4/tumor_only_somatic_variant_calling/main.nf b/subworkflows/nf-core/gatk4/tumor_only_somatic_variant_calling/main.nf index 6e94218d23..6b8ccf1da1 100644 --- a/subworkflows/nf-core/gatk4/tumor_only_somatic_variant_calling/main.nf +++ b/subworkflows/nf-core/gatk4/tumor_only_somatic_variant_calling/main.nf @@ -2,14 +2,15 @@ // Run GATK mutect2 in tumor only mode, getepileupsummaries, calculatecontamination and filtermutectcalls // -include { TABIX_BGZIP as BGZIP_VC_MUTECT2 } from '../../../../modules/nf-core/modules/tabix/bgzip/main' -include { CONCAT_VCF as CONCAT_MUTECT2 } from '../../../../modules/local/concat_vcf/main' -include { GATK4_MUTECT2 as MUTECT2 } from '../../../../modules/nf-core/modules/gatk4/mutect2/main' -include { GATK4_MERGEMUTECTSTATS as MERGEMUTECTSTATS } from '../../../../modules/nf-core/modules/gatk4/mergemutectstats/main' -include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES } from '../../../../modules/nf-core/modules/gatk4/getpileupsummaries/main' -include { GATK4_GATHERPILEUPSUMMARIES as GATHERPILEUPSUMMARIES } from '../../../../modules/nf-core/modules/gatk4/gatherpileupsummaries/main' -include { GATK4_CALCULATECONTAMINATION as CALCULATECONTAMINATION } from '../../../../modules/nf-core/modules/gatk4/calculatecontamination/main' -include { GATK4_FILTERMUTECTCALLS as FILTERMUTECTCALLS } from '../../../../modules/nf-core/modules/gatk4/filtermutectcalls/main' +include { TABIX_BGZIP as BGZIP_VC_MUTECT2 } from '../../../../modules/nf-core/modules/tabix/bgzip/main' +include { CONCAT_VCF as CONCAT_MUTECT2 } from '../../../../modules/local/concat_vcf/main' +include { GATK4_CALCULATECONTAMINATION as CALCULATECONTAMINATION } from '../../../../modules/nf-core/modules/gatk4/calculatecontamination/main' +include { GATK4_FILTERMUTECTCALLS as FILTERMUTECTCALLS } from '../../../../modules/nf-core/modules/gatk4/filtermutectcalls/main' +include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES } from '../../../../modules/nf-core/modules/gatk4/getpileupsummaries/main' +include { GATK4_GATHERPILEUPSUMMARIES as GATHERPILEUPSUMMARIES } from '../../../../modules/nf-core/modules/gatk4/gatherpileupsummaries/main' +include { GATK4_LEARNREADORIENTATIONMODEL as LEARNREADORIENTATIONMODEL } from '../../../../modules/nf-core/modules/gatk4/learnreadorientationmodel/main' +include { GATK4_MERGEMUTECTSTATS as MERGEMUTECTSTATS } from '../../../../modules/nf-core/modules/gatk4/mergemutectstats/main' +include { GATK4_MUTECT2 as MUTECT2 } from '../../../../modules/nf-core/modules/gatk4/mutect2/main' workflow GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING { take: @@ -21,8 +22,7 @@ workflow GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING { germline_resource_tbi // channel: /path/to/germline/index panel_of_normals // channel: /path/to/panel/of/normals panel_of_normals_tbi // channel: /path/to/panel/of/normals/index - intervals_bed_combine_gz - num_intervals + intervals_bed_combine_gz // Combined intervals file for merging! main: ch_versions = Channel.empty() @@ -30,47 +30,49 @@ workflow GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING { // //Perform variant calling using mutect2 module in tumor single mode. // - MUTECT2 ( input , true , false , false , fasta , fai , dict , germline_resource , germline_resource_tbi , panel_of_normals , panel_of_normals_tbi ) - - // - //Generate pileup summary table using getepileupsummaries. - // - pileup_input = input.map { - meta, input_file, input_index, intervals, which_norm -> - [meta, input_file, input_index, intervals] - } - GETPILEUPSUMMARIES ( pileup_input , fasta, fai, dict, germline_resource , germline_resource_tbi ) + MUTECT2(input, + fasta, + fai, + dict, + germline_resource, + germline_resource_tbi, + panel_of_normals, + panel_of_normals_tbi) // Figure out if using intervals or no_intervals MUTECT2.out.vcf.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 }.set{ mutect2_vcf_branch } MUTECT2.out.tbi.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 }.set{ mutect2_tbi_branch } MUTECT2.out.stats.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 }.set{ mutect2_stats_branch } - GETPILEUPSUMMARIES.out.table.branch{ - intervals: num_intervals > 1 - no_intervals: num_intervals == 1 - }set{ pileup_table_branch } + MUTECT2.out.f1r2.branch{ + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }.set{ mutect2_f1r2_branch } //Only when using intervals //Merge Mutect2 VCF BGZIP_VC_MUTECT2(mutect2_vcf_branch.intervals) - CONCAT_MUTECT2(BGZIP_VC_MUTECT2.out.output.map{ meta, vcf -> + CONCAT_MUTECT2( + BGZIP_VC_MUTECT2.out.output + .map{ meta, vcf -> new_meta = meta.clone() new_meta.id = new_meta.sample + + def groupKey = groupKey(meta, meta.num_intervals) [new_meta, vcf] - }.groupTuple(size: num_intervals), + }.groupTuple(), fai, intervals_bed_combine_gz) @@ -82,23 +84,56 @@ workflow GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING { CONCAT_MUTECT2.out.tbi, mutect2_tbi_branch.no_intervals) - //Merge Muteect2 Stats - MERGEMUTECTSTATS(mutect2_stats_branch.intervals.map{ meta, stats -> - new_meta = meta.clone() - new_meta.id = new_meta.sample - [new_meta, stats] - }.groupTuple(size: num_intervals)) + //Merge Mutect2 Stats + MERGEMUTECTSTATS( + mutect2_stats_branch.intervals + .map{ meta, stats -> + new_meta = meta.clone() + new_meta.id = new_meta.sample + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, stats] + }.groupTuple()) mutect2_stats = Channel.empty().mix( MERGEMUTECTSTATS.out.stats, mutect2_stats_branch.no_intervals) + // + //Generate artifactpriors using learnreadorientationmodel on the f1r2 output of mutect2. + // + LEARNREADORIENTATIONMODEL( + Channel.empty().mix( + mutect2_f1r2_branch.intervals + .map{ meta, f1r2 -> + new_meta = meta.clone() + new_meta.id = new_meta.sample + + def groupKey = groupKey(meta, meta.num_intervals) + [new_meta, f1r2] + }.groupTuple(), + mutect2_f1r2_branch.no_intervals)) + + // + //Generate pileup summary table using getepileupsummaries. + // + GETPILEUPSUMMARIES ( input , fasta, fai, dict, germline_resource , germline_resource_tbi ) + + GETPILEUPSUMMARIES.out.table.branch{ + intervals: it[0].num_intervals > 1 + no_intervals: it[0].num_intervals <= 1 + }set{ pileup_table_branch } + //Merge Pileup Summaries - GATHERPILEUPSUMMARIES( GETPILEUPSUMMARIES.out.table.map{ meta, table -> + GATHERPILEUPSUMMARIES( + GETPILEUPSUMMARIES.out.table + .map{ meta, table -> new_meta = meta.clone() new_meta.id = new_meta.sample + + def groupKey = groupKey(meta, meta.num_intervals) [new_meta, table] - }.groupTuple(size: num_intervals), + }.groupTuple(), dict) pileup_table = Channel.empty().mix( @@ -108,26 +143,28 @@ workflow GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING { // //Contamination and segmentation tables created using calculatecontamination on the pileup summary table. // - pileup_table.map{meta, table -> [meta, table, []]}.set{table_contamination} - CALCULATECONTAMINATION ( table_contamination, true ) + table_contamination = pileup_table.map{meta, table -> [meta, table, []]} + CALCULATECONTAMINATION ( table_contamination ) // //Mutect2 calls filtered by filtermutectcalls using the contamination and segmentation tables. // ch_filtermutect = mutect2_vcf.join(mutect2_tbi) .join(mutect2_stats) + .join(LEARNREADORIENTATIONMODEL.out.artifactprior) .join(CALCULATECONTAMINATION.out.segmentation) .join(CALCULATECONTAMINATION.out.contamination) - ch_filtermutect_in = ch_filtermutect.map{ meta, vcf, tbi, stats, seg, cont -> [meta, vcf, tbi, stats, [], seg, cont, []] } + ch_filtermutect_in = ch_filtermutect.map{ meta, vcf, tbi, stats, artifactprior, seg, cont -> [meta, vcf, tbi, stats, artifactprior, seg, cont, []] } FILTERMUTECTCALLS ( ch_filtermutect_in, fasta, fai, dict ) ch_versions = ch_versions.mix(BGZIP_VC_MUTECT2.out.versions) - ch_versions = ch_versions.mix(CALCULATECONTAMINATION.out.versions) ch_versions = ch_versions.mix(CONCAT_MUTECT2.out.versions) + ch_versions = ch_versions.mix(CALCULATECONTAMINATION.out.versions) ch_versions = ch_versions.mix(FILTERMUTECTCALLS.out.versions) - ch_versions = ch_versions.mix(GATHERPILEUPSUMMARIES.out.versions) ch_versions = ch_versions.mix(GETPILEUPSUMMARIES.out.versions) + ch_versions = ch_versions.mix(GATHERPILEUPSUMMARIES.out.versions) + ch_versions = ch_versions.mix(LEARNREADORIENTATIONMODEL.out.versions) ch_versions = ch_versions.mix(MERGEMUTECTSTATS.out.versions) ch_versions = ch_versions.mix(MUTECT2.out.versions) @@ -135,12 +172,16 @@ workflow GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING { mutect2_vcf = mutect2_vcf // channel: [ val(meta), [ vcf ] ] mutect2_stats = mutect2_stats // channel: [ val(meta), [ stats ] ] + artifact_priors = LEARNREADORIENTATIONMODEL.out.artifactprior // channel: [ val(meta), [ artifactprior ] ] + pileup_table = pileup_table // channel: [ val(meta), [ table ] ] contamination_table = CALCULATECONTAMINATION.out.contamination // channel: [ val(meta), [ contamination ] ] segmentation_table = CALCULATECONTAMINATION.out.segmentation // channel: [ val(meta), [ segmentation ] ] - filtered_vcf = FILTERMUTECTCALLS.out.vcf // channel: [ val(meta), [ vcf ] ] + filtered_vcf = FILTERMUTECTCALLS.out.vcf.map{ meta, vcf -> + meta.variantcaller = "Mutect2" + [meta, vcf] } // channel: [ val(meta), [ vcf ] ] filtered_index = FILTERMUTECTCALLS.out.tbi // channel: [ val(meta), [ tbi ] ] filtered_stats = FILTERMUTECTCALLS.out.stats // channel: [ val(meta), [ stats ] ] diff --git a/tests/nextflow.config b/tests/nextflow.config index ca18d021f9..571a04f5a0 100644 --- a/tests/nextflow.config +++ b/tests/nextflow.config @@ -22,4 +22,9 @@ process { } } + withName: 'NFCORE_SAREK:SAREK:PAIR_VARIANT_CALLING:GATK_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING:MUTECT2'{ + //sample name from when the test data was generated + ext.args = { "--f1r2-tar-gz ${meta.id}.f1r2.tar.gz --normal-sample normal " } + } + } diff --git a/tests/test_tools.yml b/tests/test_tools.yml index 38a4efacb4..b7f5e451ab 100644 --- a/tests/test_tools.yml +++ b/tests/test_tools.yml @@ -298,7 +298,8 @@ - path: results/variant_calling/sample2/mutect2/sample2.vcf.gz.stats - path: results/variant_calling/sample2/mutect2/sample2.contamination.table - path: results/variant_calling/sample2/mutect2/sample2.segmentation.table - - path: results/variant_calling/sample2/mutect2/sample2.table.pileupsummaries.table + - path: results/variant_calling/sample2/mutect2/sample2.artifactprior.tar.gz + - path: results/variant_calling/sample2/mutect2/sample2.pileupsummaries.table - path: results/variant_calling/sample2/mutect2/sample2.filtered.vcf.gz - path: results/variant_calling/sample2/mutect2/sample2.filtered.vcf.gz.tbi - path: results/variant_calling/sample2/mutect2/sample2.filtered.vcf.gz.filteringStats.tsv @@ -310,19 +311,13 @@ - no_intervals - tumor_only - variant_calling - files: - - path: results/variant_calling/sample2/mutect2/sample2.vcf.gz - - path: results/variant_calling/sample2/mutect2/sample2.vcf.gz.tbi - - path: results/variant_calling/sample2/mutect2/sample2.vcf.gz.stats - - path: results/variant_calling/sample2/mutect2/sample2.contamination.table - - path: results/variant_calling/sample2/mutect2/sample2.segmentation.table - - path: results/variant_calling/sample2/mutect2/sample2.pileups.table - - path: results/variant_calling/sample2/mutect2/sample2.filtered.vcf.gz - - path: results/variant_calling/sample2/mutect2/sample2.filtered.vcf.gz.tbi - - path: results/variant_calling/sample2/mutect2/sample2.filtered.vcf.gz.filteringStats.tsv + exit_code: 1 + stdout: + contains: + - "--tools mutect2 and --no_intervals cannot be used together." - name: Run variant calling on somatic sample with mutect2 - command: nextflow run main.nf -profile test,tools_somatic,docker --tools mutect2 + command: nextflow run main.nf -profile test,tools_somatic,docker --tools mutect2 -c ./tests/nextflow.config tags: - mutect2 - somatic @@ -333,9 +328,9 @@ - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.vcf.gz.stats - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.contamination.table - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.segmentation.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample3.table.pileupsummaries.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4.table.pileupsummaries.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.learnreadorientationmodel.tar.gz + - path: results/variant_calling/sample4_vs_sample3/mutect2/sample3.pileupsummaries.table + - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4.pileupsummaries.table + - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.artifactprior.tar.gz - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.filtered.vcf.gz - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.filtered.vcf.gz.tbi - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.filtered.vcf.gz.filteringStats.tsv @@ -347,18 +342,10 @@ - no_intervals - somatic - variant_calling - files: - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.vcf.gz - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.vcf.gz.tbi - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.vcf.gz.stats - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.contamination.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.segmentation.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample3.pileups.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4.pileups.table - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.learnreadorientationmodel.tar.gz - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.filtered.vcf.gz - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.filtered.vcf.gz.tbi - - path: results/variant_calling/sample4_vs_sample3/mutect2/sample4_vs_sample3.filtered.vcf.gz.filteringStats.tsv + exit_code: 1 + stdout: + contains: + - "--tools mutect2 and --no_intervals cannot be used together." - name: Run variant calling on somatic sample with msisensor-pro command: nextflow run main.nf -profile test,tools_somatic,docker --tools msisensorpro diff --git a/workflows/sarek.nf b/workflows/sarek.nf index 68ce35299c..b763d45926 100644 --- a/workflows/sarek.nf +++ b/workflows/sarek.nf @@ -69,6 +69,11 @@ if (params.wes) { if (params.intervals && !params.intervals.endsWith("bed") && !params.intervals.endsWith("interval_list")) exit 1, "Interval file must end with .bed or .interval_list" } + +if(params.tools && params.tools.contains('mutect2') && params.no_intervals){ + log.error "--tools mutect2 and --no_intervals cannot be used together.\nOne of the tools within the Mutect2 subworkflow requires intervals. They can be provided to the pipeline with --intervals. If none are provided, they will be generated from the FASTA file.\nFor more information on the Mutect2 workflow, see here: https://gatk.broadinstitute.org/hc/en-us/articles/360035531132--How-to-Call-somatic-mutations-using-GATK4-Mutect2.\nFor more information on GetPileupsummaries, see here: https://gatk.broadinstitute.org/hc/en-us/articles/5358860217115-GetPileupSummaries" + exit 1 +} // Save AWS IGenomes file containing annotation version def anno_readme = params.genomes[params.genome]?.readme if (anno_readme && file(anno_readme).exists()) { @@ -965,7 +970,7 @@ def extract_csv(csv_file) { def fastq_1 = file(row.fastq_1, checkIfExists: true) def fastq_2 = file(row.fastq_2, checkIfExists: true) def CN = params.seq_center ? "CN:${params.seq_center}\\t" : '' - def read_group = "\"@RG\\tID:${row.lane}\\t${CN}PU:${row.lane}\\tSM:${row.sample}\\tLB:${row.sample}\\tPL:${params.seq_platform}\"" + def read_group = "\"@RG\\tID:${row.lane}\\t${CN}PU:${row.lane}\\tSM:${row.patient}_${row.sample}\\tLB:${row.sample}\\tDS:${params.fasta}\\tPL:${params.seq_platform}\"" meta.numLanes = numLanes.toInteger() meta.read_group = read_group.toString() meta.data_type = "fastq"