diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f3d2c3..aea92db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## v1.5.0dev [date] +## v1.4.1dev [date] ### New Features +1. Added the `--output_suffix` option to add a custom suffix to the basename of the output files. + +### Improvements + +1. Updated the seqplorer profile so that the output filenames are correct for easy import +2. Changed the separator in `--vcfanno_resources` to `;` + instead of `,` to allow commas in glob patterns. + ## v1.4.0 - Kingly Kortrijk - [December 6 2023] ### New Features diff --git a/conf/HyperCap.config b/conf/HyperCap.config deleted file mode 100644 index 23f9def3..00000000 --- a/conf/HyperCap.config +++ /dev/null @@ -1,20 +0,0 @@ -/* -======================================================================================== - Nextflow config file for HyperCap runs -======================================================================================== -*/ - -params { - callers = "vardict" - filter = true - normalize = true - annotate = true - vcfanno = true - scatter_count = 5 - vep_dbnsfp = true - vep_spliceai = true - vep_spliceregion = true - vep_mastermind = true - vep_maxentscan = true - vep_eog = true -} \ No newline at end of file diff --git a/conf/hypercap.config b/conf/hypercap.config new file mode 100644 index 00000000..a5a4cf72 --- /dev/null +++ b/conf/hypercap.config @@ -0,0 +1,12 @@ +/* +======================================================================================== + Nextflow config file for HyperCap runs +======================================================================================== +*/ + +params { + callers = "vardict" + scatter_count = 5 + + output_suffix = "-vardict-decomposed-annotated" +} \ No newline at end of file diff --git a/conf/modules.config b/conf/modules.config index fdf28f01..93d7bfce 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -44,6 +44,8 @@ def individual_validation = { "${params.outdir}/${meta.sample}/validation/${getG def callers = params.callers.tokenize(",") +def final_prefix = params.output_suffix ? { "${meta.id}${params.output_suffix}" } : { "${meta.id}.${getGenotypedCaller(meta.caller)}" } + process { publishDir = [ @@ -76,7 +78,7 @@ process { mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] // SAVE - ext.prefix = { "${meta.id}.${getGenotypedCaller(meta.caller)}" } + ext.prefix = final_prefix } /* @@ -251,7 +253,7 @@ process { } withName: "^.*:GVCF_JOINT_GENOTYPE_GATK4:VCF_CONCAT_BCFTOOLS:BCFTOOLS_CONCAT\$" { - ext.prefix = {"${meta.id}.${getGenotypedCaller(meta.caller)}"} + ext.prefix = final_prefix ext.args = "--allow-overlaps --output-type z" publishDir = [ enabled: enableOutput("original"), @@ -269,7 +271,7 @@ process { } withName: "^.*:CRAM_CALL_GENOTYPE_GATK4:VCF_FILTER_BCFTOOLS:FILTER_2\$" { - ext.prefix = {"${meta.id}.${getGenotypedCaller(meta.caller)}"} + ext.prefix = final_prefix ext.args = {'--output-type z --soft-filter \'GATKCutoffIndel\' -e \'TYPE="indel" && (ReadPosRankSum < -20.0 || QD < 2.0 || FS > 200.0 || SOR > 10.0 || (QD < 10.0 && AD[0:1] / (AD[0:1] + AD[0:0]) < 0.25 && ReadPosRankSum < 0.0))\' -m \'+\''} publishDir = [ enabled: enableOutput("filter"), @@ -370,7 +372,7 @@ process { enabled: enableOutput("normalize"), mode: params.publish_dir_mode, path: final_output, - saveAs: { filename -> filename.endsWith('.vcf.gz') ? "${meta.id}.${getGenotypedCaller(meta.caller)}.vcf.gz" : null } + saveAs: { filename -> filename.endsWith('.vcf.gz') ? filename.replaceAll(".normalized.vcf.gz\$", ".vcf.gz") : null } ] // SAVE } @@ -380,7 +382,7 @@ process { enabled: enableOutput("normalize"), mode: params.publish_dir_mode, path: final_output, - saveAs: { filename -> filename.endsWith('.vcf.gz.tbi') ? "${meta.id}.${getGenotypedCaller(meta.caller)}.vcf.gz.tbi" : null } + saveAs: { filename -> filename.endsWith('.vcf.gz.tbi') ? filename.replaceAll(".normalized.vcf.gz.tbi\$", ".vcF.gz.tbi") : null } ] // SAVE } } @@ -395,7 +397,7 @@ process { withName: "^.*:VCF_EXTRACT_RELATE_SOMALIER:SOMALIER_RELATE\$" { ext.args = { ped ? "" : "--infer"} - ext.prefix = { "${meta.sample ?: meta.id}.${getGenotypedCaller(meta.caller)}" } + ext.prefix = final_prefix publishDir = [ overwrite: true, enabled: true, @@ -416,14 +418,14 @@ process { } withName: "^.*:VCF_PED_RTGTOOLS:BCFTOOLS_ANNOTATE\$" { - ext.prefix = { "${meta.sample ?: meta.id}.${getGenotypedCaller(meta.caller)}.pedheader" } + ext.prefix = final_prefix ext.args = "--output-type z" publishDir = [ enabled: enableOutput("add_ped"), overwrite: true, path: final_output, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename.replace(".pedheader", "") } + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] // SAVE } } @@ -476,7 +478,7 @@ process { mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] // SAVE - ext.prefix = { "${meta.id}.${getGenotypedCaller(meta.caller)}" } + ext.prefix = final_prefix } if (params.vcfanno){ @@ -488,7 +490,7 @@ process { mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] // SAVE - ext.prefix = { "${meta.id}.${getGenotypedCaller(meta.caller)}" } + ext.prefix = final_prefix } } @@ -536,8 +538,8 @@ process { */ if(params.gemini){ - withName: VCF2DB{ - ext.prefix = { "${meta.sample ?: meta.id}.${getGenotypedCaller(meta.caller)}" } + withName: "^.*:VCF2DB\$" { + ext.prefix = final_prefix publishDir = [ overwrite: true, path: final_output, @@ -547,13 +549,13 @@ process { } } - withName: TABIX_FINAL { + withName: "^.*:TABIX_FINAL\$" { publishDir = [ enabled: true, overwrite: true, path: final_output, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : "${meta.id}.${getGenotypedCaller(meta.caller)}.vcf.gz.tbi" } + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] // SAVE } } @@ -568,17 +570,6 @@ process { cache = false } - withName: MULTIQC { - publishDir = [ - overwrite: true, - path: { "${params.outdir}/multiqc_reports" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] // SAVE => Fix the location problem - errorStrategy = {task.exitStatus == 143 ? 'retry' : 'ignore'} - ext.args = { params.multiqc_config ? "--config $multiqc_custom_config" : "" } - } - withName: 'MULTIQC' { ext.args = params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' publishDir = [ diff --git a/conf/SeqCap.config b/conf/seqcap.config similarity index 100% rename from conf/SeqCap.config rename to conf/seqcap.config diff --git a/conf/seqplorer.config b/conf/seqplorer.config index 46c6b493..31b79a23 100644 --- a/conf/seqplorer.config +++ b/conf/seqplorer.config @@ -5,19 +5,18 @@ */ params { - filter = true - decompose = true - normalize = true + filter = true + normalize = true + gemini = true + vcfanno = true annotate = true - vep_dbnsfp = true + vep_merged = true vep_spliceai = true vep_mastermind = true vep_eog = true vep_maxentscan = true vep_spliceregion = true - - gemini = true - + output_suffix = "-gatk4-haplotype-joint-decomposed-annotated" } \ No newline at end of file diff --git a/conf/test.config b/conf/test.config index 955d01c6..f9ac8df0 100644 --- a/conf/test.config +++ b/conf/test.config @@ -50,6 +50,6 @@ params { // VCFanno vcfanno = true vcfanno_config = "${projectDir}/assets/vcfanno.toml" - vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz,https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" + vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz;https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" } diff --git a/main.nf b/main.nf index 3ea12a99..43bfd704 100644 --- a/main.nf +++ b/main.nf @@ -33,7 +33,8 @@ params.mastermind = WorkflowMain.getGenomeAttribute(params, 'mastermin params.mastermind_tbi = WorkflowMain.getGenomeAttribute(params, 'mastermind_tbi') params.eog = WorkflowMain.getGenomeAttribute(params, 'eog') params.eog_tbi = WorkflowMain.getGenomeAttribute(params, 'eog_tbi') - +params.vcfanno_resources = WorkflowMain.getGenomeAttribute(params, 'vcfanno_resources') +params.vcfanno_config = WorkflowMain.getGenomeAttribute(params, 'vcfanno_config') /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/nextflow.config b/nextflow.config index 7342e9e3..3b6372ce 100644 --- a/nextflow.config +++ b/nextflow.config @@ -27,6 +27,7 @@ params { callers = "haplotypecaller" vardict_min_af = 0.1 // Minimum allele frequency for VarDict normalize = false + output_suffix = "" // Module specific parameters dragstr = false @@ -51,9 +52,7 @@ params { // VCFanno parameters vcfanno = false - vcfanno_config = null vcfanno_lua = null - vcfanno_resources = null // References genome = "GRCh38" @@ -231,8 +230,8 @@ profiles { WES { includeConfig 'conf/WES.config' } WGS { includeConfig 'conf/WGS.config' } seqplorer { includeConfig 'conf/seqplorer.config' } - SeqCap { includeConfig 'conf/SeqCap.config' } - HyperCap { includeConfig 'conf/HyperCap.config' } + seqcap { includeConfig 'conf/seqcap.config' } + hypercap { includeConfig 'conf/hypercap.config' } } @@ -296,7 +295,7 @@ manifest { description = 'A nextflow pipeline for calling and annotating variants' mainScript = 'main.nf' nextflowVersion = '!>=23.04.0' - version = '1.5.0dev' + version = '1.4.1dev' doi = '' } diff --git a/nextflow_schema.json b/nextflow_schema.json index 4698896b..b1f14afd 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -239,6 +239,10 @@ "normalize": { "type": "boolean", "description": "Normalize the VCF after joint genotyping (will run on the decomposed VCF when --decompose is also used)" + }, + "output_suffix": { + "type": "string", + "description": "A custom suffix to add to the basename of the output files" } }, "required": ["scatter_count"] @@ -610,7 +614,7 @@ }, "vcfanno_resources": { "type": "string", - "description": "A comma-seperated list of resource files for VCFanno, please also supply their indices using this parameter" + "description": "A semicolon-seperated list of resource files for VCFanno, please also supply their indices using this parameter" } }, "help_text": "Annotation will only run when `--annotate true` is specified." diff --git a/tests/full_gvcf.nf.test b/tests/full_gvcf.nf.test index bb2461a7..3ee3cc61 100644 --- a/tests/full_gvcf.nf.test +++ b/tests/full_gvcf.nf.test @@ -19,7 +19,7 @@ nextflow_pipeline { vcfanno = true vcfanno_config = "https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/genome/vcf/vcfanno/vcfanno.toml" - vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz,https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" + vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz;https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" } } diff --git a/tests/full_wes.nf.test b/tests/full_wes.nf.test index 9e089f0e..8346728b 100644 --- a/tests/full_wes.nf.test +++ b/tests/full_wes.nf.test @@ -18,7 +18,7 @@ nextflow_pipeline { vcfanno = true vcfanno_config = "https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/genome/vcf/vcfanno/vcfanno.toml" - vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz,https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" + vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz;https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" } } diff --git a/tests/full_wgs.nf.test b/tests/full_wgs.nf.test index 4d7290b7..19c5d077 100644 --- a/tests/full_wgs.nf.test +++ b/tests/full_wgs.nf.test @@ -20,7 +20,7 @@ nextflow_pipeline { vcfanno = true vcfanno_config = "https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/genome/vcf/vcfanno/vcfanno.toml" - vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz,https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" + vcfanno_resources = "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz;https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz.tbi" } } diff --git a/workflows/cmgg-germline.nf b/workflows/cmgg-germline.nf index ec81d790..4f83db89 100644 --- a/workflows/cmgg-germline.nf +++ b/workflows/cmgg-germline.nf @@ -17,26 +17,35 @@ include { fromSamplesheet } from 'plugin/nf-validation' // if(params.dbsnp_tbi && !params.dbsnp){ - exit 1, "Please specify the dbsnp VCF with --dbsnp VCF" + error("Please specify the dbsnp VCF with --dbsnp VCF") } if (params.annotate) { // Check if a genome is given - if (!params.genome) { exit 1, "A genome should be supplied for annotation (use --genome)"} + if (!params.genome) { error("A genome should be supplied for annotation (use --genome)") } // Check if the VEP versions were given - if (!params.vep_version) { exit 1, "A VEP version should be supplied for annotation (use --vep_version)"} - if (!params.vep_cache_version) { exit 1, "A VEP cache version should be supplied for annotation (use --vep_cache_version)"} + if (!params.vep_version) { error("A VEP version should be supplied for annotation (use --vep_version)") } + if (!params.vep_cache_version) { error("A VEP cache version should be supplied for annotation (use --vep_cache_version)") } // Check if a species is entered - if (!params.species) { exit 1, "A species should be supplied for annotation (use --species)"} + if (!params.species) { error("A species should be supplied for annotation (use --species)") } // Check if all vcfanno files are supplied when vcfanno should be used if (params.vcfanno && (!params.vcfanno_config || !params.vcfanno_resources)) { - exit 1, "A TOML file and resource files should be supplied when using vcfanno (use --vcfanno_config and --vcfanno_resources)" + error("A TOML file and resource files should be supplied when using vcfanno (use --vcfanno_config and --vcfanno_resources)") } } +callers = params.callers.tokenize(",") +for(caller in callers) { + if(!(caller in GlobalVariables.availableCallers)) { error("\"${caller}\" is not a supported callers please use one or more of these instead: ${GlobalVariables.availableCallers}")} +} + +if (params.output_suffix && callers.size() > 1) { + error("Cannot use --output_suffix with more than one caller") +} + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONFIG FILES @@ -134,11 +143,6 @@ workflow CMGGGERMLINE { if (params.input) { ch_input = file(params.input, checkIfExists: true) } else { error('Input samplesheet not specified!') } - callers = params.callers.tokenize(",") - for(caller in callers) { - if(!(caller in GlobalVariables.availableCallers)) { error("\"${caller}\" is not a supported callers please use one or more of these instead: ${GlobalVariables.availableCallers}")} - } - ch_versions = Channel.empty() ch_reports = Channel.empty() @@ -163,7 +167,7 @@ workflow CMGGGERMLINE { ch_vcfanno_config = params.vcfanno_config ? Channel.fromPath(params.vcfanno_config).collect() : [] ch_vcfanno_lua = params.vcfanno_lua ? Channel.fromPath(params.vcfanno_lua).collect() : [] - ch_vcfanno_resources = params.vcfanno_resources ? Channel.of(params.vcfanno_resources.split(",")).map({ file(it, checkIfExists:true) }).collect() : [] + ch_vcfanno_resources = params.vcfanno_resources ? Channel.of(params.vcfanno_resources.split(";")).map({ file(it, checkIfExists:true) }).collect() : [] // // Check for the presence of EnsemblVEP plugins that use extra files @@ -333,7 +337,7 @@ workflow CMGGGERMLINE { // Infer the family ID from the PED file if no family ID was given. // If no PED is given, use the sample ID as family ID def new_meta = meta + [ - family: meta.family ?: ped ? get_family_id_from_ped(ped) : meta.sample, + family: meta.family ?: ped ? get_family_id_from_ped(ped) : meta.sample ] [ new_meta, cram, crai, gvcf, tbi, roi, ped, truth_vcf, truth_tbi, truth_bed ] }