diff --git a/CHANGELOG.md b/CHANGELOG.md index b7ab47c2..e12d1d93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added module `fastq` to check qc of strep samples - Added module `hostile` to remove human reads - Added module `sccmec` for typing of SCCmec cassettes in assemblies of Staphylococcus species +- Added when operators to all modules that aren't in `bacterial_base.nf` ### Fixed @@ -41,6 +42,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed serotypefinder from saureus workflow - Fixed jasen running only on the first row/sample in csv - Fixed channel problem by changing `Channel.of([])` to `Channel.value([])` +- Fixed `nextflow.hopper.config` re singularity image path +- Fixed sccmec version file +- Fixed handling of ONT samples re fastqc & postalignqc ### Changed @@ -59,6 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changed ska & sourmash filepath to symlink dir in `nextflow.hopper.config` & `nextflow.dev.config` - Updated Kraken db filepath in `nextflow.hopper.config` & `nextflow.dev.config` - Changed `staphylococcus_aureus_all` to `saureus_all` in `Makefile` +- Moved all when commands to configs +- Update fastqc & sccmec mem settings ## [0.9.0] diff --git a/configs/nextflow.base.config b/configs/nextflow.base.config index 675eb046..157bb456 100644 --- a/configs/nextflow.base.config +++ b/configs/nextflow.base.config @@ -147,6 +147,7 @@ process { withName: add_igv_track { container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: amrfinderplus { container = "${params.containerDir}/ncbi-amrfinderplus.sif" @@ -154,10 +155,12 @@ process { memory = '10.GB' publishDir = [ path: "${params.outdir}/${params.speciesDir}/amrfinderplus", mode: 'copy', overwrite: true ] ext.args = "--plus" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: annotate_delly { container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: assembly_trim_clean { container = "${params.containerDir}/perl-json.sif" @@ -174,13 +177,14 @@ process { withName: bwa_index { container = "${params.containerDir}/bwakit.sif" ext.args = "-M" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_dedup { container = "${params.containerDir}/bwakit.sif" cpus = 16 memory = '20.GB' ext.args = "-M" - ext.when = true + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_ref { container = "${params.containerDir}/bwakit.sif" @@ -188,15 +192,20 @@ process { memory = '20.GB' publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] ext.args = "-M" - ext.when = { params.referenceGenome } + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_allelecall { cpus = 16 memory = '12.GB' container = "${params.containerDir}/chewbbaca.sif" + ext.when = { params.species != "mycobacterium tuberculosis" } + } + withName: chewbbaca_create_batch_list { + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_split_results { publishDir = [ path: "${params.outdir}/${params.speciesDir}/chewbbaca", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: create_analysis_result { container = "${params.containerDir}/bonsai-prp.sif" @@ -216,6 +225,7 @@ process { withName: emmtyper { container = "${params.containerDir}/emmtyper.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/emmtyper", mode: 'copy', overwrite: true ] + ext.when = { params.species in ["streptococcus", "streptococcus pyogenes"] } } withName: export_to_cdm { publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/qc", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/qc", mode: 'copy', overwrite: true ] ] : []) @@ -231,6 +241,7 @@ process { } withName: fastqc { cpus = 4 + memory = '2.GB' container = "${params.containerDir}/fastqc.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/fastqc", mode: 'copy', overwrite: true ] ext.args = "--threads 4" @@ -239,6 +250,7 @@ process { container = "${params.containerDir}/freebayes.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] ext.args = "-C 2 -F 0.2 --pooled-continuous" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: hostile { container = "https://depot.galaxyproject.org/singularity/hostile:2.0.0--pyhdfd78af_0" @@ -253,6 +265,7 @@ process { } withName: mask_polymorph_assembly { publishDir = [ path: "${params.outdir}/${params.speciesDir}/mask", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: medaka { container = "${params.containerDir}/medaka.sif" @@ -260,17 +273,19 @@ process { memory = '32.GB' time=2.h publishDir = [ path: "${params.outdir}/${params.speciesDir}/medaka", mode: 'copy', overwrite: true ] - ext.args = "--threads 40 -m r941_min_sup_g507" + ext.args = "-t 40 -m r941_min_sup_g507" } withName: mlst { container = "${params.containerDir}/mlst.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mlst", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: mykrobe { memory = '4.GB' container = "${params.containerDir}/mykrobe.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mykrobe", mode: 'copy', overwrite: true ] ext.args = "--species tb --format csv" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: nanoplot { container = "${params.containerDir}/nanoplot.sif" @@ -281,6 +296,7 @@ process { memory = '2.GB' container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/postalignqc", mode: 'copy', overwrite: true ] + ext.when = { params.species != "streptococcus" } } withName: quast { container = "${params.containerDir}/quast.sif" @@ -289,17 +305,20 @@ process { withName: resfinder { container = "${params.containerDir}/resfinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/resfinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_assembly { cpus = 16 memory = '2.GB' container = "${params.containerDir}/samtools.sif" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_ref { cpus = 16 memory = '2.GB' container = "${params.containerDir}/samtools.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: save_analysis_metadata { container = "${params.containerDir}/bonsai-prp.sif" @@ -308,6 +327,7 @@ process { withName: sccmec { container = "${params.containerDir}/sccmec.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/sccmec", mode: 'copy', overwrite: true ] + ext.when = { params.species == "staphylococcus aureus" } } withName: seqtk_sample { container = "${params.containerDir}/seqtk.sif" @@ -318,11 +338,13 @@ process { cpus = 2 container = "${params.containerDir}/serotypefinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/serotypefinder", mode: 'copy', overwrite: true ] + ext.when = { (params.species in ["escherichia coli", "klebsiella pneumoniae"]) } } withName: shigapass { cpus = 2 container = "${params.containerDir}/shigapass.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/shigapass", mode: 'copy', overwrite: true ] + ext.when = { params.species == "escherichia coli" } } withName: ska_build { container = "${params.containerDir}/ska2.sif" @@ -344,6 +366,7 @@ process { memory = '32.GB' container = "${params.containerDir}/snippy.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/snippy", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: sourmash { container = "${params.containerDir}/sourmash.sif" @@ -371,11 +394,13 @@ process { container = "${params.containerDir}/tb-profiler.sif" publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/tbprofiler_mergedb", mode: 'copy', overwrite: true, pattern: '*.json' ], [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true, pattern: '*.{vcf.gz}' ], [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true, pattern: '*.bam*' ] ] ext.args = "--external_db ${params.root}/assets/tbdb/converged_who_fohm_tbdb --calling_params '-q 15'" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: virulencefinder { cpus = 2 container = "${params.containerDir}/virulencefinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/virulencefinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } } diff --git a/configs/nextflow.ci.config b/configs/nextflow.ci.config index 15f770b6..fa2616a8 100644 --- a/configs/nextflow.ci.config +++ b/configs/nextflow.ci.config @@ -135,6 +135,7 @@ process { withName: add_igv_track { container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: amrfinderplus { container = "${params.containerDir}/ncbi-amrfinderplus.sif" @@ -142,10 +143,12 @@ process { memory = '10.GB' publishDir = [ path: "${params.outdir}/${params.speciesDir}/ncbi-amrfinderplus", mode: 'copy', overwrite: true ] ext.args = "--plus" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: annotate_delly { container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: assembly_trim_clean { container = "${params.containerDir}/perl-json.sif" @@ -162,13 +165,14 @@ process { withName: bwa_index { container = "${params.containerDir}/bwakit.sif" ext.args = "-M" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_dedup { container = "${params.containerDir}/bwakit.sif" cpus = 4 memory = '12.GB' ext.args = "-M" - ext.when = true + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_ref { container = "${params.containerDir}/bwakit.sif" @@ -176,15 +180,20 @@ process { memory = '12.GB' publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] ext.args = "-M" - ext.when = { params.referenceGenome } + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_allelecall { cpus = 4 memory = '12.GB' container = "${params.containerDir}/chewbbaca.sif" + ext.when = { params.species != "mycobacterium tuberculosis" } + } + withName: chewbbaca_create_batch_list { + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_split_results { publishDir = [ path: "${params.outdir}/${params.speciesDir}/chewbbaca", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: create_analysis_result { container = "${params.containerDir}/bonsai-prp.sif" @@ -204,20 +213,32 @@ process { withName: emmtyper { container = "${params.containerDir}/emmtyper.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/emmtyper", mode: 'copy', overwrite: true ] + ext.when = { params.species in ["streptococcus", "streptococcus pyogenes"] } } withName: export_to_cdm { publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/qc", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/qc", mode: 'copy', overwrite: true ] ] : []) } withName: fastqc { cpus = 4 + memory = '2.GB' container = "${params.containerDir}/fastqc.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/fastqc", mode: 'copy', overwrite: true ] ext.args = "--threads 4" } + withName: flye { + container = "${params.containerDir}/flye.sif" + cpus = 4 + memory = '2.GB' + time=2.h + publishDir = [ path: "${params.outdir}/${params.speciesDir}/flye", mode: 'copy', overwrite: true ] + ext.args = "--threads 40 --genome-size 2.8m --asm-coverage 50" + ext.seqmethod = "--nano-hq" + } withName: freebayes { container = "${params.containerDir}/freebayes.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] ext.args = "-C 2 -F 0.2 --pooled-continuous" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: hostile { container = "https://depot.galaxyproject.org/singularity/hostile:2.0.0--pyhdfd78af_0" @@ -232,6 +253,7 @@ process { } withName: mask_polymorph_assembly { publishDir = [ path: "${params.outdir}/${params.speciesDir}/mask", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: medaka { container = "${params.containerDir}/medaka.sif" @@ -239,17 +261,19 @@ process { memory = '32.GB' time=2.h publishDir = [ path: "${params.outdir}/${params.speciesDir}/medaka", mode: 'copy', overwrite: true ] - ext.args = "--threads 40 -m r941_min_sup_g507" + ext.args = "-t 40 -m r941_min_sup_g507" } withName: mlst { container = "${params.containerDir}/mlst.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mlst", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: mykrobe { memory = '4.GB' container = "${params.containerDir}/mykrobe.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mykrobe", mode: 'copy', overwrite: true ] ext.args = "--species tb --format csv" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: nanoplot { container = "${params.containerDir}/nanoplot.sif" @@ -260,6 +284,7 @@ process { memory = '2.GB' container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/postalignqc", mode: 'copy', overwrite: true ] + ext.when = { params.species != "streptococcus" } } withName: quast { container = "${params.containerDir}/quast.sif" @@ -268,17 +293,20 @@ process { withName: resfinder { container = "${params.containerDir}/resfinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/resfinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_assembly { cpus = 4 memory = '2.GB' container = "${params.containerDir}/samtools.sif" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_ref { cpus = 4 memory = '2.GB' container = "${params.containerDir}/samtools.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: save_analysis_metadata { container = "${params.containerDir}/bonsai-prp.sif" @@ -287,6 +315,7 @@ process { withName: sccmec { container = "${params.containerDir}/sccmec.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/sccmec", mode: 'copy', overwrite: true ] + ext.when = { params.species == "staphylococcus aureus" } } withName: seqtk_sample { container = "${params.containerDir}/seqtk.sif" @@ -297,11 +326,13 @@ process { cpus = 2 container = "${params.containerDir}/serotypefinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/serotypefinder", mode: 'copy', overwrite: true ] + ext.when = { (params.species in ["escherichia coli", "klebsiella pneumoniae"]) } } withName: shigapass { cpus = 2 container = "${params.containerDir}/shigapass.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/shigapass", mode: 'copy', overwrite: true ] + ext.when = { params.species == "escherichia coli" } } withName: ska_build { container = "${params.containerDir}/ska2.sif" @@ -323,6 +354,7 @@ process { memory = '12.GB' container = "${params.containerDir}/snippy.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/snippy", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: sourmash { container = "${params.containerDir}/sourmash.sif" @@ -350,11 +382,13 @@ process { container = "${params.containerDir}/tb-profiler.sif" publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/tbprofiler_mergedb", mode: 'copy', overwrite: true, pattern: '*.json' ], [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true, pattern: '*.{vcf.gz}' ], [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true, pattern: '*.bam*' ] ] ext.args = "--external_db ${params.root}/assets/tbdb/converged_who_fohm_tbdb --calling_params '-q 15'" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: virulencefinder { cpus = 2 container = "${params.containerDir}/virulencefinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/virulencefinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } } diff --git a/configs/nextflow.dev.config b/configs/nextflow.cmd.config similarity index 86% rename from configs/nextflow.dev.config rename to configs/nextflow.cmd.config index da9a4dda..53367e26 100644 --- a/configs/nextflow.dev.config +++ b/configs/nextflow.cmd.config @@ -1,4 +1,4 @@ -// Hopper specific configuration for micro wgs pipeline // +// Configuration for the Centre of Molecular Diagnostics (CMD) in Lund, Sweden // params { root = "/fs1/pipelines/jasen_dev" @@ -18,6 +18,7 @@ params { scratch = true containerDir = "/fs1/resources/containers" outdir = "/fs1/results_dev/jasen" + bonsaiPrpSif = "${params.containerDir}/bonsai-prp.sif" args = "" prefix = "" bamDir = "bam" @@ -26,7 +27,7 @@ params { // PIPELINE OPTIONS // devMode = true cronCopy = false - useHostile = false + useHostile = true useKraken = true useSkesa = true // To use spades set useSkesa = false queue='grace-high' @@ -93,9 +94,9 @@ profiles { mycobacterium_tuberculosis { params.species = 'mycobacterium tuberculosis' params.speciesDir = 'mtuberculosis' - params.symlinkDir = "/access/jasen/mtuberculosis/" params.resistantLociName = 'resistance_loci' params.gradingLociName = 'grading_loci' + params.symlinkDir = "/access/jasen/mtuberculosis/" params.referenceGenome = "${params.root}/assets/genomes/mycobacterium_tuberculosis/GCF_000195955.2.fasta" params.referenceGenomeIdx = "${params.root}/assets/genomes/mycobacterium_tuberculosis/GCF_000195955.2.fasta.fai" params.referenceGenomeGff = "${params.root}/assets/genomes/mycobacterium_tuberculosis/GCF_000195955.2.gff" @@ -137,6 +138,22 @@ profiles { params.useSerotypeDbs = [] params.targetSampleSize = null } + + dev { + params.root = "/fs1/pipelines/jasen_dev" + params.outdir = "/fs1/results_dev/jasen" + params.devMode = true + params.cronCopy = false + params.bonsaiPrpSif = "${params.containerDir}/bonsai-prp.sif" + } + + production { + params.root = "/fs1/pipelines/jasen" + params.outdir = "/fs1/results/jasen" + params.devMode = false + params.cronCopy = true + params.bonsaiPrpSif = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" + } } process { @@ -147,8 +164,9 @@ process { cpus=2 withName: add_igv_track { - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: amrfinderplus { container = "https://depot.galaxyproject.org/singularity/ncbi-amrfinderplus:3.11.11--h6e70893_0" @@ -156,10 +174,12 @@ process { memory = '10.GB' publishDir = [ path: "${params.outdir}/${params.speciesDir}/amrfinderplus", mode: 'copy', overwrite: true ] ext.args = "--plus" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: annotate_delly { - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: assembly_trim_clean { container = "https://depot.galaxyproject.org/singularity/perl-json:4.10--pl5321hdfd78af_0" @@ -176,13 +196,14 @@ process { withName: bwa_index { container = "https://depot.galaxyproject.org/singularity/bwakit:0.7.17.dev1--hdfd78af_1" ext.args = "-M" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_dedup { container = "https://depot.galaxyproject.org/singularity/bwakit:0.7.17.dev1--hdfd78af_1" cpus = 16 memory = '20.GB' ext.args = "-M" - ext.when = true + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_ref { container = "https://depot.galaxyproject.org/singularity/bwakit:0.7.17.dev1--hdfd78af_1" @@ -190,26 +211,31 @@ process { memory = '20.GB' publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] ext.args = "-M" - ext.when = { params.referenceGenome } + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_allelecall { cpus = 16 memory = '12.GB' container = "https://depot.galaxyproject.org/singularity/chewbbaca:3.3.2--pyhdfd78af_0" + ext.when = { params.species != "mycobacterium tuberculosis" } + } + withName: chewbbaca_create_batch_list { + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_split_results { publishDir = [ path: "${params.outdir}/${params.speciesDir}/chewbbaca", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: create_analysis_result { - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] } withName: create_cdm_input { - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.cdmDir}", mode: 'copy', overwrite: true ] } withName: create_yaml { - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/analysis_yaml", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/jasen/${params.speciesDir}", mode: 'copy', overwrite: true ] ] : []) ext.args_prp = {"${params.outdir}/${params.speciesDir}/analysis_result"} ext.args_sourmash = {"/access/jasen/${params.speciesDir}/sourmash"} @@ -218,6 +244,7 @@ process { withName: emmtyper { container = "https://depot.galaxyproject.org/singularity/emmtyper:0.2.0--py_0" publishDir = [ path: "${params.outdir}/${params.speciesDir}/emmtyper", mode: 'copy', overwrite: true ] + ext.when = { params.species in ["streptococcus", "streptococcus pyogenes"] } } withName: export_to_cdm { publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/qc", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/qc", mode: 'copy', overwrite: true ] ] : []) @@ -241,6 +268,7 @@ process { container = "https://depot.galaxyproject.org/singularity/freebayes:1.3.6--hbfe0e7f_2" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] ext.args = "-C 2 -F 0.2 --pooled-continuous" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: hostile { container = "https://depot.galaxyproject.org/singularity/hostile:2.0.0--pyhdfd78af_0" @@ -255,6 +283,7 @@ process { } withName: mask_polymorph_assembly { publishDir = [ path: "${params.outdir}/${params.speciesDir}/mask", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: medaka { container = "https://depot.galaxyproject.org/singularity/medaka:1.11.3--py39h05d5c5e_0" @@ -262,17 +291,19 @@ process { memory = '32.GB' time=2.h publishDir = [ path: "${params.outdir}/${params.speciesDir}/medaka", mode: 'copy', overwrite: true ] - ext.args = "--threads 40 -m r941_min_sup_g507" + ext.args = "-t 40 -m r941_min_sup_g507" } withName: mlst { container = "https://depot.galaxyproject.org/singularity/mlst:2.23.0--hdfd78af_1" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mlst", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: mykrobe { memory = '4.GB' container = "https://depot.galaxyproject.org/singularity/mykrobe:0.12.2--py39h70e0db4_0" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mykrobe", mode: 'copy', overwrite: true ] ext.args = "--species tb --format csv" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: nanoplot { container = "https://depot.galaxyproject.org/singularity/nanoplot:1.43.0--pyhdfd78af_1" @@ -281,8 +312,9 @@ process { } withName: post_align_qc { memory = '2.GB' - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ path: "${params.outdir}/${params.speciesDir}/postalignqc", mode: 'copy', overwrite: true ] + ext.when = { params.species != "streptococcus" } } withName: quast { container = "https://depot.galaxyproject.org/singularity/quast:5.2.0--py310pl5321hc8f18ef_2" @@ -291,25 +323,31 @@ process { withName: resfinder { container = "https://depot.galaxyproject.org/singularity/resfinder:4.4.2--pyhdfd78af_1" publishDir = [ path: "${params.outdir}/${params.speciesDir}/resfinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_assembly { cpus = 16 memory = '2.GB' container = "https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_ref { cpus = 16 memory = '2.GB' container = "https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: save_analysis_metadata { - container = "${params.containerDir}/bonsai-prp.sif" + container = "${params.bonsaiPrpSif}" publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_metadata", mode: 'copy', overwrite: true ] } withName: sccmec { + cpus = 2 + memory = '2.GB' container = "https://depot.galaxyproject.org/singularity/sccmec:1.2.0--hdfd78af_0" publishDir = [ path: "${params.outdir}/${params.speciesDir}/sccmec", mode: 'copy', overwrite: true ] + ext.when = { params.species == "staphylococcus aureus" } } withName: seqtk_sample { container = "https://depot.galaxyproject.org/singularity/seqtk:1.4--he4a0461_2" @@ -320,11 +358,13 @@ process { cpus = 2 container = "https://depot.galaxyproject.org/singularity/serotypefinder:2.0.2--py312hdfd78af_1" publishDir = [ path: "${params.outdir}/${params.speciesDir}/serotypefinder", mode: 'copy', overwrite: true ] + ext.when = { (params.species in ["escherichia coli", "klebsiella pneumoniae"]) } } withName: shigapass { cpus = 2 container = "https://depot.galaxyproject.org/singularity/shigapass:1.5.0--hdfd78af_0" publishDir = [ path: "${params.outdir}/${params.speciesDir}/shigapass", mode: 'copy', overwrite: true ] + ext.when = { params.species == "escherichia coli" } } withName: ska_build { container = "https://depot.galaxyproject.org/singularity/ska2:0.3.10--h4349ce8_0" @@ -346,6 +386,7 @@ process { memory = '32.GB' container = "https://depot.galaxyproject.org/singularity/snippy:4.6.0--hdfd78af_2" publishDir = [ path: "${params.outdir}/${params.speciesDir}/snippy", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: sourmash { container = "https://depot.galaxyproject.org/singularity/sourmash:4.8.2--hdfd78af_0" @@ -373,11 +414,13 @@ process { container = "https://depot.galaxyproject.org/singularity/tb-profiler:6.3.0--pyhdfd78af_0" publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/tbprofiler_mergedb", mode: 'copy', overwrite: true, pattern: '*.json' ], [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true, pattern: '*.{vcf.gz}' ], [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true, pattern: '*.bam*' ] ] ext.args = "--external_db ${params.root}/assets/tbdb/converged_who_fohm_tbdb --calling_params '-q 15'" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: virulencefinder { cpus = 2 container = "https://depot.galaxyproject.org/singularity/virulencefinder:2.0.4--hdfd78af_1" publishDir = [ path: "${params.outdir}/${params.speciesDir}/virulencefinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } } diff --git a/configs/nextflow.hopper.config b/configs/nextflow.hopper.config deleted file mode 100644 index 312f62c8..00000000 --- a/configs/nextflow.hopper.config +++ /dev/null @@ -1,388 +0,0 @@ -// Hopper specific configuration for micro wgs pipeline // - -params { - root = "/fs1/pipelines/jasen" - // DATABASES // - amrfinderDb = "${root}/assets/amrfinder_db/latest" - resfinderDb = "${root}/assets/resfinder_db" - pointfinderDb = "${root}/assets/pointfinder_db" - serotypefinderDb = "${root}/assets/serotypefinder_db" - virulencefinderDb = "${root}/assets/virulencefinder_db" - mlstBlastDb = "${root}/assets/mlst_db/blast" - pubMlstDb = "${root}/assets/mlst_db/pubmlst" - krakenDb = "/fs1/resources/ref/micro/k2_standard_20240904" - // INPUT & OUTPUT // - publishDir = "" - publishDirMode = 'copy' - publishDirOverwrite = true - scratch = true - containerDir = "/fs1/resources/containers" - outdir = "/fs1/results/jasen" - args = "" - prefix = "" - bamDir = "bam" - cdmDir = "cdm_input" - vcfDir = "vcf" - // PIPELINE OPTIONS // - cronCopy = true - useHostile = false - useKraken = true - useSkesa = true // To use spades set useSkesa = false - queue='grace-high' -} - -singularity{ - enabled = true - runOptions = '--bind /fs1/ --bind /fs2/ --bind /local/ --bind /mnt/beegfs/' - cacheDir = "${params.containerDir}/" -} - -profiles { - staphylococcus_aureus { - params.species = "staphylococcus aureus" - params.speciesDir = 'saureus' - params.mlstScheme = 'saureus' - params.symlinkDir = "/access/jasen/saureus/" - params.referenceGenome = "${params.root}/assets/genomes/staphylococcus_aureus/GCF_000012045.1.fasta" - params.referenceGenomeIdx = "${params.root}/assets/genomes/staphylococcus_aureus/GCF_000012045.1.fasta.fai" - params.referenceGenomeGff = "${params.root}/assets/genomes/staphylococcus_aureus/GCF_000012045.1.gff" - params.chewbbacaDb = "${params.root}/assets/cgmlst/staphylococcus_aureus/alleles_rereffed" - params.coreLociBed = "${params.root}/assets/cgmlst/staphylococcus_aureus/bed/GCF_000012045.1.bed" - params.trainingFile = "${params.root}/assets/cgmlst/staphylococcus_aureus/alleles_rereffed/Staphylococcus_aureus.trn" - params.useVirulenceDbs = ['s.aureus_hostimm', 's.aureus_exoenzyme', 's.aureus_toxin'] - params.useSerotypeDbs = [] - params.targetSampleSize = null - } - - escherichia_coli { - params.species = 'escherichia coli' - params.speciesDir = 'ecoli' - params.mlstScheme = 'ecoli_achtman_4' - params.symlinkDir = "/access/jasen/ecoli/" - params.referenceGenome = "${params.root}/assets/genomes/escherichia_coli/GCF_000005845.2.fasta" - params.referenceGenomeIdx = "${params.root}/assets/genomes/escherichia_coli/GCF_000005845.2.fasta.fai" - params.referenceGenomeGff = "${params.root}/assets/genomes/escherichia_coli/GCF_000005845.2.gff" - // params.chewbbacaDb = "${params.root}/assets/cgmlst/escherichia_coli/alleles_rereffed" - // params.coreLociBed = "${params.root}/assets/cgmlst/escherichia_coli/bed/GCF_000005845.2.bed" - // params.trainingFile = "${params.root}/assets/cgmlst/escherichia_coli/alleles_rereffed/Escherichia_coli.trn" - params.chewbbacaDb = "${params.root}/assets/wgmlst/escherichia_coli/alleles/ecoli_INNUENDO_wgMLST" - params.coreLociBed = "${params.root}/assets/wgmlst/escherichia_coli/bed/GCF_000005845.2.bed" - params.shigapassDb = "${params.root}/assets/ShigaPass/SCRIPT/ShigaPass_DataBases" - params.trainingFile = "${params.root}/assets/wgmlst/escherichia_coli/alleles/ecoli_INNUENDO_wgMLST/Escherichia_coli.trn" - params.useVirulenceDbs = ['virulence_ecoli', 'stx'] - params.useSerotypeDbs = ['O_type', 'H_type'] - params.targetSampleSize = null - } - - klebsiella_pneumoniae { - params.species = 'klebsiella pneumoniae' - params.speciesDir = 'kpneumoniae' - params.mlstScheme = 'klebsiella' - params.symlinkDir = "/access/jasen/kpneumoniae/" - params.referenceGenome = "${params.root}/assets/genomes/klebsiella_pneumoniae/GCF_000240185.1.fasta" - params.referenceGenomeIdx = "${params.root}/assets/genomes/klebsiella_pneumoniae/GCF_000240185.1.fasta.fai" - params.referenceGenomeGff = "${params.root}/assets/genomes/klebsiella_pneumoniae/GCF_000240185.1.gff" - params.chewbbacaDb = "${params.root}/assets/cgmlst/klebsiella_pneumoniae/alleles_rereffed" - params.coreLociBed = "${params.root}/assets/cgmlst/klebsiella_pneumoniae/bed/GCF_000240185.1.bed" - params.trainingFile = "${params.root}/assets/cgmlst/klebsiella_pneumoniae/alleles_rereffed/Klebsiella_pneumoniae.trn" - params.useVirulenceDbs = [] - params.useSerotypeDbs = ['O_type', 'H_type'] - params.targetSampleSize = null - } - - mycobacterium_tuberculosis { - params.species = 'mycobacterium tuberculosis' - params.speciesDir = 'mtuberculosis' - params.resistantLociName = 'resistance_loci' - params.gradingLociName = 'grading_loci' - params.symlinkDir = "/access/jasen/mtuberculosis/" - params.referenceGenome = "${params.root}/assets/genomes/mycobacterium_tuberculosis/GCF_000195955.2.fasta" - params.referenceGenomeIdx = "${params.root}/assets/genomes/mycobacterium_tuberculosis/GCF_000195955.2.fasta.fai" - params.referenceGenomeGff = "${params.root}/assets/genomes/mycobacterium_tuberculosis/GCF_000195955.2.gff" - params.coreLociBed = "${params.root}/assets/cgmlst/mycobacterium_tuberculosis/bed/GCF_000195955.2.bed" - params.tbGradingRulesBed = "${params.root}/assets/tb_info/bed/tb_grading_rules.bed" - params.tbdbBed = "${params.root}/assets/tbdb/converged_who_fohm_tbdb.bed.gz" - params.tbdbBedIdx = "${params.tbdbBed}.tbi" - params.targetSampleSize = null - } - - streptococcus_pyogenes { - params.species = 'streptococcus pyogenes' - params.speciesDir = 'spyogenes' - params.mlstScheme = 'spyogenes' - params.symlinkDir = "/access/jasen/spyogenes/" - params.referenceGenome = "${params.root}/assets/genomes/streptococcus_pyogenes/GCF_900475035.1.fasta" - params.referenceGenomeIdx = "${params.root}/assets/genomes/streptococcus_pyogenes/GCF_900475035.1.fasta.fai" - params.referenceGenomeGff = "${params.root}/assets/genomes/streptococcus_pyogenes/GCF_900475035.1.gff" - params.chewbbacaDb = "${params.root}/assets/cgmlst/streptococcus_pyogenes/alleles_rereffed" - params.coreLociBed = "${params.root}/assets/cgmlst/streptococcus_pyogenes/bed/GCF_900475035.1.bed" - params.trainingFile = "${params.root}/assets/cgmlst/streptococcus_pyogenes/alleles_rereffed/Streptococcus_pyogenes.trn" - params.useVirulenceDbs = [] - params.useSerotypeDbs = [] - params.targetSampleSize = null - } - - streptococcus { - params.species = 'streptococcus' - params.speciesDir = 'streptococcus' - params.mlstScheme = null - params.referenceGenome = null - params.referenceGenomeIdx = null - params.referenceGenomeGff = null - params.chewbbacaDb = "${params.root}/assets/cgmlst/streptococcus/alleles_rereffed" - params.shigapassDb = null - params.coreLociBed = null - params.trainingFile = null - params.useVirulenceDbs = [] - params.useSerotypeDbs = [] - params.targetSampleSize = null - } -} - -process { - executor='slurm' - queue=params.queue - time=1.h - memory='1.GB' - cpus=2 - - withName: add_igv_track { - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] - } - withName: amrfinderplus { - container = "https://depot.galaxyproject.org/singularity/ncbi-amrfinderplus:3.11.11--h6e70893_0" - cpus = 4 - memory = '10.GB' - publishDir = [ path: "${params.outdir}/${params.speciesDir}/amrfinderplus", mode: 'copy', overwrite: true ] - ext.args = "--plus" - } - withName: annotate_delly { - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] - } - withName: assembly_trim_clean { - container = "https://depot.galaxyproject.org/singularity/perl-json:4.10--pl5321hdfd78af_0" - cpus = 4 - memory = '10.GB' - ext.args = "--min_quality 23 --bases_to_trim 400 --min_length 100 -p 1 --nosingletons" - } - withName: bracken { - container = "https://depot.galaxyproject.org/singularity/bracken:2.8--py39hc16433a_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/kraken", mode: 'copy', overwrite: true ] - ext.args = "-r 150" - ext.when = { params.useKraken } - } - withName: bwa_index { - container = "https://depot.galaxyproject.org/singularity/bwakit:0.7.17.dev1--hdfd78af_1" - ext.args = "-M" - } - withName: bwa_mem_dedup { - container = "https://depot.galaxyproject.org/singularity/bwakit:0.7.17.dev1--hdfd78af_1" - cpus = 16 - memory = '20.GB' - ext.args = "-M" - ext.when = true - } - withName: bwa_mem_ref { - container = "https://depot.galaxyproject.org/singularity/bwakit:0.7.17.dev1--hdfd78af_1" - cpus = 16 - memory = '20.GB' - publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] - ext.args = "-M" - ext.when = { params.referenceGenome } - } - withName: chewbbaca_allelecall { - cpus = 16 - memory = '12.GB' - container = "https://depot.galaxyproject.org/singularity/chewbbaca:3.3.2--pyhdfd78af_0" - } - withName: chewbbaca_split_results { - publishDir = [ path: "${params.outdir}/${params.speciesDir}/chewbbaca", mode: 'copy', overwrite: true ] - } - withName: create_analysis_result { - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] - } - withName: create_cdm_input { - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.cdmDir}", mode: 'copy', overwrite: true ] - } - withName: create_yaml { - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/analysis_yaml", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/jasen/${params.speciesDir}", mode: 'copy', overwrite: true ] ] : []) - ext.args_prp = {"${params.outdir}/${params.speciesDir}/analysis_result"} - ext.args_sourmash = {"/access/jasen/${params.speciesDir}/sourmash"} - ext.args_ska = {"/access/jasen/${params.speciesDir}/ska"} - } - withName: emmtyper { - container = "https://depot.galaxyproject.org/singularity/emmtyper:0.2.0--py_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/emmtyper", mode: 'copy', overwrite: true ] - } - withName: export_to_cdm { - publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/qc", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/qc", mode: 'copy', overwrite: true ] ] : []) - } - withName: flye { - container = "https://depot.galaxyproject.org/singularity/flye:2.9.3--py39hd65a603_0" - cpus = 20 - memory = '32.GB' - time=2.h - publishDir = [ path: "${params.outdir}/${params.speciesDir}/flye", mode: 'copy', overwrite: true ] - ext.args = "--threads 40 --genome-size 2.8m --asm-coverage 50" - } - withName: fastqc { - cpus = 4 - container = "https://depot.galaxyproject.org/singularity/freebayes:1.3.6--hbfe0e7f_2" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/fastqc", mode: 'copy', overwrite: true ] - ext.args = "--threads 4" - } - withName: freebayes { - container = "https://depot.galaxyproject.org/singularity/freebayes:1.3.6--hbfe0e7f_2" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] - ext.args = "-C 2 -F 0.2 --pooled-continuous" - } - withName: hostile { - container = "https://depot.galaxyproject.org/singularity/hostile:2.0.0--pyhdfd78af_0" - ext.when = { params.useHostile } - } - withName: kraken { - memory = '100.GB' - cpus = 16 - container = "https://depot.galaxyproject.org/singularity/kraken2:2.1.2--pl5321h9f5acd7_3" - ext.args = "--gzip-compressed" - ext.when = { params.useKraken } - } - withName: mask_polymorph_assembly { - publishDir = [ path: "${params.outdir}/${params.speciesDir}/mask", mode: 'copy', overwrite: true ] - } - withName: medaka { - container = "https://depot.galaxyproject.org/singularity/medaka:1.11.3--py39h05d5c5e_0" - cpus = 20 - memory = '32.GB' - time=2.h - publishDir = [ path: "${params.outdir}/${params.speciesDir}/medaka", mode: 'copy', overwrite: true ] - ext.args = "--threads 40 -m r941_min_sup_g507" - } - withName: mlst { - container = "https://depot.galaxyproject.org/singularity/mlst:2.23.0--hdfd78af_1" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/mlst", mode: 'copy', overwrite: true ] - } - withName: mykrobe { - memory = '4.GB' - container = "https://depot.galaxyproject.org/singularity/mykrobe:0.12.2--py39h70e0db4_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/mykrobe", mode: 'copy', overwrite: true ] - ext.args = "--species tb --format csv" - } - withName: nanoplot { - container = "https://depot.galaxyproject.org/singularity/nanoplot:1.43.0--pyhdfd78af_1" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/nanoplot", mode: 'copy', overwrite: true ] - ext.args = "--threads 8" - } - withName: post_align_qc { - memory = '2.GB' - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/postalignqc", mode: 'copy', overwrite: true ] - } - withName: quast { - container = "https://depot.galaxyproject.org/singularity/quast:5.2.0--py310pl5321hc8f18ef_2" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/quast", mode: 'copy', overwrite: true ] - } - withName: resfinder { - container = "https://depot.galaxyproject.org/singularity/resfinder:4.4.2--pyhdfd78af_1" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/resfinder", mode: 'copy', overwrite: true ] - } - withName: samtools_index_assembly { - cpus = 16 - memory = '2.GB' - container = "https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0" - } - withName: samtools_index_ref { - cpus = 16 - memory = '2.GB' - container = "https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] - } - withName: save_analysis_metadata { - container = "docker://clinicalgenomicslund/bonsai-prp:0.11.4" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_metadata", mode: 'copy', overwrite: true ] - } - withName: sccmec { - container = "https://depot.galaxyproject.org/singularity/sccmec:1.2.0--hdfd78af_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/sccmec", mode: 'copy', overwrite: true ] - } - withName: seqtk_sample { - container = "https://depot.galaxyproject.org/singularity/seqtk:1.4--he4a0461_2" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/seqtk_sample", mode: 'copy', overwrite: true ] - ext.when = { params.targetSampleSize ? true : false } - } - withName: serotypefinder { - cpus = 2 - container = "https://depot.galaxyproject.org/singularity/serotypefinder:2.0.2--py312hdfd78af_1" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/serotypefinder", mode: 'copy', overwrite: true ] - } - withName: shigapass { - cpus = 2 - container = "https://depot.galaxyproject.org/singularity/shigapass:1.5.0--hdfd78af_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/shigapass", mode: 'copy', overwrite: true ] - } - withName: ska_build { - container = "https://depot.galaxyproject.org/singularity/ska2:0.3.10--h4349ce8_0" - cpus = 2 - memory = '10.GB' - publishDir = [ path: "${params.outdir}/${params.speciesDir}/ska", mode: 'copy', overwrite: true ] - ext.args = "-k 31 --threads 1" - } - withName: skesa { - container = "https://depot.galaxyproject.org/singularity/skesa:2.4.0--he1c1bb9_0" - cpus = 16 - memory = '32.GB' - time=2.h - publishDir = [ path: "${params.outdir}/${params.speciesDir}/skesa", mode: 'copy', overwrite: true ] - ext.args = "--cores 16 --memory 32" - ext.when = { params.useSkesa } - } - withName: snippy { - memory = '32.GB' - container = "https://depot.galaxyproject.org/singularity/snippy:4.6.0--hdfd78af_2" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/snippy", mode: 'copy', overwrite: true ] - } - withName: sourmash { - container = "https://depot.galaxyproject.org/singularity/sourmash:4.8.2--hdfd78af_0" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/sourmash", mode: 'copy', overwrite: true ] - ext.args = "-p k=31,k=51,scaled=1000" - } - withName: spades_illumina { - container = "https://depot.galaxyproject.org/singularity/spades:3.15.5--h95f258a_1" - cpus = 16 - memory = '15.GB' - publishDir = [ path: "${params.outdir}/${params.speciesDir}/spades_illumina", mode: 'copy', overwrite: true ] - ext.args = "--isolate" - ext.when = { !params.useSkesa } - } - withName: spades_iontorrent { - container = "https://depot.galaxyproject.org/singularity/spades:3.15.5--h95f258a_1" - cpus = 16 - memory = '15.GB' - publishDir = [ path: "${params.outdir}/${params.speciesDir}/spades_iontorrent", mode: 'copy', overwrite: true ] - ext.args = "--iontorrent --careful --sc" - } - withName: tbprofiler_mergedb { - cpus = 16 - memory = '12.GB' - container = "https://depot.galaxyproject.org/singularity/tb-profiler:6.3.0--pyhdfd78af_0" - publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/tbprofiler_mergedb", mode: 'copy', overwrite: true, pattern: '*.json' ], [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true, pattern: '*.{vcf.gz}' ], [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true, pattern: '*.bam*' ] ] - ext.args = "--external_db ${params.root}/assets/tbdb/converged_who_fohm_tbdb --calling_params '-q 15'" - } - withName: virulencefinder { - cpus = 2 - container = "https://depot.galaxyproject.org/singularity/virulencefinder:2.0.4--hdfd78af_1" - publishDir = [ path: "${params.outdir}/${params.speciesDir}/virulencefinder", mode: 'copy', overwrite: true ] - } -} - -manifest { - homePage = 'https://github.com/genomic-medicine-sweden/jasen' - description = 'Pipeline epitypes numerous bacterial species as well as identifies AMR and virulence genes' - mainScript = 'main.nf' - version = '0.9.0' -} diff --git a/configs/nextflow.ngp.config b/configs/nextflow.ngp.config index 253b1783..34f27748 100644 --- a/configs/nextflow.ngp.config +++ b/configs/nextflow.ngp.config @@ -160,6 +160,7 @@ process { withName: add_igv_track { container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/analysis_result", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: amrfinderplus { container = "${params.containerDir}/ncbi-amrfinderplus.sif" @@ -167,10 +168,12 @@ process { memory = params.mem_medium publishDir = [ path: "${params.outdir}/${params.speciesDir}/amrfinderplus", mode: 'copy', overwrite: true ] ext.args = "--plus" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: annotate_delly { container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: assembly_trim_clean { container = "${params.containerDir}/perl-json.sif" @@ -187,13 +190,14 @@ process { withName: bwa_index { container = "${params.containerDir}/bwakit.sif" ext.args = "-M" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_dedup { container = "${params.containerDir}/bwakit.sif" cpus = params.cpus_large memory = params.mem_large ext.args = "-M" - ext.when = true + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: bwa_mem_ref { container = "${params.containerDir}/bwakit.sif" @@ -201,15 +205,20 @@ process { memory = params.mem_large publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] ext.args = "-M" - ext.when = { params.referenceGenome } + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_allelecall { cpus = params.cpus_large memory = params.mem_large container = "${params.containerDir}/chewbbaca.sif" + ext.when = { params.species != "mycobacterium tuberculosis" } + } + withName: chewbbaca_create_batch_list { + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: chewbbaca_split_results { publishDir = [ path: "${params.outdir}/${params.speciesDir}/chewbbaca", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: create_analysis_result { container = "${params.containerDir}/bonsai-prp.sif" @@ -229,21 +238,33 @@ process { withName: emmtyper { container = "${params.containerDir}/emmtyper.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/emmtyper", mode: 'copy', overwrite: true ] + ext.when = { params.species in ["streptococcus", "streptococcus pyogenes"] } } withName: export_to_cdm { publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/qc", mode: 'copy', overwrite: true ] ] + (params.cronCopy ? [ [ path: "/fs1/results/cron/qc", mode: 'copy', overwrite: true ] ] : []) } withName: fastqc { - cpus = 4 + cpus = params.cpus_small + memory = params.mem_small container = "${params.containerDir}/fastqc.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/fastqc", mode: 'copy', overwrite: true ] ext.args = "--threads 4" } + withName: flye { + container = "${params.containerDir}/flye.sif" + cpus = params.cpus_large + memory = params.mem_large + time=2.h + publishDir = [ path: "${params.outdir}/${params.speciesDir}/flye", mode: 'copy', overwrite: true ] + ext.args = "--threads 40 --genome-size 2.8m --asm-coverage 50" + ext.seqmethod = "--nano-hq" + } withName: freebayes { cpus = params.cpus_small container = "${params.containerDir}/freebayes.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true ] ext.args = "-C 2 -F 0.2 --pooled-continuous" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: hostile { container = "https://depot.galaxyproject.org/singularity/hostile:2.0.0--pyhdfd78af_0" @@ -259,11 +280,12 @@ process { } withName: mask_polymorph_assembly { publishDir = [ path: "${params.outdir}/${params.speciesDir}/mask", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: medaka { container = "${params.containerDir}/medaka.sif" - cpus = 20 - memory = '32.GB' + cpus = params.cpus_large + memory = params.mem_large time=2.h publishDir = [ path: "${params.outdir}/${params.speciesDir}/medaka", mode: 'copy', overwrite: true ] ext.args = "--threads 40 -m r941_min_sup_g507" @@ -271,6 +293,7 @@ process { withName: mlst { container = "${params.containerDir}/mlst.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mlst", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: mykrobe { cpus = params.cpus_medium @@ -278,6 +301,7 @@ process { container = "${params.containerDir}/mykrobe.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/mykrobe", mode: 'copy', overwrite: true ] ext.args = "--species tb --format csv" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: nanoplot { container = "${params.containerDir}/nanoplot.sif" @@ -289,6 +313,7 @@ process { memory = params.mem_small container = "${params.containerDir}/bonsai-prp.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/postalignqc", mode: 'copy', overwrite: true ] + ext.when = { params.species != "streptococcus" } } withName: quast { container = "${params.containerDir}/quast.sif" @@ -297,17 +322,20 @@ process { withName: resfinder { container = "${params.containerDir}/resfinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/resfinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_assembly { cpus = params.cpus_large memory = params.mem_large container = "${params.containerDir}/samtools.sif" + ext.when = { params.species != "mycobacterium tuberculosis" } } withName: samtools_index_ref { cpus = params.cpus_large memory = params.mem_large container = "${params.containerDir}/samtools.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true ] + ext.when = { params.referenceGenome && params.species != "mycobacterium tuberculosis" } } withName: save_analysis_metadata { container = "${params.containerDir}/bonsai-prp.sif" @@ -316,6 +344,7 @@ process { withName: sccmec { container = "${params.containerDir}/sccmec.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/sccmec", mode: 'copy', overwrite: true ] + ext.when = { params.species == "staphylococcus aureus" } } withName: seqtk_sample { container = "${params.containerDir}/seqtk.sif" @@ -326,11 +355,13 @@ process { cpus = params.cpus_small container = "${params.containerDir}/serotypefinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/serotypefinder", mode: 'copy', overwrite: true ] + ext.when = { (params.species in ["escherichia coli", "klebsiella pneumoniae"]) } } withName: shigapass { cpus = params.cpus_small container = "${params.containerDir}/shigapass.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/shigapass", mode: 'copy', overwrite: true ] + ext.when = { params.species == "escherichia coli" } } withName: ska_build { container = "${params.containerDir}/ska2.sif" @@ -353,6 +384,7 @@ process { memory = params.mem_large container = "${params.containerDir}/snippy.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/snippy", mode: 'copy', overwrite: true ] + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: sourmash { container = "${params.containerDir}/sourmash.sif" @@ -380,12 +412,14 @@ process { container = "${params.containerDir}/tb-profiler.sif" publishDir = [ [ path: "${params.outdir}/${params.speciesDir}/tbprofiler_mergedb", mode: 'copy', overwrite: true, pattern: '*.json' ], [ path: "${params.outdir}/${params.speciesDir}/${params.vcfDir}", mode: 'copy', overwrite: true, pattern: '*.{vcf.gz}' ], [ path: "${params.outdir}/${params.speciesDir}/${params.bamDir}", mode: 'copy', overwrite: true, pattern: '*.bam*' ] ] ext.args = "--external_db ${params.root}/assets/tbdb/converged_who_fohm_tbdb --calling_params '-q 15'" + ext.when = { params.species == "mycobacterium tuberculosis" } } withName: virulencefinder { cpus = params.cpus_small memory = params.mem_small container = "${params.containerDir}/virulencefinder.sif" publishDir = [ path: "${params.outdir}/${params.speciesDir}/virulencefinder", mode: 'copy', overwrite: true ] + ext.when = { params.species != "mycobacterium tuberculosis" } } } diff --git a/main.nf b/main.nf index 74ef75a6..e44fce07 100644 --- a/main.nf +++ b/main.nf @@ -10,17 +10,17 @@ include { CALL_STREPTOCOCCUS_PYOGENES } from './workflows/streptococcus_py include { CALL_STREPTOCOCCUS } from './workflows/streptococcus.nf' workflow { - if (workflow.profile == "staphylococcus_aureus") { + if (params.species == "staphylococcus aureus") { CALL_STAPHYLOCOCCUS_AUREUS() - } else if (workflow.profile == "mycobacterium_tuberculosis") { + } else if (params.species == "mycobacterium tuberculosis") { CALL_MYCOBACTERIUM_TUBERCULOSIS() - } else if (workflow.profile == "klebsiella_pneumoniae") { + } else if (params.species == "klebesiella pneumoniae") { CALL_KLEBSIELLA_PNEUMONIAE() - } else if (workflow.profile == "escherichia_coli") { + } else if (params.species == "escherichia coli") { CALL_ESCHERICHIA_COLI() - } else if (workflow.profile == "streptococcus_pyogenes") { + } else if (params.species == "streptococcus pyogenes") { CALL_STREPTOCOCCUS_PYOGENES() - } else if (workflow.profile == "streptococcus") { + } else if (params.species == "streptococcus") { CALL_STREPTOCOCCUS() } } diff --git a/nextflow-modules/modules/amrfinderplus/main.nf b/nextflow-modules/modules/amrfinderplus/main.nf index a9604d13..4769407d 100644 --- a/nextflow-modules/modules/amrfinderplus/main.nf +++ b/nextflow-modules/modules/amrfinderplus/main.nf @@ -13,6 +13,9 @@ process amrfinderplus { tuple val(sample_id), path(output), emit: output path "*versions.yml" , emit: versions + when: + task.ext.when + script: def args = task.ext.args ?: '' def database_arg = database ? "--database ${database}" : "" diff --git a/nextflow-modules/modules/bwa/main.nf b/nextflow-modules/modules/bwa/main.nf index af2b3ef4..6a588e31 100644 --- a/nextflow-modules/modules/bwa/main.nf +++ b/nextflow-modules/modules/bwa/main.nf @@ -10,7 +10,7 @@ process bwa_index { path "*versions.yml" , emit: versions when: - workflow.profile != "mycobacterium_tuberculosis" + task.ext.when script: """ @@ -54,7 +54,7 @@ process bwa_mem { path "*versions.yml" , emit: versions when: - task.ext.when && workflow.profile != "mycobacterium_tuberculosis" + task.ext.when script: def args = task.ext.args ?: '' diff --git a/nextflow-modules/modules/chewbbaca/main.nf b/nextflow-modules/modules/chewbbaca/main.nf index b4973106..111a060a 100644 --- a/nextflow-modules/modules/chewbbaca/main.nf +++ b/nextflow-modules/modules/chewbbaca/main.nf @@ -11,6 +11,9 @@ process chewbbaca_allelecall { path('output_dir/results_alleles.tsv'), emit: calls path "*versions.yml" , emit: versions + when: + task.ext.when + script: def args = task.ext.args ?: '' training_file = training_file ? "--ptf ${training_file}" : "" @@ -54,6 +57,9 @@ process chewbbaca_create_batch_list { output: path "batch_input.list", emit: list + when: + task.ext.when + script: output = "batch_input.list" """ @@ -78,6 +84,9 @@ process chewbbaca_split_results { output: tuple val(sample_id), path(output), emit: output + when: + task.ext.when + script: output = "${sample_id}_chewbbaca.out" """ diff --git a/nextflow-modules/modules/emmtyper/main.nf b/nextflow-modules/modules/emmtyper/main.nf index 28128076..f5e7c0d1 100644 --- a/nextflow-modules/modules/emmtyper/main.nf +++ b/nextflow-modules/modules/emmtyper/main.nf @@ -10,7 +10,7 @@ process emmtyper { path "*versions.yml" , emit: versions when: - workflow.profile in ["streptococcus", "streptococcus_pyogenes"] + task.ext.when script: def args = task.ext.args ?: '' diff --git a/nextflow-modules/modules/fastqc/main.nf b/nextflow-modules/modules/fastqc/main.nf index 3ba0e05d..3fa85b89 100644 --- a/nextflow-modules/modules/fastqc/main.nf +++ b/nextflow-modules/modules/fastqc/main.nf @@ -3,7 +3,7 @@ process fastqc { scratch params.scratch input: - tuple val(sample_id), path(reads) + tuple val(sample_id), path(reads), val(platform) output: tuple val(sample_id), path(summary_output), emit: summary @@ -11,6 +11,9 @@ process fastqc { tuple val(sample_id), path(html_output) , emit: html path "*versions.yml" , emit: versions + when: + platform == "illumina" + script: def args = task.ext.args ?: '' def old_new_pairs = reads instanceof Path || reads.size() == 1 ? [[ reads, "${sample_id}.${reads.extension}" ]] : reads.withIndex().collect { entry, index -> [ entry, "${sample_id}_${index + 1}.${entry.extension}" ] } diff --git a/nextflow-modules/modules/freebayes/main.nf b/nextflow-modules/modules/freebayes/main.nf index 8f66a0c3..9c5b1f59 100644 --- a/nextflow-modules/modules/freebayes/main.nf +++ b/nextflow-modules/modules/freebayes/main.nf @@ -10,6 +10,9 @@ process freebayes { tuple val(sample_id), path(output), emit: vcf path "*versions.yml" , emit: versions + when: + task.ext.when + script: def args = task.ext.args ?: '' output = "${sample_id}_freebayes.vcf" diff --git a/nextflow-modules/modules/mask/main.nf b/nextflow-modules/modules/mask/main.nf index 5c40359d..4ac950a1 100644 --- a/nextflow-modules/modules/mask/main.nf +++ b/nextflow-modules/modules/mask/main.nf @@ -8,6 +8,9 @@ process mask_polymorph_assembly { output: tuple val(sample_id), path(output), emit: fasta + when: + task.ext.when + script: output = "${sample_id}_mask.fasta" """ diff --git a/nextflow-modules/modules/mlst/main.nf b/nextflow-modules/modules/mlst/main.nf index d26b07aa..c68649fe 100644 --- a/nextflow-modules/modules/mlst/main.nf +++ b/nextflow-modules/modules/mlst/main.nf @@ -8,6 +8,9 @@ process mlst { path pbmlst_db path blast_db + when: + task.ext.when + output: tuple val(sample_id), path('*.tsv') , optional: true, emit: tsv tuple val(sample_id), path('*.json') , optional: true, emit: json diff --git a/nextflow-modules/modules/mykrobe/main.nf b/nextflow-modules/modules/mykrobe/main.nf index 21c93c1c..5952f9a7 100644 --- a/nextflow-modules/modules/mykrobe/main.nf +++ b/nextflow-modules/modules/mykrobe/main.nf @@ -10,7 +10,7 @@ process mykrobe { path "*versions.yml" , emit: versions when: - workflow.profile == "mycobacterium_tuberculosis" + task.ext.when script: def args = task.ext.args ?: '' diff --git a/nextflow-modules/modules/prp/main.nf b/nextflow-modules/modules/prp/main.nf index 88f86aea..250bceb4 100644 --- a/nextflow-modules/modules/prp/main.nf +++ b/nextflow-modules/modules/prp/main.nf @@ -117,7 +117,7 @@ process post_align_qc { scratch params.scratch input: - tuple val(sample_id), path(bam) + tuple val(sample_id), path(bam), val(platform) path reference path bed @@ -125,7 +125,7 @@ process post_align_qc { tuple val(sample_id), path(output), emit: qc when: - workflow.profile != "streptococcus" + task.ext.when && platform == "illumina" script: output = "${sample_id}_qc.json" @@ -153,7 +153,7 @@ process annotate_delly { tuple val(sample_id), path(output), emit: vcf when: - workflow.profile == "mycobacterium_tuberculosis" + task.ext.when script: output = "${sample_id}_annotated_delly.vcf" @@ -180,6 +180,9 @@ process add_igv_track { output: tuple val(sample_id), path(output), emit: json + when: + task.ext.when + script: output = "${sample_id}_result.json" """ diff --git a/nextflow-modules/modules/resfinder/main.nf b/nextflow-modules/modules/resfinder/main.nf index b972f511..230ad995 100644 --- a/nextflow-modules/modules/resfinder/main.nf +++ b/nextflow-modules/modules/resfinder/main.nf @@ -17,6 +17,9 @@ process resfinder { path output_point , optional: true, emit: point_table path "*versions.yml" , emit: versions + when: + task.ext.when + script: def resfinder_arg = resfinder_db ? "--acquired --db_path_res ${resfinder_db}" : "" def pointfinder_arg = pointfinder_db ? "--point --db_path_point ${pointfinder_db}" : "" diff --git a/nextflow-modules/modules/samtools/main.nf b/nextflow-modules/modules/samtools/main.nf index 8acd6032..b7146c96 100644 --- a/nextflow-modules/modules/samtools/main.nf +++ b/nextflow-modules/modules/samtools/main.nf @@ -12,7 +12,7 @@ process samtools_view { path "*versions.yml" , emit: versions when: - workflow.profile != "mycobacterium_tuberculosis" + task.ext.when script: def reference_arg = fasta ? "--reference ${fasta} -C" : "" @@ -91,6 +91,9 @@ process samtools_index { tuple val(sample_id), path(output), emit: bai path "*versions.yml" , emit: versions + when: + task.ext.when + script: output = "${input}.bai" """ diff --git a/nextflow-modules/modules/sccmec/main.nf b/nextflow-modules/modules/sccmec/main.nf index f87ea6dc..3b103c03 100644 --- a/nextflow-modules/modules/sccmec/main.nf +++ b/nextflow-modules/modules/sccmec/main.nf @@ -9,6 +9,9 @@ process sccmec { tuple val(sample_id), path(output), emit: tsv path "*versions.yml" , emit: versions + when: + task.ext.when + script: def args = task.ext.args ?: '' output = "${sample_id}_sccmec.tsv" @@ -20,7 +23,7 @@ process sccmec { cat <<-END_VERSIONS > ${sample_id}_${task.process}_versions.yml ${task.process}: sccmec: - version: \$(echo \$(sccmec --version 2>&1) | sed -n 's/.*sccmec_targets, version //p') + version: \$(echo \$(sccmec --version 2>&1) | sed -n 's/.*sccmec_targets, version //p' | sed 's/ .*//') container: ${task.container} END_VERSIONS """ @@ -33,7 +36,7 @@ process sccmec { cat <<-END_VERSIONS > ${sample_id}_${task.process}_versions.yml ${task.process}: sccmec: - version: \$(echo \$(sccmec --version 2>&1) | sed -n 's/.*sccmec_targets, version //p') + version: \$(echo \$(sccmec --version 2>&1) | sed -n 's/.*sccmec_targets, version //p' | sed 's/ .*//') container: ${task.container} END_VERSIONS """ diff --git a/nextflow-modules/modules/serotypefinder/main.nf b/nextflow-modules/modules/serotypefinder/main.nf index 6a4fcf90..025d51a2 100644 --- a/nextflow-modules/modules/serotypefinder/main.nf +++ b/nextflow-modules/modules/serotypefinder/main.nf @@ -13,7 +13,7 @@ process serotypefinder { path "*versions.yml" , emit: versions when: - !(workflow.profile in ["mycobacterium_tuberculosis", "staphylococcus_aureus", "streptococcus", "streptococcus_pyogenes"]) + task.ext.when script: databases_arg = databases ? "--databases ${databases.join(',')}" : "" diff --git a/nextflow-modules/modules/shigapass/main.nf b/nextflow-modules/modules/shigapass/main.nf index bc421c31..bdbeb8e9 100644 --- a/nextflow-modules/modules/shigapass/main.nf +++ b/nextflow-modules/modules/shigapass/main.nf @@ -11,7 +11,7 @@ process shigapass { path "*versions.yml" , emit: versions when: - workflow.profile == "escherichia_coli" + task.ext.when script: shigapass_db_arg = shigapass_db ? "-p ${shigapass_db}" : "-p /usr/local/share/shigapass-1.5.0/db/" diff --git a/nextflow-modules/modules/snippy/main.nf b/nextflow-modules/modules/snippy/main.nf index 1f13a821..82a0c08c 100644 --- a/nextflow-modules/modules/snippy/main.nf +++ b/nextflow-modules/modules/snippy/main.nf @@ -13,7 +13,7 @@ process snippy { path "*versions.yml" , emit: versions when: - workflow.profile == "mycobacterium_tuberculosis" + task.ext.when script: def args = task.ext.args ?: '' @@ -42,7 +42,7 @@ process snippy { """ mkdir ${sample_id} touch ${output} - touch "${sample_id}/snps.{vcf,bed,gff,csv,tab,html,bam,txt}" + touch ${sample_id}/snps.{vcf,bed,gff,csv,tab,html,bam,txt} cat <<-END_VERSIONS > ${sample_id}_${task.process}_versions.yml ${task.process}: diff --git a/nextflow-modules/modules/tbprofiler/main.nf b/nextflow-modules/modules/tbprofiler/main.nf index 3357f08f..c57c00f4 100644 --- a/nextflow-modules/modules/tbprofiler/main.nf +++ b/nextflow-modules/modules/tbprofiler/main.nf @@ -13,7 +13,7 @@ process tbprofiler { path "*versions.yml" , emit: versions when: - workflow.profile == "mycobacterium_tuberculosis" + task.ext.when script: def args = task.ext.args ?: '' diff --git a/nextflow-modules/modules/virulencefinder/main.nf b/nextflow-modules/modules/virulencefinder/main.nf index 525f0fa0..be57ea88 100644 --- a/nextflow-modules/modules/virulencefinder/main.nf +++ b/nextflow-modules/modules/virulencefinder/main.nf @@ -12,6 +12,9 @@ process virulencefinder { tuple val(sample_id), path(meta_output), emit: meta path "*versions.yml" , emit: versions + when: + task.ext.when + script: databases_arg = databases ? "--databases ${databases.join(',')}" : "" output = "${sample_id}_virulencefinder.json" diff --git a/workflows/bacterial_base.nf b/workflows/bacterial_base.nf index 9b293493..b5c23a16 100644 --- a/workflows/bacterial_base.nf +++ b/workflows/bacterial_base.nf @@ -97,11 +97,11 @@ workflow CALL_BACTERIAL_BASE { quast(ch_assembly, referenceGenome) // qc processing - fastqc(ch_reads) + fastqc(ch_reads_w_meta) bwa_mem_ref(ch_reads, referenceGenomeDir) samtools_index_ref(bwa_mem_ref.out.bam) - post_align_qc(bwa_mem_ref.out.bam, referenceGenome, coreLociBed) + post_align_qc(bwa_mem_ref.out.bam.join(ch_meta), referenceGenome, coreLociBed) nanoplot(ch_reads_w_meta) @@ -127,6 +127,7 @@ workflow CALL_BACTERIAL_BASE { bam = bwa_mem_ref.out.bam // channel: [ val(meta), path(bam)] bai = samtools_index_ref.out.bai // channel: [ val(meta), path(bai)] fastqc = fastqc.out.output // channel: [ val(meta), path(txt)] + seqplat_meta = ch_meta // channel: [ val(meta), val(str)] metadata = save_analysis_metadata.out.meta // channel: [ val(meta), path(json)] qc = post_align_qc.out.qc // channel: [ val(meta), path(fasta)] qc_nano = nanoplot.out.html // channel: [ val(meta), path(html)] diff --git a/workflows/escherichia_coli.nf b/workflows/escherichia_coli.nf index ff240219..955320ea 100644 --- a/workflows/escherichia_coli.nf +++ b/workflows/escherichia_coli.nf @@ -60,6 +60,7 @@ workflow CALL_ESCHERICHIA_COLI { CALL_BACTERIAL_BASE.out.quast.set{ch_quast} CALL_BACTERIAL_BASE.out.qc.set{ch_qc} CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata} + CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta} CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta} CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta} CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash} @@ -118,8 +119,10 @@ workflow CALL_ESCHERICHIA_COLI { ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty } + ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty + ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(mlst.out.json) .join(chewbbaca_split_results.out.output) .join(amrfinderplus.out.output) @@ -155,7 +158,7 @@ workflow CALL_ESCHERICHIA_COLI { create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir) ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(chewbbaca_split_results.out.output) .set{ cdmInput } diff --git a/workflows/klebsiella_pneumoniae.nf b/workflows/klebsiella_pneumoniae.nf index bd19746b..401cff52 100644 --- a/workflows/klebsiella_pneumoniae.nf +++ b/workflows/klebsiella_pneumoniae.nf @@ -58,6 +58,7 @@ workflow CALL_KLEBSIELLA_PNEUMONIAE { CALL_BACTERIAL_BASE.out.quast.set{ch_quast} CALL_BACTERIAL_BASE.out.qc.set{ch_qc} CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata} + CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta} CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta} CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta} CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash} @@ -115,8 +116,10 @@ workflow CALL_KLEBSIELLA_PNEUMONIAE { ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty } + ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty + ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(mlst.out.json) .join(chewbbaca_split_results.out.output) .join(amrfinderplus.out.output) @@ -152,7 +155,7 @@ workflow CALL_KLEBSIELLA_PNEUMONIAE { create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir) ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(chewbbaca_split_results.out.output) .set{ cdmInput } diff --git a/workflows/mycobacterium_tuberculosis.nf b/workflows/mycobacterium_tuberculosis.nf index f0633c7c..dbcfd5f0 100644 --- a/workflows/mycobacterium_tuberculosis.nf +++ b/workflows/mycobacterium_tuberculosis.nf @@ -45,6 +45,7 @@ workflow CALL_MYCOBACTERIUM_TUBERCULOSIS { CALL_BACTERIAL_BASE.out.reads.set{ch_reads} CALL_BACTERIAL_BASE.out.quast.set{ch_quast} CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata} + CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta} CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta} CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta} CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash} @@ -63,8 +64,10 @@ workflow CALL_MYCOBACTERIUM_TUBERCULOSIS { ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty } + ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty + ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(ch_empty) .join(ch_empty) .join(ch_empty) @@ -105,7 +108,7 @@ workflow CALL_MYCOBACTERIUM_TUBERCULOSIS { create_yaml(add_grading_bed_track.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir) ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(ch_empty) .set{ cdmInput } diff --git a/workflows/staphylococcus_aureus.nf b/workflows/staphylococcus_aureus.nf index f42d14c3..5fe24754 100644 --- a/workflows/staphylococcus_aureus.nf +++ b/workflows/staphylococcus_aureus.nf @@ -57,6 +57,7 @@ workflow CALL_STAPHYLOCOCCUS_AUREUS { CALL_BACTERIAL_BASE.out.quast.set{ch_quast} CALL_BACTERIAL_BASE.out.qc.set{ch_qc} CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata} + CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta} CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta} CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta} CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash} @@ -114,8 +115,10 @@ workflow CALL_STAPHYLOCOCCUS_AUREUS { ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty } + ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty + ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(mlst.out.json) .join(chewbbaca_split_results.out.output) .join(amrfinderplus.out.output) @@ -151,7 +154,7 @@ workflow CALL_STAPHYLOCOCCUS_AUREUS { create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir) ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(chewbbaca_split_results.out.output) .set{ cdmInput } diff --git a/workflows/streptococcus.nf b/workflows/streptococcus.nf index cda53985..673b401c 100644 --- a/workflows/streptococcus.nf +++ b/workflows/streptococcus.nf @@ -67,6 +67,7 @@ workflow CALL_STREPTOCOCCUS { CALL_BACTERIAL_BASE.out.quast.set{ch_quast} CALL_BACTERIAL_BASE.out.qc.set{ch_qc} CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata} + CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta} CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta} CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta} CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash} @@ -125,9 +126,15 @@ workflow CALL_STREPTOCOCCUS { virulencefinder(ch_reads, params.useVirulenceDbs, virulencefinderDb) ch_reads.map{ sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty } + + if (species == "streptococcus") { + ch_empty.set{ ch_qc_illumina } + } else { + ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty + } ch_quast - .join(ch_empty) + .join(ch_qc_illumina) .join(mlst.out.json) .join(chewbbaca_split_results.out.output) .join(amrfinderplus.out.output) @@ -163,7 +170,7 @@ workflow CALL_STREPTOCOCCUS { create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), speciesDir) ch_quast - .join(ch_empty) + .join(ch_qc_illumina) .join(chewbbaca_split_results.out.output) .set{ cdmInput } diff --git a/workflows/streptococcus_pyogenes.nf b/workflows/streptococcus_pyogenes.nf index 025ab3d8..040f7599 100644 --- a/workflows/streptococcus_pyogenes.nf +++ b/workflows/streptococcus_pyogenes.nf @@ -61,6 +61,7 @@ workflow CALL_STREPTOCOCCUS_PYOGENES { CALL_BACTERIAL_BASE.out.quast.set{ch_quast} CALL_BACTERIAL_BASE.out.qc.set{ch_qc} CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata} + CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta} CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta} CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta} CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash} @@ -118,8 +119,10 @@ workflow CALL_STREPTOCOCCUS_PYOGENES { ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty } + ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty + ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(mlst.out.json) .join(chewbbaca_split_results.out.output) .join(amrfinderplus.out.output) @@ -155,7 +158,7 @@ workflow CALL_STREPTOCOCCUS_PYOGENES { create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), speciesDir) ch_quast - .join(ch_qc) + .join(ch_qc_illumina) .join(chewbbaca_split_results.out.output) .set{ cdmInput }