diff --git a/CHANGELOG.md b/CHANGELOG.md index 539b938e1b..040f05afb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Rapaselet is a delta formed by the RapaƤtno river between the Bielloriehppe mas - [#1173](https://github.com/nf-core/sarek/pull/1173) - CI tests for VQSR track with stub runs - [#1122](https://github.com/nf-core/sarek/pull/1122), [#1196](https://github.com/nf-core/sarek/pull/1196) - Add `annotation cache` functionality - [#1184](https://github.com/nf-core/sarek/pull/1184) - Stub-based CI-test of Sentieon joint-germline variant-calling with VQSR +- [#1188](https://github.com/nf-core/sarek/pull/1188) - `--tools` is now case insensitive ### Changed diff --git a/checkInParam.nf b/checkInParam.nf new file mode 100644 index 0000000000..2df385de71 --- /dev/null +++ b/checkInParam.nf @@ -0,0 +1,21 @@ + +// Global function +// Check the parameters tools or skip_tools, then compare it against the provided tool +// Returns true/false based on whether 'tool' is found in 'parameter' +def checkInParam(parameter, checkValue) { + if (!parameter){ + false + } else { + def tokenized_parameter = parameter.tokenize(',') + switch (checkValue) { + // If checkValue is a list check if any appear in tokenized parameter + case checkValue instanceof List: + checkValue.any{ it.toLowerCase() in parameter.tokenize(',') } + // If checkValue is a string check it appears in parameter + case checkValue instanceof String: + checkValue.toLowerCase() in parameter.tokenize(',') + default: + false + } + } +} diff --git a/conf/modules/aligner.config b/conf/modules/aligner.config index 931f18d6af..c57e3657f5 100644 --- a/conf/modules/aligner.config +++ b/conf/modules/aligner.config @@ -46,8 +46,8 @@ process { if (params.save_output_as_bam && ( params.save_mapped || - (params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) && - !(params.tools && params.tools.split(',').contains('sentieon_dedup')) + (checkInParam(params.skip_tools, 'markduplicates')) && + !(checkInParam(params.tools, 'sentieon_dedup')) ) && (meta.size * meta.num_lanes == 1) ) { "mapped/${meta.id}/${it}" } else { null } @@ -60,7 +60,7 @@ process { // However if it's skipped, reads need to be coordinate-sorted // Only name sort if Spark for Markduplicates + duplicate marking is not skipped // Currently SENTIEON_BWAMEM only supports coordinate sorting the reads. - ext.args2 = { params.use_gatk_spark && params.use_gatk_spark.contains('markduplicates') && (!params.skip_tools || (params.skip_tools && !params.skip_tools.split(',').contains('markduplicates'))) ? '-n' : '' } + ext.args2 = { params.use_gatk_spark && params.use_gatk_spark.contains('markduplicates') && (!params.skip_tools || (params.skip_tools && !checkInParam(params.skip_tools, 'markduplicates'))) ? '-n' : '' } } withName: "BWAMEM.*_MEM|SENTIEON_BWAMEM" { @@ -75,7 +75,7 @@ process { path: { "${params.outdir}/preprocessing/" }, pattern: "*{bam,bai}", // Only save if (save_output_as_bam AND (no_markduplicates OR save_mapped )) - saveAs: { (params.save_output_as_bam && (params.save_mapped || params.skip_tools && params.skip_tools.split(',').contains('markduplicates'))) ? "mapped/${meta.id}/${it}" : null } + saveAs: { (params.save_output_as_bam && (params.save_mapped || checkInParam(params.skip_tools, 'markduplicates'))) ? "mapped/${meta.id}/${it}" : null } ] } diff --git a/conf/modules/annotate.config b/conf/modules/annotate.config index bf92ecf7b8..b81fdca088 100644 --- a/conf/modules/annotate.config +++ b/conf/modules/annotate.config @@ -16,7 +16,7 @@ process { // SNPEFF - if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge'))) { + if (params.tools && (checkInParam(params.tools, 'snpeff') || checkInParam(params.tools, 'merge'))) { withName: 'SNPEFF_SNPEFF' { ext.prefix = { vcf.baseName - ".vcf" + "_snpEff" } ext.args = '-nodownload -canon -v' @@ -25,14 +25,14 @@ process { mode: params.publish_dir_mode, path: { "${params.outdir}/reports/snpeff/${meta.variantcaller}/${meta.id}/" }, pattern: "*{csv,html,genes.txt}", - saveAs: { params.tools.split(',').contains('snpeff') ? it : null } + saveAs: { checkInParam(params.tools, 'snpeff') ? it : null } ] ] } } // VEP - if (params.tools && (params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge'))) { + if (params.tools && (checkInParam(params.tools, 'vep') || checkInParam(params.tools, 'merge'))) { withName: 'ENSEMBLVEP_VEP' { ext.args = { [ (params.vep_dbnsfp && params.dbnsfp && !params.dbnsfp_consequence) ? "--plugin dbNSFP,${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', @@ -61,7 +61,7 @@ process { } // SNPEFF THEN VEP - if (params.tools && params.tools.split(',').contains('merge')) { + if (checkInParam(params.tools, 'merge')) { withName: "NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_MERGE:ENSEMBLVEP_VEP" { // If merge: Output file will have format *_snpEff_VEP.ann.vcf, *_snpEff_VEP.ann.json or *_snpEff_VEP.ann.tab ext.prefix = { vcf.baseName - ".ann.vcf" + "_VEP.ann" } @@ -69,7 +69,7 @@ process { } // ALL ANNOTATION TOOLS - if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge'))) { + if (params.tools && (checkInParam(params.tools, 'snpeff') || checkInParam(params.tools, 'vep') || checkInParam(params.tools, 'merge'))) { withName: "NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:.*:(TABIX_BGZIPTABIX|TABIX_TABIX)" { ext.prefix = { input.name - ".vcf" } publishDir = [ @@ -80,13 +80,13 @@ process { } } - if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge'))) { + if (params.tools && (checkInParam(params.tools, 'snpeff') || checkInParam(params.tools, 'merge'))) { withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_SNPEFF:TABIX_BGZIPTABIX' { publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, pattern: "*{gz,gz.tbi}", - saveAs: { params.tools.split(',').contains('snpeff') ? it : null } + saveAs: { checkInParam(params.tools, 'snpeff') ? it : null } ] } } diff --git a/conf/modules/ascat.config b/conf/modules/ascat.config index 8a8cf79999..4b3fd3a887 100644 --- a/conf/modules/ascat.config +++ b/conf/modules/ascat.config @@ -26,7 +26,7 @@ process { "min_base_qual": params.ascat_min_base_qual, "min_map_qual": params.ascat_min_map_qual ]} - ext.when = { params.tools && params.tools.split(',').contains('ascat') } + ext.when = { checkInParam(params.tools, 'ascat') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/ascat/${meta.id}/" }, diff --git a/conf/modules/cnvkit.config b/conf/modules/cnvkit.config index f77c6ef446..a17c684c56 100644 --- a/conf/modules/cnvkit.config +++ b/conf/modules/cnvkit.config @@ -17,7 +17,7 @@ process { // PREPARE REFERENCE CNVKIT withName: 'CNVKIT_ANTITARGET' { - ext.when = { params.tools && params.tools.split(',').contains('cnvkit') } + ext.when = { checkInParam(params.tools, 'cnvkit') } publishDir = [ enabled: params.save_reference, mode: params.publish_dir_mode, @@ -28,7 +28,7 @@ process { withName: 'CNVKIT_REFERENCE' { ext.prefix = "cnvkit" - ext.when = { params.tools && params.tools.split(',').contains('cnvkit') && !params.cnvkit_reference } + ext.when = { checkInParam(params.tools, 'cnvkit') && !params.cnvkit_reference } publishDir = [ enabled: params.save_reference, mode: params.publish_dir_mode, @@ -40,7 +40,7 @@ process { // CNVKIT withName: 'CNVKIT_BATCH' { ext.args = { params.wes ? "--method hybrid --diagram --scatter" : "--method wgs --diagram --scatter" } - ext.when = { params.tools && params.tools.split(',').contains('cnvkit') } + ext.when = { checkInParam(params.tools, 'cnvkit') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/cnvkit/${meta.id}/" }, diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index 3945756957..9a9387f865 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -24,7 +24,7 @@ process { } withName: 'FREEC_.*' { - ext.when = { params.tools && params.tools.split(',').contains('controlfreec') } + ext.when = { checkInParam(params.tools, 'controlfreec') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, diff --git a/conf/modules/deepvariant.config b/conf/modules/deepvariant.config index 65ed591c4d..a82b6791fd 100644 --- a/conf/modules/deepvariant.config +++ b/conf/modules/deepvariant.config @@ -18,7 +18,7 @@ process { withName: 'DEEPVARIANT' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.deepvariant" : "${meta.id}.deepvariant.${intervals.simpleName}" } ext.args = { params.wes ? "--model_type WES" : "--model_type WGS" } - ext.when = { params.tools && params.tools.split(',').contains('deepvariant') } + ext.when = { checkInParam(params.tools, 'deepvariant') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/" }, diff --git a/conf/modules/freebayes.config b/conf/modules/freebayes.config index 35064a36a3..a6eb34c041 100644 --- a/conf/modules/freebayes.config +++ b/conf/modules/freebayes.config @@ -28,7 +28,7 @@ process { ext.args = '--min-alternate-fraction 0.1 --min-mapping-quality 1' //To make sure no naming conflicts ensure with module BCFTOOLS_SORT & the naming being correct in the output folder ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}" : "${meta.id}.${target_bed.simpleName}" } - ext.when = { params.tools && params.tools.split(',').contains('freebayes') } + ext.when = { checkInParam(params.tools, 'freebayes') } publishDir = [ enabled: false ] @@ -53,7 +53,7 @@ process { } // PAIR_VARIANT_CALLING - if (params.tools && params.tools.split(',').contains('freebayes')) { + if (checkInParam(params.tools, 'freebayes')) { withName: '.*:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_FREEBAYES:FREEBAYES' { ext.args = "--pooled-continuous \ --pooled-discrete \ diff --git a/conf/modules/haplotypecaller.config b/conf/modules/haplotypecaller.config index be159c4152..8078b79b23 100644 --- a/conf/modules/haplotypecaller.config +++ b/conf/modules/haplotypecaller.config @@ -18,7 +18,7 @@ process { withName: 'GATK4_HAPLOTYPECALLER' { ext.args = { params.joint_germline ? "-ERC GVCF" : "" } ext.prefix = { meta.num_intervals <= 1 ? ( params.joint_germline ? "${meta.id}.haplotypecaller.g" : "${meta.id}.haplotypecaller" ) : ( params.joint_germline ? "${meta.id}.haplotypecaller.${intervals.simpleName}.g" :"${meta.id}.haplotypecaller.${intervals.simpleName}" ) } - ext.when = { params.tools && params.tools.split(',').contains('haplotypecaller') } + ext.when = { checkInParam(params.tools, 'haplotypecaller') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/"}, @@ -53,7 +53,7 @@ process { ] } - if (params.tools && params.tools.split(',').contains('haplotypecaller')) { + if (checkInParam(params.tools, 'haplotypecaller')) { withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_HAPLOTYPECALLER:BAM_MERGE_INDEX_SAMTOOLS:(MERGE_BAM|INDEX_MERGE_BAM)' { ext.prefix = { "${meta.id}.realigned" } publishDir = [ diff --git a/conf/modules/joint_germline.config b/conf/modules/joint_germline.config index 5905c482fd..67519f2343 100644 --- a/conf/modules/joint_germline.config +++ b/conf/modules/joint_germline.config @@ -30,7 +30,7 @@ process { ] } - if (params.tools && params.tools.contains('haplotypecaller') && params.joint_germline) { + if (checkInParam(params.tools, 'haplotypecaller') && params.joint_germline) { withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_JOINT_CALLING_GERMLINE_GATK:BCFTOOLS_SORT' { ext.prefix = { vcf.baseName - ".vcf" + ".sort" } publishDir = [ diff --git a/conf/modules/manta.config b/conf/modules/manta.config index 7049970af3..0568f07c2e 100644 --- a/conf/modules/manta.config +++ b/conf/modules/manta.config @@ -14,7 +14,7 @@ // MANTA process { - if (params.tools && params.tools.split(',').contains('manta')) { + if (checkInParam(params.tools, 'manta')) { withName: 'MANTA_GERMLINE|MANTA_TUMORONLY|MANTA_SOMATIC' { ext.args = { params.wes ? "--exome" : "" } ext.prefix = { "${meta.id}.manta" } diff --git a/conf/modules/markduplicates.config b/conf/modules/markduplicates.config index 702b9b721b..c2141a0603 100644 --- a/conf/modules/markduplicates.config +++ b/conf/modules/markduplicates.config @@ -34,7 +34,7 @@ process { } withName: 'NFCORE_SAREK:SAREK:(BAM_MARKDUPLICATES|BAM_MARKDUPLICATES_SPARK):CRAM_QC_MOSDEPTH_SAMTOOLS:SAMTOOLS_STATS' { - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) } + ext.when = { !(checkInParam(params.skip_tools, 'samtools')) } ext.prefix = { "${meta.id}.md.cram" } publishDir = [ mode: params.publish_dir_mode, @@ -47,8 +47,8 @@ process { // Run only when mapping should be saved as CRAM or when no MD is done ext.when = (params.save_mapped && !params.save_output_as_bam) || ( - (params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) && - !(params.tools && params.tools.split(',').contains('sentieon_dedup')) + (checkInParam(params.skip_tools, 'markduplicates')) && + !(checkInParam(params.tools, 'sentieon_dedup')) ) ext.prefix = { "${meta.id}.sorted" } publishDir = [ @@ -62,7 +62,7 @@ process { withName: 'GATK4_ESTIMATELIBRARYCOMPLEXITY' { ext.prefix = { "${meta.id}.md.cram" } - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('markduplicates_report')) } + ext.when = { !(checkInParam(params.skip_tools, 'markduplicates_report')) } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/reports/markduplicates/${meta.id}" }, @@ -73,7 +73,7 @@ process { withName: 'GATK4_MARKDUPLICATES' { ext.args = '-REMOVE_DUPLICATES false -VALIDATION_STRINGENCY LENIENT' ext.prefix = { "${meta.id}.md.cram" } - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) } + ext.when = { !(checkInParam(params.skip_tools, 'markduplicates')) } publishDir = [ [ enabled: !params.save_output_as_bam, @@ -85,7 +85,7 @@ process { mode: params.publish_dir_mode, path: { "${params.outdir}/reports/" }, pattern: "*metrics", - saveAs: { !(params.skip_tools && params.skip_tools.split(',').contains('markduplicates_report')) ? "markduplicates/${meta.id}/${it}" : null} + saveAs: { !(checkInParam(params.skip_tools, 'markduplicates_report')) ? "markduplicates/${meta.id}/${it}" : null} ] ] } @@ -112,7 +112,7 @@ process { withName: 'NFCORE_SAREK:SAREK:CRAM_TO_BAM' { ext.when = { params.save_output_as_bam } - if (params.tools && params.tools.split(',').contains('sentieon_dedup')) { + if (checkInParam(params.tools, 'sentieon_dedup')) { ext.prefix = { "${meta.id}.dedup" } publishDir = [ enabled: params.save_output_as_bam, diff --git a/conf/modules/modules.config b/conf/modules/modules.config index 356d0768ac..cbf989135d 100644 --- a/conf/modules/modules.config +++ b/conf/modules/modules.config @@ -30,7 +30,7 @@ process { // QC withName: 'FASTQC' { ext.args = '--quiet' - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('fastqc')) } + ext.when = { !(checkInParam(params.skip_tools, 'fastqc')) } publishDir = [ [ path: { "${params.outdir}/reports/fastqc/${meta.id}" }, @@ -41,7 +41,7 @@ process { } withName: 'NFCORE_SAREK:SAREK:CRAM_QC_NO_MD:SAMTOOLS_STATS' { - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) } + ext.when = { !(checkInParam(params.skip_tools, 'samtools')) } ext.prefix = { "${meta.id}.sorted.cram" } publishDir = [ mode: params.publish_dir_mode, @@ -53,15 +53,15 @@ process { withName: 'MOSDEPTH' { ext.args = { !params.wes ? "-n --fast-mode --by 500" : ""} ext.prefix = { - if (params.tools && params.tools.split(',').contains('sentieon_dedup')) { + if (checkInParam(params.tools, 'sentieon_dedup')) { "${meta.id}.dedup" - } else if (params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) { + } else if (checkInParam(params.skip_tools, 'markduplicates')) { "${meta.id}.sorted" } else { "${meta.id}.md" } } - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('mosdepth')) } + ext.when = { !(checkInParam(params.skip_tools, 'mosdepth')) } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/reports/mosdepth/${meta.id}" }, @@ -69,14 +69,14 @@ process { ] } - if ((params.step == 'mapping' || params.step == 'markduplicates'|| params.step == 'prepare_recalibration'|| params.step == 'recalibrate') && (!(params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator')))) { + if ((params.step == 'mapping' || params.step == 'markduplicates'|| params.step == 'prepare_recalibration'|| params.step == 'recalibrate') && (!(checkInParam(params.skip_tools, 'baserecalibrator')))) { withName: 'NFCORE_SAREK:SAREK:CRAM_QC_RECAL:MOSDEPTH' { ext.prefix = { "${meta.id}.recal" } } withName: 'NFCORE_SAREK:SAREK:CRAM_QC_RECAL:SAMTOOLS_STATS' { ext.prefix = { "${meta.id}.recal.cram" } - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) } + ext.when = { !(checkInParam(params.skip_tools, 'samtools')) } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/reports/samtools/${meta.id}" }, @@ -87,7 +87,7 @@ process { // VCF withName: 'BCFTOOLS_STATS' { - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('bcftools')) } + ext.when = { !(checkInParam(params.skip_tools, 'bcftools')) } ext.prefix = { vcf.baseName - ".vcf" } publishDir = [ mode: params.publish_dir_mode, @@ -97,7 +97,7 @@ process { } withName: 'VCFTOOLS_.*' { - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('vcftools')) } + ext.when = { !(checkInParam(params.skip_tools, 'vcftools')) } ext.prefix = { variant_file.baseName - ".vcf" } publishDir = [ mode: params.publish_dir_mode, diff --git a/conf/modules/mpileup.config b/conf/modules/mpileup.config index 9ef259daaf..011bc3f449 100644 --- a/conf/modules/mpileup.config +++ b/conf/modules/mpileup.config @@ -23,7 +23,7 @@ process { withName: 'BCFTOOLS_MPILEUP' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.bcftools" : "${meta.id}_${intervals.simpleName}.bcftools" } - ext.when = { params.tools && params.tools.split(',').contains('mpileup') } + ext.when = { checkInParam(params.tools, 'mpileup') } ext.args2 = "--multiallelic-caller" ext.args3 = "-i 'count(GT==\"RR\")==0'" // only report non homozygous reference variants publishDir = [ @@ -44,7 +44,7 @@ process { } withName: 'SAMTOOLS_MPILEUP' { - ext.when = { params.tools && params.tools.split(',').contains('controlfreec') } + ext.when = { checkInParam(params.tools, 'controlfreec') } publishDir = [ enabled: false ] @@ -52,7 +52,7 @@ process { } // PAIR_VARIANT_CALLING - if (params.tools && params.tools.split(',').contains('controlfreec')) { + if (checkInParam(params.tools, 'controlfreec')) { withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_MPILEUP:SAMTOOLS_MPILEUP' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.normal" : "${meta.id}_${intervals.simpleName}.normal" } } diff --git a/conf/modules/mutect2.config b/conf/modules/mutect2.config index 210edde641..de0b18b19b 100644 --- a/conf/modules/mutect2.config +++ b/conf/modules/mutect2.config @@ -14,11 +14,11 @@ // MUTECT2 process { - if (params.tools && params.tools.split(',').contains('mutect2')) { + if (checkInParam(params.tools, 'mutect2')) { withName: 'GATK4_MUTECT2' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.mutect2" : "${meta.id}.mutect2.${intervals.simpleName}" } - ext.when = { params.tools && params.tools.split(',').contains('mutect2') } + ext.when = { checkInParam(params.tools, 'mutect2') } ext.args = { params.ignore_soft_clipped_bases ? "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz" : "--f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz" } publishDir = [ mode: params.publish_dir_mode, diff --git a/conf/modules/prepare_cache.config b/conf/modules/prepare_cache.config index fd13b10cfd..67aa847688 100644 --- a/conf/modules/prepare_cache.config +++ b/conf/modules/prepare_cache.config @@ -17,7 +17,7 @@ process { // SNPEFF withName: 'SNPEFF_DOWNLOAD' { - ext.when = { params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge')) } + ext.when = { params.tools && (checkInParam(params.tools, 'snpeff') || checkInParam(params.tools, 'merge')) } publishDir = [ mode: params.publish_dir_mode, path: { params.outdir_cache ? "${params.outdir_cache}/": "${params.outdir}/cache/" } @@ -26,7 +26,7 @@ process { // VEP withName: 'ENSEMBLVEP_DOWNLOAD' { - ext.when = { params.tools && (params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge')) } + ext.when = { params.tools && (checkInParam(params.tools, 'vep') || checkInParam(params.tools, 'merge')) } ext.args = '--AUTO c --CONVERT --NO_BIOPERL --NO_HTSLIB --NO_TEST --NO_UPDATE' publishDir = [ mode: params.publish_dir_mode, diff --git a/conf/modules/prepare_genome.config b/conf/modules/prepare_genome.config index 66eb2041d2..e175980bfb 100644 --- a/conf/modules/prepare_genome.config +++ b/conf/modules/prepare_genome.config @@ -56,7 +56,7 @@ process { } withName: 'MSISENSORPRO_SCAN' { - ext.when = { params.tools && params.tools.split(',').contains('msisensorpro') } + ext.when = { checkInParam(params.tools, 'msisensorpro') } publishDir = [ enabled: (params.save_reference || params.build_only_index), mode: params.publish_dir_mode, @@ -76,7 +76,7 @@ process { } withName: 'TABIX_DBSNP' { - ext.when = { !params.dbsnp_tbi && params.dbsnp && ((params.step == "mapping" || params.step == "markduplicates" || params.step == "prepare_recalibration") || params.tools && (params.tools.split(',').contains('controlfreec') || params.tools.split(',').contains('haplotypecaller') || params.tools.split(',').contains('sentieon_haplotyper') || params.tools.split(',').contains('mutect2'))) } + ext.when = { !params.dbsnp_tbi && params.dbsnp && ((params.step == "mapping" || params.step == "markduplicates" || params.step == "prepare_recalibration") || params.tools && (checkInParam(params.tools, 'controlfreec') || checkInParam(params.tools, 'haplotypecaller') || checkInParam(params.tools, 'sentieon_haplotyper') || checkInParam(params.tools, 'mutect2'))) } publishDir = [ enabled: (params.save_reference || params.build_only_index), mode: params.publish_dir_mode, @@ -86,7 +86,7 @@ process { } withName: 'TABIX_GERMLINE_RESOURCE' { - ext.when = { !params.germline_resource_tbi && params.germline_resource && params.tools && params.tools.split(',').contains('mutect2') } + ext.when = { !params.germline_resource_tbi && params.germline_resource && checkInParam(params.tools, 'mutect2') } publishDir = [ enabled: (params.save_reference || params.build_only_index), mode: params.publish_dir_mode, @@ -96,7 +96,7 @@ process { } withName: 'TABIX_KNOWN_INDELS' { - ext.when = { !params.known_indels_tbi && params.known_indels && (params.step == 'mapping' || params.step == "markduplicates" || params.step == 'prepare_recalibration' || (params.tools && (params.tools.split(',').contains('haplotypecaller') || params.tools.split(',').contains('sentieon_haplotyper'))) ) } + ext.when = { !params.known_indels_tbi && params.known_indels && (params.step == 'mapping' || params.step == "markduplicates" || params.step == 'prepare_recalibration' || (params.tools && (checkInParam(params.tools, 'haplotypecaller') || checkInParam(params.tools, 'sentieon_haplotyper'))) ) } publishDir = [ enabled: (params.save_reference || params.build_only_index), mode: params.publish_dir_mode, @@ -106,7 +106,7 @@ process { } withName: 'TABIX_KNOWN_SNPS' { - ext.when = { !params.known_snps_tbi && params.known_snps && (params.step == 'mapping' || params.step == "markduplicates" || params.step == 'prepare_recalibration' || (params.tools && (params.tools.split(',').contains('haplotypecaller') || params.tools.split(',').contains('sentieon_haplotyper'))) ) } + ext.when = { !params.known_snps_tbi && params.known_snps && (params.step == 'mapping' || params.step == "markduplicates" || params.step == 'prepare_recalibration' || (params.tools && (checkInParam(params.tools, 'haplotypecaller') || checkInParam(params.tools, 'sentieon_haplotyper'))) ) } publishDir = [ enabled: (params.save_reference || params.build_only_index), mode: params.publish_dir_mode, @@ -116,7 +116,7 @@ process { } withName: 'TABIX_PON' { - ext.when = { !params.pon_tbi && params.pon && params.tools && params.tools.split(',').contains('mutect2') } + ext.when = { !params.pon_tbi && params.pon && checkInParam(params.tools, 'mutect2') } publishDir = [ enabled: (params.save_reference || params.build_only_index), mode: params.publish_dir_mode, @@ -126,13 +126,13 @@ process { } withName: 'UNZIP_ALLELES|UNZIP_LOCI|UNZIP_GC|UNZIP_RT' { - ext.when = { params.tools && params.tools.split(',').contains('ascat')} + ext.when = { checkInParam(params.tools, 'ascat')} publishDir = [ enabled: false ] } withName: 'UNTAR_CHR_DIR' { - ext.when = { params.tools && params.tools.split(',').contains('controlfreec')} + ext.when = { checkInParam(params.tools, 'controlfreec')} } } diff --git a/conf/modules/recalibrate.config b/conf/modules/recalibrate.config index 9602e33caf..f98166cc2d 100644 --- a/conf/modules/recalibrate.config +++ b/conf/modules/recalibrate.config @@ -26,7 +26,7 @@ process { ] } - if ((params.step == 'mapping' || params.step == 'markduplicates'|| params.step == 'prepare_recalibration'|| params.step == 'recalibrate') && (!(params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator')))) { + if ((params.step == 'mapping' || params.step == 'markduplicates'|| params.step == 'prepare_recalibration'|| params.step == 'recalibrate') && (!(checkInParam(params.skip_tools, 'baserecalibrator')))) { withName: 'NFCORE_SAREK:SAREK:(BAM_APPLYBQSR|BAM_APPLYBQSR_SPARK):CRAM_MERGE_INDEX_SAMTOOLS:MERGE_CRAM' { ext.prefix = { "${meta.id}.recal" } ext.when = { meta.num_intervals > 1 } diff --git a/conf/modules/sentieon_dedup.config b/conf/modules/sentieon_dedup.config index 1bbf81b25a..74f67f6ae4 100644 --- a/conf/modules/sentieon_dedup.config +++ b/conf/modules/sentieon_dedup.config @@ -17,7 +17,7 @@ process { withName: 'SENTIEON_DEDUP' { ext.prefix = { "${meta.id}.dedup" } - ext.when = { params.tools && params.tools.split(',').contains('sentieon_dedup') } + ext.when = { checkInParam(params.tools, 'sentieon_dedup') } publishDir = [ [ enabled: !params.save_output_as_bam, @@ -29,14 +29,14 @@ process { mode: params.publish_dir_mode, path: { "${params.outdir}/reports/" }, pattern: "*{metrics,metrics.multiqc.tsv}", - saveAs: { !(params.skip_tools && params.skip_tools.split(',').contains('sentieon_dedup_report')) ? "sentieon_dedup/${meta.id}/${it}" : null} + saveAs: { !(checkInParam(params.skip_tools, 'sentieon_dedup_report')) ? "sentieon_dedup/${meta.id}/${it}" : null} ] ] } - if (params.tools && params.tools.contains('sentieon_dedup')) { + if (checkInParam(params.tools, 'sentieon_dedup')) { withName: 'NFCORE_SAREK:SAREK:BAM_SENTIEON_DEDUP:CRAM_QC_MOSDEPTH_SAMTOOLS:SAMTOOLS_STATS' { - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) } + ext.when = { !(checkInParam(params.skip_tools, 'samtools')) } ext.prefix = { "${meta.id}.dedup.cram" } publishDir = [ mode: params.publish_dir_mode, diff --git a/conf/modules/sentieon_haplotyper.config b/conf/modules/sentieon_haplotyper.config index bbcdba8c22..5935b7e418 100644 --- a/conf/modules/sentieon_haplotyper.config +++ b/conf/modules/sentieon_haplotyper.config @@ -17,7 +17,7 @@ process { withName: 'SENTIEON_HAPLOTYPER' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.haplotyper" : "${meta.id}.haplotyper.${intervals.simpleName}" } - ext.when = { params.tools && params.tools.split(',').contains('sentieon_haplotyper') } + ext.when = { checkInParam(params.tools, 'sentieon_haplotyper') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/"}, @@ -44,7 +44,7 @@ process { ] } - if (params.tools && params.tools.contains('sentieon_haplotyper')) { + if (checkInParam(params.tools, 'sentieon_haplotyper')) { withName: '.*FILTERVARIANTTRANCHES' { ext.prefix = {"${meta.id}.haplotyper"} ext.args = { "--info-key CNN_1D" } diff --git a/conf/modules/sentieon_joint_germline.config b/conf/modules/sentieon_joint_germline.config index e4f5d1f73f..97cf211d27 100644 --- a/conf/modules/sentieon_joint_germline.config +++ b/conf/modules/sentieon_joint_germline.config @@ -23,7 +23,7 @@ process { ] } - if (params.tools && params.tools.contains('sentieon_haplotyper') && params.joint_germline) { + if (checkInParam(params.tools, 'sentieon_haplotyper') && params.joint_germline) { withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_JOINT_CALLING_GERMLINE_SENTIEON:BCFTOOLS_SORT' { ext.prefix = { vcf.baseName - ".vcf" + ".sort" } publishDir = [ diff --git a/conf/modules/strelka.config b/conf/modules/strelka.config index e4fb6663db..eb80748535 100644 --- a/conf/modules/strelka.config +++ b/conf/modules/strelka.config @@ -18,7 +18,7 @@ process { withName: 'STRELKA_.*' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.strelka" : "${meta.id}.strelka.${target_bed.simpleName}" } ext.args = { params.wes ? "--exome" : "" } - ext.when = { params.tools && params.tools.split(',').contains('strelka') } + ext.when = { checkInParam(params.tools, 'strelka') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/" }, diff --git a/conf/modules/tiddit.config b/conf/modules/tiddit.config index 3ed371927c..0ca1fbbef6 100644 --- a/conf/modules/tiddit.config +++ b/conf/modules/tiddit.config @@ -18,7 +18,7 @@ process { withName: 'TIDDIT_SV' { ext.args = { bwa_index ? "" : "--skip_assembly" } ext.prefix = { "${meta.id}.tiddit" } - ext.when = { params.tools && params.tools.split(',').contains('tiddit') } + ext.when = { checkInParam(params.tools, 'tiddit') } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/tiddit/${meta.id}/" }, @@ -36,7 +36,7 @@ process { } // PAIR_VARIANT_CALLING - if (params.tools && params.tools.split(',').contains('tiddit')) { + if (checkInParam(params.tools, 'tiddit')) { withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_SOMATIC_TIDDIT:TIDDIT_NORMAL:TABIX_BGZIP_TIDDIT_SV' { ext.prefix = {"${meta.id}.tiddit.normal"} } diff --git a/main.nf b/main.nf index 99ea7db553..67c7eeca2c 100644 --- a/main.nf +++ b/main.nf @@ -101,6 +101,8 @@ WorkflowMain.initialise(workflow, params, log) include { SAREK } from './workflows/sarek' // WORKFLOW: Run main nf-core/sarek analysis pipeline +include { checkInParam } from "${projectDir}/checkInParam" + workflow NFCORE_SAREK { SAREK () } diff --git a/nextflow.config b/nextflow.config index 062787ad85..8bcf544801 100644 --- a/nextflow.config +++ b/nextflow.config @@ -382,6 +382,26 @@ includeConfig 'conf/modules/post_variant_calling.config' //annotate includeConfig 'conf/modules/annotate.config' +// Check the parameters tools or skip_tools, then compare it against the provided tool +// Returns true/false based on whether 'tool' is found in 'parameter' +def checkInParam(parameter, checkValue) { + if (!parameter){ + false + } else { + def tokenized_parameter = parameter.tokenize(',') + switch (checkValue) { + // If checkValue is a list check if any appear in tokenized parameter + case checkValue instanceof List: + checkValue.any{ it.toLowerCase() in parameter.tokenize(',') } + // If checkValue is a string check it appears in parameter + case checkValue instanceof String: + checkValue.toLowerCase() in parameter.tokenize(',') + default: + false + } + } +} + // Function to ensure that resource requirements don't go beyond // a maximum limit def check_max(obj, type) { diff --git a/nextflow_schema.json b/nextflow_schema.json index 4db215cae8..cc65b6390d 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -107,14 +107,14 @@ "fa_icon": "fas fa-toolbox", "description": "Tools to use for duplicate marking, variant calling and/or for annotation.", "help_text": "Multiple tools separated with commas.\n\n**Variant Calling:**\n\nGermline variant calling can currently be performed with the following variant callers:\n- SNPs/Indels: DeepVariant, FreeBayes, GATK HaplotypeCaller, mpileup, Sentieon Haplotyper, Strelka\n- Structural Variants: Manta, TIDDIT\n- Copy-number: CNVKit\n\nTumor-only somatic variant calling can currently be performed with the following variant callers:\n- SNPs/Indels: FreeBayes, mpileup, Mutect2, Strelka\n- Structural Variants: Manta, TIDDIT\n- Copy-number: CNVKit, ControlFREEC\n\nSomatic variant calling can currently only be performed with the following variant callers:\n- SNPs/Indels: FreeBayes, Mutect2, Strelka2\n- Structural variants: Manta, TIDDIT\n- Copy-Number: ASCAT, CNVKit, Control-FREEC\n- Microsatellite Instability: MSIsensorpro\n\n> **NB** Mutect2 for somatic variant calling cannot be combined with `--no_intervals`\n\n**Annotation:**\n \n- snpEff, VEP, merge (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 when starting from `--step annotate`.", - "pattern": "^((ascat|cnvkit|controlfreec|deepvariant|freebayes|haplotypecaller|sentieon_haplotyper|manta|merge|mpileup|msisensorpro|mutect2|sentieon_dedup|snpeff|strelka|tiddit|vep)?,?)*(? **NB** `--skip_tools baserecalibrator_report` is actually just not saving the reports.\n> **NB** `--skip_tools markduplicates_report` does not skip `MarkDuplicates` but prevent the collection of duplicate metrics that slows down performance.", - "pattern": "^((baserecalibrator|baserecalibrator_report|bcftools|documentation|fastqc|haplotypecaller_filter|haplotyper_filter|markduplicates|markduplicates_report|mosdepth|multiqc|samtools|vcftools|versions)?,?)*(? [ meta, [], cram ] }, @@ -82,7 +84,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // DEEPVARIANT - if (tools.split(',').contains('deepvariant')) { + if (checkInParam(params.tools, 'deepvariant')) { BAM_VARIANT_CALLING_DEEPVARIANT( cram, dict, @@ -96,7 +98,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // FREEBAYES - if (tools.split(',').contains('freebayes')) { + if (checkInParam(params.tools, 'freebayes')) { // Input channel is remapped to match input of module/subworkflow BAM_VARIANT_CALLING_FREEBAYES( // Remap channel to match module/subworkflow @@ -112,7 +114,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // HAPLOTYPECALLER - if (tools.split(',').contains('haplotypecaller')) { + if (checkInParam(params.tools, 'haplotypecaller')) { BAM_VARIANT_CALLING_HAPLOTYPECALLER( cram, fasta, @@ -168,7 +170,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // MANTA - if (tools.split(',').contains('manta')) { + if (checkInParam(params.tools, 'manta')) { BAM_VARIANT_CALLING_GERMLINE_MANTA ( cram, fasta, @@ -181,7 +183,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // SENTIEON HAPLOTYPER - if (tools.split(',').contains('sentieon_haplotyper')) { + if (checkInParam(params.tools, 'sentieon_haplotyper')) { BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER( cram, fasta, @@ -241,7 +243,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // STRELKA - if (tools.split(',').contains('strelka')) { + if (checkInParam(params.tools, 'strelka')) { BAM_VARIANT_CALLING_SINGLE_STRELKA( cram, dict, @@ -255,7 +257,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { } // TIDDIT - if (tools.split(',').contains('tiddit')) { + if (checkInParam(params.tools, 'tiddit')) { BAM_VARIANT_CALLING_SINGLE_TIDDIT( cram, // Remap channel to match module/subworkflow diff --git a/subworkflows/local/bam_variant_calling_germline_manta/main.nf b/subworkflows/local/bam_variant_calling_germline_manta/main.nf index 36cb957d6f..094200fdbf 100644 --- a/subworkflows/local/bam_variant_calling_germline_manta/main.nf +++ b/subworkflows/local/bam_variant_calling_germline_manta/main.nf @@ -7,6 +7,8 @@ include { MANTA_GERMLINE } from '../../../modules/nf-core/manta/germline/main' // Seems to be the consensus on upstream modules implementation too +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_GERMLINE_MANTA { take: cram // channel: [mandatory] [ meta, cram, crai ] diff --git a/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf b/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf index 1dbef4c613..4ff2d6fc10 100644 --- a/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf +++ b/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf @@ -8,6 +8,8 @@ include { BAM_MERGE_INDEX_SAMTOOLS } from '../bam_mer include { GATK4_HAPLOTYPECALLER } from '../../../modules/nf-core/gatk4/haplotypecaller/main' include { GATK4_MERGEVCFS as MERGE_HAPLOTYPECALLER } from '../../../modules/nf-core/gatk4/mergevcfs/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER { take: cram // channel: [mandatory] [ meta, cram, crai, interval.bed ] diff --git a/subworkflows/local/bam_variant_calling_mpileup/main.nf b/subworkflows/local/bam_variant_calling_mpileup/main.nf index 412ba38619..68536bfadf 100644 --- a/subworkflows/local/bam_variant_calling_mpileup/main.nf +++ b/subworkflows/local/bam_variant_calling_mpileup/main.nf @@ -9,6 +9,8 @@ include { BCFTOOLS_MPILEUP } from '../../../modules/nf- include { SAMTOOLS_MPILEUP } from '../../../modules/nf-core/samtools/mpileup/main' include { GATK4_MERGEVCFS as MERGE_BCFTOOLS_MPILEUP } from '../../../modules/nf-core/gatk4/mergevcfs/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_MPILEUP { take: cram // channel: [mandatory] [ meta, cram, crai ] diff --git a/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf b/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf index 370fc9963a..18019c8335 100644 --- a/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf +++ b/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf @@ -8,6 +8,8 @@ include { GATK4_MERGEVCFS as MERGE_SENTIEON_HAPLOTYPER_GVCFS } from ' include { GATK4_MERGEVCFS as MERGE_SENTIEON_HAPLOTYPER_VCFS } from '../../../modules/nf-core/gatk4/mergevcfs/main' include { SENTIEON_HAPLOTYPER } from '../../../modules/nf-core/sentieon/haplotyper/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { take: cram // channel: [mandatory] [ meta, cram, crai, interval.bed ] diff --git a/subworkflows/local/bam_variant_calling_single_strelka/main.nf b/subworkflows/local/bam_variant_calling_single_strelka/main.nf index ab6b3373c3..5a7cf4bdcc 100644 --- a/subworkflows/local/bam_variant_calling_single_strelka/main.nf +++ b/subworkflows/local/bam_variant_calling_single_strelka/main.nf @@ -8,6 +8,8 @@ include { GATK4_MERGEVCFS as MERGE_STRELKA } from '../../../modules/nf-c include { GATK4_MERGEVCFS as MERGE_STRELKA_GENOME } from '../../../modules/nf-core/gatk4/mergevcfs/main' include { STRELKA_GERMLINE as STRELKA_SINGLE } from '../../../modules/nf-core/strelka/germline/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SINGLE_STRELKA { take: cram // channel: [mandatory] [ meta, cram, crai ] diff --git a/subworkflows/local/bam_variant_calling_single_tiddit/main.nf b/subworkflows/local/bam_variant_calling_single_tiddit/main.nf index 356ce7c2fa..555d11e024 100644 --- a/subworkflows/local/bam_variant_calling_single_tiddit/main.nf +++ b/subworkflows/local/bam_variant_calling_single_tiddit/main.nf @@ -7,6 +7,8 @@ include { TABIX_BGZIPTABIX as TABIX_BGZIP_TIDDIT_SV } from '../../../modules/nf-core/tabix/bgziptabix/main' include { TIDDIT_SV } from '../../../modules/nf-core/tiddit/sv/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SINGLE_TIDDIT { take: cram diff --git a/subworkflows/local/bam_variant_calling_somatic_all/main.nf b/subworkflows/local/bam_variant_calling_somatic_all/main.nf index bb98e6c6a1..c9ff437a2f 100644 --- a/subworkflows/local/bam_variant_calling_somatic_all/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_all/main.nf @@ -14,6 +14,8 @@ include { BAM_VARIANT_CALLING_SOMATIC_STRELKA } from '../bam_variant_c include { BAM_VARIANT_CALLING_SOMATIC_TIDDIT } from '../bam_variant_calling_somatic_tiddit/main' include { MSISENSORPRO_MSISOMATIC } from '../../../modules/nf-core/msisensorpro/msisomatic/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_ALL { take: tools // Mandatory, list of tools to apply @@ -53,7 +55,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { vcf_mutect2 = Channel.empty() vcf_tiddit = Channel.empty() - if (tools.split(',').contains('ascat')) { + if (checkInParam(params.tools, 'ascat')) { BAM_VARIANT_CALLING_SOMATIC_ASCAT( cram, allele_files, @@ -68,7 +70,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // CONTROLFREEC - if (tools.split(',').contains('controlfreec')) { + if (checkInParam(params.tools, 'controlfreec')) { // Remap channels to match module/subworkflow cram_normal = cram.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai -> [ meta, normal_cram, normal_crai ] } cram_tumor = cram.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai -> [ meta, tumor_cram, tumor_crai ] } @@ -111,7 +113,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // CNVKIT - if (tools.split(',').contains('cnvkit')) { + if (checkInParam(params.tools, 'cnvkit')) { BAM_VARIANT_CALLING_CNVKIT( // Remap channel to match module/subworkflow cram.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai -> [ meta, tumor_cram, normal_cram ] }, @@ -125,7 +127,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // FREEBAYES - if (tools.split(',').contains('freebayes')) { + if (checkInParam(params.tools, 'freebayes')) { BAM_VARIANT_CALLING_FREEBAYES( cram, dict, @@ -139,7 +141,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // MANTA - if (tools.split(',').contains('manta')) { + if (checkInParam(params.tools, 'manta')) { BAM_VARIANT_CALLING_SOMATIC_MANTA( cram, fasta, @@ -152,9 +154,9 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // STRELKA - if (tools.split(',').contains('strelka')) { + if (checkInParam(params.tools, 'strelka')) { // Remap channel to match module/subworkflow - cram_strelka = (tools.split(',').contains('manta')) ? + cram_strelka = (checkInParam(params.tools, 'manta')) ? cram.join(BAM_VARIANT_CALLING_SOMATIC_MANTA.out.candidate_small_indels_vcf, failOnDuplicate: true, failOnMismatch: true).join(BAM_VARIANT_CALLING_SOMATIC_MANTA.out.candidate_small_indels_vcf_tbi, failOnDuplicate: true, failOnMismatch: true) : cram.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai -> [ meta, normal_cram, normal_crai, tumor_cram, tumor_crai, [], [] ] } @@ -172,7 +174,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // MSISENSOR - if (tools.split(',').contains('msisensorpro')) { + if (checkInParam(params.tools, 'msisensorpro')) { MSISENSORPRO_MSISOMATIC(cram.combine(intervals_bed_combined), fasta, msisensorpro_scan) versions = versions.mix(MSISENSORPRO_MSISOMATIC.out.versions) @@ -180,7 +182,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // MUTECT2 - if (tools.split(',').contains('mutect2')) { + if (checkInParam(params.tools, 'mutect2')) { BAM_VARIANT_CALLING_SOMATIC_MUTECT2( // Remap channel to match module/subworkflow // Adjust meta.map to simplify joining channels @@ -208,7 +210,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { } // TIDDIT - if (tools.split(',').contains('tiddit')) { + if (checkInParam(params.tools, 'tiddit')) { BAM_VARIANT_CALLING_SOMATIC_TIDDIT( // Remap channel to match module/subworkflow cram.map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai -> [ meta, normal_cram, normal_crai ] }, diff --git a/subworkflows/local/bam_variant_calling_somatic_ascat/main.nf b/subworkflows/local/bam_variant_calling_somatic_ascat/main.nf index 64f45508ab..fb440418d0 100644 --- a/subworkflows/local/bam_variant_calling_somatic_ascat/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_ascat/main.nf @@ -6,6 +6,8 @@ include { ASCAT } from '../../../modules/nf-core/ascat/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_ASCAT { take: diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index a2e7e17cff..c712c1a540 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -10,6 +10,8 @@ include { CONTROLFREEC_FREEC2BED as FREEC2BED } from '../../. include { CONTROLFREEC_FREEC2CIRCOS as FREEC2CIRCOS } from '../../../modules/nf-core/controlfreec/freec2circos/main' include { CONTROLFREEC_MAKEGRAPH as MAKEGRAPH } from '../../../modules/nf-core/controlfreec/makegraph/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { take: controlfreec_input // channel: [mandatory] [meta, pileup_normal, pileup_tumor, [], [], [], []] diff --git a/subworkflows/local/bam_variant_calling_somatic_manta/main.nf b/subworkflows/local/bam_variant_calling_somatic_manta/main.nf index 7eb5e6687d..e53d5210b9 100644 --- a/subworkflows/local/bam_variant_calling_somatic_manta/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_manta/main.nf @@ -6,6 +6,8 @@ include { MANTA_SOMATIC } from '../../../modules/nf-core/manta/somatic/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_MANTA { take: cram // channel: [mandatory] [ meta, cram1, crai1, cram2, crai2 ] diff --git a/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf b/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf index 8de17d6a4d..1d00b1c531 100644 --- a/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf @@ -14,6 +14,8 @@ include { GATK4_MERGEMUTECTSTATS as MERGEMUTECTSTATS } from include { GATK4_MERGEVCFS as MERGE_MUTECT2 } from '../../../modules/nf-core/gatk4/mergevcfs/main' include { GATK4_MUTECT2 as MUTECT2_PAIRED } from '../../../modules/nf-core/gatk4/mutect2/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_MUTECT2 { take: input // channel: [ meta, [ input ], [ input_index ] ] diff --git a/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf b/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf index 02c729f93e..53cfcd4be1 100644 --- a/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf @@ -8,6 +8,8 @@ include { GATK4_MERGEVCFS as MERGE_STRELKA_INDELS } from '../../../modules/nf-co include { GATK4_MERGEVCFS as MERGE_STRELKA_SNVS } from '../../../modules/nf-core/gatk4/mergevcfs/main' include { STRELKA_SOMATIC } from '../../../modules/nf-core/strelka/somatic/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_STRELKA { take: cram // channel: [mandatory] [ meta, normal_cram, normal_crai, tumor_cram, tumor_crai, manta_vcf, manta_tbi ] manta* are optional diff --git a/subworkflows/local/bam_variant_calling_somatic_tiddit/main.nf b/subworkflows/local/bam_variant_calling_somatic_tiddit/main.nf index 259520fce1..46a57180b7 100644 --- a/subworkflows/local/bam_variant_calling_somatic_tiddit/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_tiddit/main.nf @@ -8,6 +8,8 @@ include { BAM_VARIANT_CALLING_SINGLE_TIDDIT as TIDDIT_NORMAL } from '../bam_vari include { BAM_VARIANT_CALLING_SINGLE_TIDDIT as TIDDIT_TUMOR } from '../bam_variant_calling_single_tiddit/main.nf' include { SVDB_MERGE } from '../../../modules/nf-core/svdb/merge/main.nf' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_SOMATIC_TIDDIT { take: cram_normal diff --git a/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf index 738350713e..662acb6cff 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf @@ -12,6 +12,8 @@ include { BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC } from '../bam_variant_cal include { BAM_VARIANT_CALLING_TUMOR_ONLY_MANTA } from '../bam_variant_calling_tumor_only_manta/main' include { BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 } from '../bam_variant_calling_tumor_only_mutect2/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { take: tools // Mandatory, list of tools to apply @@ -48,7 +50,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { vcf_tiddit = Channel.empty() // MPILEUP - if (tools.split(',').contains('mpileup') || tools.split(',').contains('controlfreec')) { + if (checkInParam(params.tools, 'mpileup') || checkInParam(params.tools, 'controlfreec')) { BAM_VARIANT_CALLING_MPILEUP( cram, dict, @@ -60,7 +62,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // CONTROLFREEC (depends on MPILEUP) - if (tools.split(',').contains('controlfreec')) { + if (checkInParam(params.tools, 'controlfreec')) { length_file = cf_chrom_len ?: fasta_fai BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC( @@ -79,7 +81,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // CNVKIT - if (tools.split(',').contains('cnvkit')) { + if (checkInParam(params.tools, 'cnvkit')) { BAM_VARIANT_CALLING_CNVKIT ( // Remap channel to match module/subworkflow cram.map{ meta, cram, crai -> [ meta, cram, [] ] }, @@ -93,7 +95,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // FREEBAYES - if (tools.split(',').contains('freebayes')) { + if (checkInParam(params.tools, 'freebayes')) { BAM_VARIANT_CALLING_FREEBAYES( // Remap channel to match module/subworkflow cram.map{ meta, cram, crai -> [ meta, cram, crai, [], [] ] }, @@ -108,7 +110,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // MUTECT2 - if (tools.split(',').contains('mutect2')) { + if (checkInParam(params.tools, 'mutect2')) { BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2( // Adjust meta.map to simplify joining channels // joint_mutect2 mode needs different meta.map than regular mode @@ -135,7 +137,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // MANTA - if (tools.split(',').contains('manta')) { + if (checkInParam(params.tools, 'manta')) { BAM_VARIANT_CALLING_TUMOR_ONLY_MANTA( cram, // Remap channel to match module/subworkflow @@ -151,7 +153,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // STRELKA - if (tools.split(',').contains('strelka')) { + if (checkInParam(params.tools, 'strelka')) { BAM_VARIANT_CALLING_SINGLE_STRELKA( cram, dict, @@ -165,7 +167,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { } // TIDDIT - if (tools.split(',').contains('tiddit')) { + if (checkInParam(params.tools, 'tiddit')) { BAM_VARIANT_CALLING_SINGLE_TIDDIT( cram, // Remap channel to match module/subworkflow diff --git a/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf index 993faf127c..c0efa5ec74 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf @@ -10,6 +10,8 @@ include { CONTROLFREEC_FREEC2BED as FREEC2BED } from '../../. include { CONTROLFREEC_FREEC2CIRCOS as FREEC2CIRCOS } from '../../../modules/nf-core/controlfreec/freec2circos/main' include { CONTROLFREEC_MAKEGRAPH as MAKEGRAPH } from '../../../modules/nf-core/controlfreec/makegraph/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC { take: controlfreec_input // channel: [mandatory] [meta, [], pileup_tumor, [], [], [], []] diff --git a/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf index 10045c7356..89189f79a8 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf @@ -7,6 +7,8 @@ include { MANTA_TUMORONLY } from '../../../modules/nf-core/manta/tumoronly/main' // Seems to be the consensus on upstream modules implementation too +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MANTA { take: cram // channel: [mandatory] [ meta, cram, crai ] diff --git a/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf index 9e2c6d0bc5..85c9892c5d 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf @@ -13,6 +13,8 @@ include { GATK4_LEARNREADORIENTATIONMODEL as LEARNREADORIENTATIONMODEL } from '. include { GATK4_MERGEMUTECTSTATS as MERGEMUTECTSTATS } from '../../../modules/nf-core/gatk4/mergemutectstats/main' include { GATK4_MUTECT2 as MUTECT2 } from '../../../modules/nf-core/gatk4/mutect2/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 { take: input // channel: [ meta, [ input ], [ input_index ] ] diff --git a/subworkflows/local/channel_align_create_csv/main.nf b/subworkflows/local/channel_align_create_csv/main.nf index 692ffa0ef4..a45ff2b165 100644 --- a/subworkflows/local/channel_align_create_csv/main.nf +++ b/subworkflows/local/channel_align_create_csv/main.nf @@ -2,6 +2,8 @@ // CHANNEL_ALIGN_CREATE_CSV // +include { checkInParam } from "${projectDir}/checkInParam" + workflow CHANNEL_ALIGN_CREATE_CSV { take: bam_indexed // channel: [mandatory] meta, bam, bai diff --git a/subworkflows/local/channel_applybqsr_create_csv/main.nf b/subworkflows/local/channel_applybqsr_create_csv/main.nf index 2396574ced..c532569905 100644 --- a/subworkflows/local/channel_applybqsr_create_csv/main.nf +++ b/subworkflows/local/channel_applybqsr_create_csv/main.nf @@ -2,6 +2,8 @@ // CHANNEL_APPLYBQSR_CREATE_CSV // +include { checkInParam } from "${projectDir}/checkInParam" + workflow CHANNEL_APPLYBQSR_CREATE_CSV { take: cram_recalibrated_index // channel: [mandatory] meta, cram, crai diff --git a/subworkflows/local/channel_baserecalibrator_create_csv/main.nf b/subworkflows/local/channel_baserecalibrator_create_csv/main.nf index 8bbfacc85c..1b5938936e 100644 --- a/subworkflows/local/channel_baserecalibrator_create_csv/main.nf +++ b/subworkflows/local/channel_baserecalibrator_create_csv/main.nf @@ -2,6 +2,8 @@ // CHANNEL_BASERECALIBRATOR_CREATE_CSV // +include { checkInParam } from "${projectDir}/checkInParam" + workflow CHANNEL_BASERECALIBRATOR_CREATE_CSV { take: cram_table_bqsr // channel: [mandatory] meta, cram, crai, table @@ -12,7 +14,7 @@ workflow CHANNEL_BASERECALIBRATOR_CREATE_CSV { main: // Creating csv files to restart from this step - if ( tools && tools.split(',').contains('sentieon_dedup') ) { + if ( tools && checkInParam(params.tools, 'sentieon_dedup') ) { cram_table_bqsr.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, cram, crai, table -> patient = meta.patient @@ -30,7 +32,7 @@ workflow CHANNEL_BASERECALIBRATOR_CREATE_CSV { ["markduplicates.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${cram},${crai},${table}\n"] } - } else if (!(skip_tools && (skip_tools.split(',').contains('markduplicates')))) { + } else if ( !(skip_tools && checkInParam(params.skip_tools, 'markduplicates')) ) { cram_table_bqsr.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, cram, crai, table -> patient = meta.patient diff --git a/subworkflows/local/channel_markduplicates_create_csv/main.nf b/subworkflows/local/channel_markduplicates_create_csv/main.nf index 06e9a9826b..e05623b889 100644 --- a/subworkflows/local/channel_markduplicates_create_csv/main.nf +++ b/subworkflows/local/channel_markduplicates_create_csv/main.nf @@ -2,6 +2,8 @@ // CHANNEL_MARKDUPLICATES_CREATE_CSV // +include { checkInParam } from "${projectDir}/checkInParam" + workflow CHANNEL_MARKDUPLICATES_CREATE_CSV { take: cram_markduplicates // channel: [mandatory] meta, cram, crai diff --git a/subworkflows/local/channel_variant_calling_create_csv/main.nf b/subworkflows/local/channel_variant_calling_create_csv/main.nf index b8de11bf8b..c925302a98 100644 --- a/subworkflows/local/channel_variant_calling_create_csv/main.nf +++ b/subworkflows/local/channel_variant_calling_create_csv/main.nf @@ -2,6 +2,8 @@ // CHANNEL_VARIANT_CALLING_CREATE_CSV // +include { checkInParam } from "${projectDir}/checkInParam" + workflow CHANNEL_VARIANT_CALLING_CREATE_CSV { take: vcf_to_annotate // channel: [mandatory] meta, vcf diff --git a/subworkflows/local/cram_merge_index_samtools/main.nf b/subworkflows/local/cram_merge_index_samtools/main.nf index b808c8edc6..407aeed82c 100644 --- a/subworkflows/local/cram_merge_index_samtools/main.nf +++ b/subworkflows/local/cram_merge_index_samtools/main.nf @@ -7,6 +7,8 @@ include { SAMTOOLS_INDEX as INDEX_CRAM } from '../../../modules/nf-core/samtools/index/main' include { SAMTOOLS_MERGE as MERGE_CRAM } from '../../../modules/nf-core/samtools/merge/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow CRAM_MERGE_INDEX_SAMTOOLS { take: cram // channel: [mandatory] meta, cram diff --git a/subworkflows/local/cram_qc_mosdepth_samtools/main.nf b/subworkflows/local/cram_qc_mosdepth_samtools/main.nf index fd070a6817..05ddc5e7a2 100644 --- a/subworkflows/local/cram_qc_mosdepth_samtools/main.nf +++ b/subworkflows/local/cram_qc_mosdepth_samtools/main.nf @@ -7,6 +7,8 @@ include { SAMTOOLS_STATS } from '../../../modules/nf-core/samtools/stats/main' include { MOSDEPTH } from '../../../modules/nf-core/mosdepth/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow CRAM_QC_MOSDEPTH_SAMTOOLS { take: cram // channel: [mandatory] [ meta, cram, crai ] diff --git a/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf b/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf index c61ac7f4cc..f8c653b8fd 100644 --- a/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf +++ b/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf @@ -9,6 +9,8 @@ include { BWA_MEM as BWAMEM1_MEM } from '../../../modules/nf-core/bwa/mem/main' include { DRAGMAP_ALIGN } from '../../../modules/nf-core/dragmap/align/main' include { SENTIEON_BWAMEM } from '../../../modules/nf-core/sentieon/bwamem/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow FASTQ_ALIGN_BWAMEM_MEM2_DRAGMAP_SENTIEON { take: reads // channel: [mandatory] meta, reads diff --git a/subworkflows/local/fastq_create_umi_consensus_fgbio/main.nf b/subworkflows/local/fastq_create_umi_consensus_fgbio/main.nf index c237e64014..ba88b54700 100644 --- a/subworkflows/local/fastq_create_umi_consensus_fgbio/main.nf +++ b/subworkflows/local/fastq_create_umi_consensus_fgbio/main.nf @@ -13,6 +13,8 @@ include { FASTQ_ALIGN_BWAMEM_MEM2_DRAGMAP_SENTIEON as ALIGN_UMI } from '. include { SAMBLASTER } from '../../../modules/nf-core/samblaster/main' include { SAMTOOLS_BAM2FQ as BAM2FASTQ } from '../../../modules/nf-core/samtools/bam2fq/main.nf' +include { checkInParam } from "${projectDir}/checkInParam" + workflow FASTQ_CREATE_UMI_CONSENSUS_FGBIO { take: reads // channel: [mandatory] [ val(meta), [ reads ] ] diff --git a/subworkflows/local/post_variantcalling/main.nf b/subworkflows/local/post_variantcalling/main.nf index bf23ff13d4..88e2b15cb0 100644 --- a/subworkflows/local/post_variantcalling/main.nf +++ b/subworkflows/local/post_variantcalling/main.nf @@ -4,6 +4,8 @@ include { CONCATENATE_GERMLINE_VCFS } from '../vcf_concatenate_germline/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow POST_VARIANTCALLING { take: diff --git a/subworkflows/local/prepare_cache/main.nf b/subworkflows/local/prepare_cache/main.nf index 601a453720..625ed5da28 100644 --- a/subworkflows/local/prepare_cache/main.nf +++ b/subworkflows/local/prepare_cache/main.nf @@ -11,6 +11,8 @@ include { ENSEMBLVEP_DOWNLOAD } from '../../../modules/nf-core/ensemblvep/download/main' include { SNPEFF_DOWNLOAD } from '../../../modules/nf-core/snpeff/download/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow PREPARE_CACHE { take: ensemblvep_info diff --git a/subworkflows/local/prepare_genome/main.nf b/subworkflows/local/prepare_genome/main.nf index 4945282d98..bf86f637b4 100644 --- a/subworkflows/local/prepare_genome/main.nf +++ b/subworkflows/local/prepare_genome/main.nf @@ -25,6 +25,8 @@ include { UNZIP as UNZIP_GC } from '../../../modules/nf-cor include { UNZIP as UNZIP_LOCI } from '../../../modules/nf-core/unzip/main' include { UNZIP as UNZIP_RT } from '../../../modules/nf-core/unzip/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow PREPARE_GENOME { take: ascat_alleles // channel: [optional] ascat allele files diff --git a/subworkflows/local/prepare_intervals/main.nf b/subworkflows/local/prepare_intervals/main.nf index f4079e3e81..afb1b65f8e 100644 --- a/subworkflows/local/prepare_intervals/main.nf +++ b/subworkflows/local/prepare_intervals/main.nf @@ -12,6 +12,8 @@ include { GATK4_INTERVALLISTTOBED } from '../../. include { TABIX_BGZIPTABIX as TABIX_BGZIPTABIX_INTERVAL_SPLIT } from '../../../modules/nf-core/tabix/bgziptabix/main' include { TABIX_BGZIPTABIX as TABIX_BGZIPTABIX_INTERVAL_COMBINED } from '../../../modules/nf-core/tabix/bgziptabix/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow PREPARE_INTERVALS { take: fasta_fai // mandatory [ fasta_fai ] diff --git a/subworkflows/local/prepare_reference_cnvkit/main.nf b/subworkflows/local/prepare_reference_cnvkit/main.nf index 87b943dff1..327ef1be2e 100644 --- a/subworkflows/local/prepare_reference_cnvkit/main.nf +++ b/subworkflows/local/prepare_reference_cnvkit/main.nf @@ -9,6 +9,8 @@ include { CNVKIT_ANTITARGET } from '../../../modules/nf-core/cnvkit/antitarget/main' include { CNVKIT_REFERENCE } from '../../../modules/nf-core/cnvkit/reference/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow PREPARE_REFERENCE_CNVKIT { take: fasta // channel: [mandatory] fasta diff --git a/subworkflows/local/vcf_annotate_all/main.nf b/subworkflows/local/vcf_annotate_all/main.nf index 5b759d8818..321f9c29b6 100644 --- a/subworkflows/local/vcf_annotate_all/main.nf +++ b/subworkflows/local/vcf_annotate_all/main.nf @@ -6,6 +6,8 @@ include { VCF_ANNOTATE_ENSEMBLVEP } from '../../nf-core/vc include { VCF_ANNOTATE_ENSEMBLVEP as VCF_ANNOTATE_MERGE } from '../../nf-core/vcf_annotate_ensemblvep/main' include { VCF_ANNOTATE_SNPEFF } from '../../nf-core/vcf_annotate_snpeff/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow VCF_ANNOTATE_ALL { take: vcf // channel: [ val(meta), vcf ] @@ -26,7 +28,7 @@ workflow VCF_ANNOTATE_ALL { json_ann = Channel.empty() versions = Channel.empty() - if (tools.split(',').contains('merge') || tools.split(',').contains('snpeff')) { + if (checkInParam(params.tools, 'merge') || checkInParam(params.tools, 'snpeff')) { VCF_ANNOTATE_SNPEFF(vcf, snpeff_db, snpeff_cache) reports = reports.mix(VCF_ANNOTATE_SNPEFF.out.reports) @@ -34,7 +36,7 @@ workflow VCF_ANNOTATE_ALL { versions = versions.mix(VCF_ANNOTATE_SNPEFF.out.versions) } - if (tools.split(',').contains('merge')) { + if (checkInParam(params.tools, 'merge')) { vcf_ann_for_merge = VCF_ANNOTATE_SNPEFF.out.vcf_tbi.map{ meta, vcf, tbi -> [ meta, vcf, [] ] } VCF_ANNOTATE_MERGE(vcf_ann_for_merge, fasta, vep_genome, vep_species, vep_cache_version, vep_cache, vep_extra_files) @@ -43,7 +45,7 @@ workflow VCF_ANNOTATE_ALL { versions = versions.mix(VCF_ANNOTATE_MERGE.out.versions) } - if (tools.split(',').contains('vep')) { + if (checkInParam(params.tools, 'vep')) { vcf_for_vep = vcf.map{ meta, vcf -> [ meta, vcf, [] ] } VCF_ANNOTATE_ENSEMBLVEP(vcf_for_vep, fasta, vep_genome, vep_species, vep_cache_version, vep_cache, vep_extra_files) diff --git a/subworkflows/local/vcf_concatenate_germline/main.nf b/subworkflows/local/vcf_concatenate_germline/main.nf index 87f46b22e1..5b37bf55ee 100644 --- a/subworkflows/local/vcf_concatenate_germline/main.nf +++ b/subworkflows/local/vcf_concatenate_germline/main.nf @@ -9,6 +9,8 @@ include { BCFTOOLS_CONCAT as GERMLINE_VCFS_CONCAT } from '../../../m include { BCFTOOLS_SORT as GERMLINE_VCFS_CONCAT_SORT } from '../../../modules/nf-core/bcftools/sort/main' include { TABIX_TABIX as TABIX_GERMLINE_VCFS_CONCAT_SORT } from '../../../modules/nf-core/tabix/tabix/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow CONCATENATE_GERMLINE_VCFS { take: diff --git a/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf b/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf index bcdc34e30d..de6542aa48 100644 --- a/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf +++ b/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf @@ -3,6 +3,8 @@ include { VCFTOOLS as VCFTOOLS_SUMMARY } from '../../../modules/nf-core/vcfto include { VCFTOOLS as VCFTOOLS_TSTV_COUNT } from '../../../modules/nf-core/vcftools/main' include { VCFTOOLS as VCFTOOLS_TSTV_QUAL } from '../../../modules/nf-core/vcftools/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow VCF_QC_BCFTOOLS_VCFTOOLS { take: vcf diff --git a/subworkflows/local/vcf_variant_filtering_gatk/main.nf b/subworkflows/local/vcf_variant_filtering_gatk/main.nf index 1e0cbd210b..92a29bd0d1 100644 --- a/subworkflows/local/vcf_variant_filtering_gatk/main.nf +++ b/subworkflows/local/vcf_variant_filtering_gatk/main.nf @@ -1,6 +1,8 @@ include { GATK4_CNNSCOREVARIANTS as CNNSCOREVARIANTS } from '../../../modules/nf-core/gatk4/cnnscorevariants/main' include { GATK4_FILTERVARIANTTRANCHES as FILTERVARIANTTRANCHES } from '../../../modules/nf-core/gatk4/filtervarianttranches/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow VCF_VARIANT_FILTERING_GATK { take: diff --git a/subworkflows/nf-core/vcf_annotate_ensemblvep/main.nf b/subworkflows/nf-core/vcf_annotate_ensemblvep/main.nf index 291eddc11b..0992089c1c 100644 --- a/subworkflows/nf-core/vcf_annotate_ensemblvep/main.nf +++ b/subworkflows/nf-core/vcf_annotate_ensemblvep/main.nf @@ -5,6 +5,8 @@ include { ENSEMBLVEP_VEP } from '../../../modules/nf-core/ensemblvep/vep/main' include { TABIX_TABIX } from '../../../modules/nf-core/tabix/tabix/main' +include { checkInParam } from "${projectDir}/checkInParam" + workflow VCF_ANNOTATE_ENSEMBLVEP { take: ch_vcf // channel: [ val(meta), path(vcf), [path(custom_file1), path(custom_file2)... (optionnal)]] diff --git a/subworkflows/nf-core/vcf_annotate_snpeff/main.nf b/subworkflows/nf-core/vcf_annotate_snpeff/main.nf index 2a875939de..0a6d9d1272 100644 --- a/subworkflows/nf-core/vcf_annotate_snpeff/main.nf +++ b/subworkflows/nf-core/vcf_annotate_snpeff/main.nf @@ -5,6 +5,8 @@ include { SNPEFF_SNPEFF } from '../../../modules/nf-core/snpeff/snpeff/main.nf' include { TABIX_BGZIPTABIX } from '../../../modules/nf-core/tabix/bgziptabix/main.nf' +include { checkInParam } from "${projectDir}/checkInParam" + workflow VCF_ANNOTATE_SNPEFF { take: ch_vcf // channel: [ val(meta), path(vcf) ] diff --git a/tests/test_freebayes.yml b/tests/test_freebayes.yml index 0808b7ee7d..9591c7f1e3 100644 --- a/tests/test_freebayes.yml +++ b/tests/test_freebayes.yml @@ -393,7 +393,7 @@ - path: results/freebayes should_exist: false - name: Run variant calling on tumor_only sample with freebayes - command: nextflow run main.nf -profile test_cache,tools_tumoronly --tools freebayes --outdir results + command: nextflow run main.nf -profile test_cache,tools_tumoronly --tools Freebayes --outdir results tags: - freebayes - tumor_only diff --git a/tests/test_gatk4_spark.yml b/tests/test_gatk4_spark.yml index e7632b3d92..330464492a 100644 --- a/tests/test_gatk4_spark.yml +++ b/tests/test_gatk4_spark.yml @@ -49,7 +49,7 @@ - path: results/preprocessing/mapped/ should_exist: false - name: Run default pipeline with gatk4_spark & skipping all QC steps - command: nextflow run main.nf -profile test_cache,use_gatk_spark --skip_tools fastqc,markduplicates_report,mosdepth,multiqc,samtools --outdir results + command: nextflow run main.nf -profile test_cache,use_gatk_spark --skip_tools Fastqc,markduplicates_report,mosdepth,multiqc,samtools --outdir results tags: - gatk4_spark - preprocessing diff --git a/tests/test_haplotypecaller.yml b/tests/test_haplotypecaller.yml index 4ec225367b..fa5fffc4b8 100644 --- a/tests/test_haplotypecaller.yml +++ b/tests/test_haplotypecaller.yml @@ -1,5 +1,5 @@ - name: Run variant calling on germline sample with haplotypecaller - command: nextflow run main.nf -profile test_cache,targeted --input ./tests/csv/3.0/mapped_single_bam.csv --tools haplotypecaller --step variant_calling --outdir results + command: nextflow run main.nf -profile test_cache,targeted --input ./tests/csv/3.0/mapped_single_bam.csv --tools Haplotypecaller --step variant_calling --outdir results tags: - germline - haplotypecaller diff --git a/tests/test_haplotypecaller_skip_filter.yml b/tests/test_haplotypecaller_skip_filter.yml index def69fbbf3..c7efab61a6 100644 --- a/tests/test_haplotypecaller_skip_filter.yml +++ b/tests/test_haplotypecaller_skip_filter.yml @@ -39,7 +39,7 @@ - path: results/haplotypecaller should_exist: false - name: Run variant calling on germline sample with haplotypecaller without intervals and skip filter - command: nextflow run main.nf -profile test_cache,targeted --input ./tests/csv/3.0/mapped_single_bam.csv --tools haplotypecaller --step variant_calling --skip_tools haplotypecaller_filter --no_intervals --outdir results + command: nextflow run main.nf -profile test_cache,targeted --input ./tests/csv/3.0/mapped_single_bam.csv --tools haplotypecaller --step variant_calling --skip_tools HaplotypeCaller_filter --no_intervals --outdir results tags: - germline - haplotypecaller_skip_filter diff --git a/tests/test_msisensorpro.yml b/tests/test_msisensorpro.yml index 700187e0a4..b799cc7092 100644 --- a/tests/test_msisensorpro.yml +++ b/tests/test_msisensorpro.yml @@ -1,5 +1,5 @@ - name: Run variant calling on somatic sample with msisensor-pro - command: nextflow run main.nf -profile test_cache,tools_somatic --tools msisensorpro --outdir results + command: nextflow run main.nf -profile test_cache,tools_somatic --tools Msisensorpro --outdir results tags: - msisensorpro - somatic diff --git a/tests/test_prepare_recalibration_from_bam.yml b/tests/test_prepare_recalibration_from_bam.yml index 3d2560058c..147698c246 100644 --- a/tests/test_prepare_recalibration_from_bam.yml +++ b/tests/test_prepare_recalibration_from_bam.yml @@ -37,7 +37,7 @@ - path: results/preprocessing/markduplicates/ should_exist: false - name: Run prepare_recalibration starting from bam and skip baserecalibration - command: nextflow run main.nf -profile test_cache,prepare_recalibration_bam,skip_bqsr --tools strelka --outdir results + command: nextflow run main.nf -profile test_cache,prepare_recalibration_bam,skip_bqsr --tools STRELKA --outdir results tags: - input_bam - prepare_recalibration diff --git a/tests/test_sentieon_haplotyper_skip_filter.yml b/tests/test_sentieon_haplotyper_skip_filter.yml index 8972c06738..7ee3d2d91f 100644 --- a/tests/test_sentieon_haplotyper_skip_filter.yml +++ b/tests/test_sentieon_haplotyper_skip_filter.yml @@ -1,5 +1,5 @@ - name: Run variant calling on germline sample with sentieon haplotyper and skip filter - command: nextflow run main.nf -profile test_cache,targeted --input ./tests/csv/3.0/mapped_single_bam.csv --tools sentieon_haplotyper --step variant_calling --skip_tools haplotyper_filter --outdir results + command: nextflow run main.nf -profile test_cache,targeted --input ./tests/csv/3.0/mapped_single_bam.csv --tools sentieon_Haplotyper --step variant_calling --skip_tools haplotyper_filter --outdir results tags: - germline - sentieon_haplotyper_skip_filter diff --git a/tests/test_skip_all_qc.yml b/tests/test_skip_all_qc.yml index aa8a62ba4c..d1cc28cc46 100644 --- a/tests/test_skip_all_qc.yml +++ b/tests/test_skip_all_qc.yml @@ -1,5 +1,5 @@ - name: Run default pipeline with skipping all QC steps - command: nextflow run main.nf -profile test_cache --skip_tools fastqc,markduplicates_report,mosdepth,multiqc,samtools --outdir results + command: nextflow run main.nf -profile test_cache --skip_tools fastqc,markduplicates_report,MOSDEPTH,MultiQC,samtools --outdir results tags: - default_extended - preprocessing diff --git a/workflows/sarek.nf b/workflows/sarek.nf index 8bb11326b3..7bab981def 100644 --- a/workflows/sarek.nf +++ b/workflows/sarek.nf @@ -4,6 +4,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +include { checkInParam } from "../checkInParam" include { paramsSummaryLog; paramsSummaryMap; fromSamplesheet } from 'plugin/nf-validation' def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs) @@ -181,7 +182,7 @@ if (params.step != 'annotate' && params.tools && !params.build_only_index) { def tools_tumor = ['ascat', 'controlfreec', 'mutect2', 'msisensorpro'] def tools_tumor_asked = [] tools_tumor.each{ tool -> - if (params.tools.split(',').contains(tool)) tools_tumor_asked.add(tool) + if ( checkInParam(params.tools, tool) ) tools_tumor_asked.add(tool) } if (!tools_tumor_asked.isEmpty()) { error('The sample-sheet only contains normal-samples, but the following tools, which were requested with "--tools", expect at least one tumor-sample : ' + tools_tumor_asked.join(", ")) @@ -192,7 +193,7 @@ if (params.step != 'annotate' && params.tools && !params.build_only_index) { def tools_requiring_normal_samples = ['ascat', 'deepvariant', 'haplotypecaller', 'msisensorpro'] def requested_tools_requiring_normal_samples = [] tools_requiring_normal_samples.each{ tool_requiring_normal_samples -> - if (params.tools.split(',').contains(tool_requiring_normal_samples)) requested_tools_requiring_normal_samples.add(tool_requiring_normal_samples) + if ( checkInParam(params.tools, tool_requiring_normal_samples) ) requested_tools_requiring_normal_samples.add(tool_requiring_normal_samples) } if (!requested_tools_requiring_normal_samples.isEmpty()) { error('The sample-sheet only contains tumor-samples, but the following tools, which were requested by the option "tools", expect at least one normal-sample : ' + requested_tools_requiring_normal_samples.join(", ")) @@ -206,7 +207,7 @@ if (params.wes && !params.step == 'annotate') { else log.warn("Intervals file was provided without parameter `--wes`: Pipeline will assume this is Whole-Genome-Sequencing data.") } else if (params.intervals && !params.intervals.endsWith("bed") && !params.intervals.endsWith("list")) error("Intervals file must end with .bed, .list, or .interval_list") -if (params.step == 'mapping' && params.aligner.contains("dragmap") && !(params.skip_tools && params.skip_tools.split(',').contains("baserecalibrator"))) { +if (params.step == 'mapping' && params.aligner.contains("dragmap") && !(checkInParam(params.skip_tools, "baserecalibrator") )) { log.warn("DragMap was specified as aligner. Base recalibration is not contained in --skip_tools. It is recommended to skip baserecalibration when using DragMap\nhttps://gatk.broadinstitute.org/hc/en-us/articles/4407897446939--How-to-Run-germline-single-sample-short-variant-discovery-in-DRAGEN-mode") } @@ -214,12 +215,12 @@ if (params.step == 'mapping' && params.aligner.contains("sentieon-bwamem") && pa error("Sentieon BWA is currently not compatible with FGBio UMI handeling. Please choose a different aligner.") } -if (params.tools && params.tools.contains("sentieon_haplotyper") && params.joint_germline && (!params.sentieon_haplotyper_emit_mode || !(params.sentieon_haplotyper_emit_mode.contains('gvcf')))) { +if (checkInParam(params.tools, "sentieon_haplotyper") && params.joint_germline && (!params.sentieon_haplotyper_emit_mode || !(params.sentieon_haplotyper_emit_mode.contains('gvcf')))) { error("When setting the option `--joint_germline` and including `sentieon_haplotyper` among the requested tools, please set `--sentieon_haplotyper_emit_mode` to include `gvcf`.") } // Fails or warns when missing files or params for ascat -if (params.tools && params.tools.split(',').contains('ascat')) { +if (checkInParam(params.tools, 'ascat')) { if (!params.ascat_alleles) { error("No allele files were provided for running ASCAT. Please provide a zip folder with allele files.") } @@ -235,7 +236,7 @@ if (params.tools && params.tools.split(',').contains('ascat')) { } // Warns when missing files or params for mutect2 -if (params.tools && params.tools.split(',').contains('mutect2')) { +if (checkInParam(params.tools, 'mutect2')) { if (!params.pon) { log.warn("No Panel-of-normal was specified for Mutect2.\nIt is highly recommended to use one: https://gatk.broadinstitute.org/hc/en-us/articles/5358911630107-Mutect2\nFor more information on how to create one: https://gatk.broadinstitute.org/hc/en-us/articles/5358921041947-CreateSomaticPanelOfNormals-BETA-") } @@ -250,14 +251,14 @@ if (params.tools && params.tools.split(',').contains('mutect2')) { // Fails when missing resources for baserecalibrator // Warns when missing resources for haplotypecaller if (!params.dbsnp && !params.known_indels) { - if (params.step in ['mapping', 'markduplicates', 'prepare_recalibration', 'recalibrate'] && (!params.skip_tools || (params.skip_tools && !params.skip_tools.split(',').contains('baserecalibrator')))) { + if (params.step in ['mapping', 'markduplicates', 'prepare_recalibration', 'recalibrate'] && (!params.skip_tools || (params.skip_tools && !checkInParam(params.skip_tools, 'baserecalibrator')))) { error("Base quality score recalibration requires at least one resource file. Please provide at least one of `--dbsnp` or `--known_indels`\nYou can skip this step in the workflow by adding `--skip_tools baserecalibrator` to the command.") } - if (params.tools && (params.tools.split(',').contains('haplotypecaller') || params.tools.split(',').contains('sentieon_haplotyper'))) { + if (params.tools && (checkInParam(params.tools, 'haplotypecaller') || checkInParam(params.tools, 'sentieon_haplotyper'))) { log.warn "If GATK's Haplotypecaller or Sentieon's Haplotyper is specified, without `--dbsnp` or `--known_indels no filtering will be done. For filtering, please provide at least one of `--dbsnp` or `--known_indels`.\nFor more information see FilterVariantTranches (single-sample, default): https://gatk.broadinstitute.org/hc/en-us/articles/5358928898971-FilterVariantTranches\nFor more information see VariantRecalibration (--joint_germline): https://gatk.broadinstitute.org/hc/en-us/articles/5358906115227-VariantRecalibrator\nFor more information on GATK Best practice germline variant calling: https://gatk.broadinstitute.org/hc/en-us/articles/360035535932-Germline-short-variant-discovery-SNPs-Indels-" } } -if (params.joint_germline && (!params.tools || !(params.tools.split(',').contains('haplotypecaller') || params.tools.split(',').contains('sentieon_haplotyper')))) { +if (params.joint_germline && (!params.tools || !(checkInParam(params.tools, 'haplotypecaller') || checkInParam(params.tools, 'sentieon_haplotyper')))) { error("The GATK's Haplotypecaller or Sentieon's Haplotyper should be specified as one of the tools when doing joint germline variant calling.) ") } @@ -266,7 +267,7 @@ if (params.joint_germline && (!params.dbsnp || !params.known_indels || !params.k } // Fails when --joint_mutect2 is used without enabling mutect2 -if (params.joint_mutect2 && (!params.tools || !params.tools.split(',').contains('mutect2'))) { +if (params.joint_mutect2 && (!params.tools || !checkInParam(params.tools, 'mutect2'))) { error("The mutect2 should be specified as one of the tools when doing joint somatic variant calling with Mutect2. (The mutect2 could be specified by adding `--tools mutect2` to the nextflow command.)") } @@ -276,7 +277,7 @@ if ((params.step == 'variant_calling' || params.step == 'annotate') && !params.t } // Fails when missing sex information for CNV tools -if (params.tools && (params.tools.split(',').contains('ascat') || params.tools.split(',').contains('controlfreec'))) { +if (params.tools && (checkInParam(params.tools, 'ascat') || checkInParam(params.tools, 'controlfreec'))) { input_sample.map{ if (it[0].sex == 'NA' ) { error("Please specify sex information for each sample in your samplesheet when using '--tools' with 'ascat' or 'controlfreec'.\nhttps://nf-co.re/sarek/usage#input-samplesheet-configurations") @@ -437,6 +438,8 @@ include { MULTIQC } from '../modules/nf-core ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +include { checkInParam } from "${projectDir}/checkInParam" + workflow SAREK { // MULTIQC @@ -547,7 +550,7 @@ workflow SAREK { else [ intervals[0], intervals[1], num_intervals ] } - if (params.tools && params.tools.split(',').contains('cnvkit')) { + if (checkInParam(params.tools, 'cnvkit')) { if (params.cnvkit_reference) { cnvkit_reference = Channel.fromPath(params.cnvkit_reference).collect() } else { @@ -596,7 +599,7 @@ workflow SAREK { // Additional options to be set up // QC - if (!(params.skip_tools && params.skip_tools.split(',').contains('fastqc'))) { + if (!(checkInParam(params.skip_tools, 'fastqc'))) { FASTQC(input_fastq) reports = reports.mix(FASTQC.out.zip.collect{ meta, logs -> logs }) @@ -696,8 +699,8 @@ workflow SAREK { if ( params.save_mapped || ( - (params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) && - !(params.tools && params.tools.split(',').contains('sentieon_dedup')) + (checkInParam(params.skip_tools, 'markduplicates')) && + !(checkInParam(params.tools, 'sentieon_dedup')) ) ) { // bams are merged (when multiple lanes from the same sample), indexed and then converted to cram @@ -738,8 +741,8 @@ workflow SAREK { if ( params.skip_tools && - params.skip_tools.split(',').contains('markduplicates') && - !(params.tools && params.tools.split(',').contains('sentieon_dedup')) + checkInParam(params.skip_tools, 'markduplicates') && + !(checkInParam(params.tools, 'sentieon_dedup')) ) { if (params.step == 'mapping') { cram_skip_markduplicates = BAM_TO_CRAM_MAPPING.out.alignment_index @@ -777,7 +780,7 @@ workflow SAREK { // Gather used softwares versions versions = versions.mix(BAM_MARKDUPLICATES_SPARK.out.versions) - } else if (params.tools && params.tools.split(',').contains('sentieon_dedup')) { + } else if (checkInParam(params.tools, 'sentieon_dedup')) { crai_for_markduplicates = params.step == 'mapping' ? bai_mapped : input_sample.map{ meta, input, index -> [ meta, index ] } BAM_SENTIEON_DEDUP( cram_for_markduplicates, @@ -824,7 +827,7 @@ workflow SAREK { // CSV should be written for the file actually out, either CRAM or BAM // Create CSV to restart from this step - csv_subfolder = (params.tools && params.tools.split(',').contains('sentieon_dedup')) ? 'sentieon_dedup' : 'markduplicates' + csv_subfolder = (checkInParam(params.tools, 'sentieon_dedup')) ? 'sentieon_dedup' : 'markduplicates' params.save_output_as_bam ? CHANNEL_MARKDUPLICATES_CREATE_CSV(CRAM_TO_BAM.out.alignment_index, csv_subfolder, params.outdir, params.save_output_as_bam) : CHANNEL_MARKDUPLICATES_CREATE_CSV(ch_md_cram_for_restart, csv_subfolder, params.outdir, params.save_output_as_bam) } @@ -865,7 +868,7 @@ workflow SAREK { } // STEP 3: Create recalibration tables - if (!(params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator'))) { + if (!(checkInParam(params.skip_tools, 'baserecalibrator'))) { ch_table_bqsr_no_spark = Channel.empty() ch_table_bqsr_spark = Channel.empty() @@ -944,7 +947,7 @@ workflow SAREK { .map{ meta, cram, crai, table -> [ meta + [data_type: "cram"], cram, crai, table ]} } - if (!(params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator'))) { + if (!(checkInParam(params.skip_tools, 'baserecalibrator'))) { cram_variant_calling_no_spark = Channel.empty() cram_variant_calling_spark = Channel.empty() @@ -1121,7 +1124,7 @@ workflow SAREK { known_sites_snps_tbi, known_snps_vqsr, params.joint_germline, - params.skip_tools && params.skip_tools.split(',').contains('haplotypecaller_filter'), // true if filtering should be skipped + checkInParam(params.skip_tools, 'haplotypecaller_filter'), // true if filtering should be skipped params.sentieon_haplotyper_emit_mode) // TUMOR ONLY VARIANT CALLING @@ -1215,7 +1218,7 @@ workflow SAREK { // ANNOTATE if (params.step == 'annotate') vcf_to_annotate = input_sample - if (params.tools.split(',').contains('merge') || params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('vep')) { + if (checkInParam(params.tools, 'merge') || checkInParam(params.tools, 'snpeff') || checkInParam(params.tools, 'vep')) { vep_fasta = (params.vep_include_fasta) ? fasta.map{ fasta -> [ [ id:fasta.baseName ], fasta ] } : [[id: 'null'], []] @@ -1238,12 +1241,12 @@ workflow SAREK { } version_yaml = Channel.empty() - if (!(params.skip_tools && params.skip_tools.split(',').contains('versions'))) { + if (!(checkInParam(params.skip_tools, 'versions'))) { CUSTOM_DUMPSOFTWAREVERSIONS(versions.unique().collectFile(name: 'collated_versions.yml')) version_yaml = CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect() } - if (!(params.skip_tools && params.skip_tools.split(',').contains('multiqc'))) { + if (!(checkInParam(params.skip_tools, 'multiqc'))) { workflow_summary = WorkflowSarek.paramsSummaryMultiqc(workflow, summary_params) ch_workflow_summary = Channel.value(workflow_summary) @@ -1308,6 +1311,8 @@ def flowcellLaneFromFastq(path) { return fcid } + + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ THE END