diff --git a/main.nf b/main.nf index 7312c29..1e2fa9d 100644 --- a/main.nf +++ b/main.nf @@ -9,8 +9,7 @@ include {READSTOCONTIGS} from './modules/runReadsToContig/runReadsToContig.nf' workflow { - //input specification - + //input specification fastqFiles = channel.fromPath(params.shared.inputFastq, checkIfExists:true) contigs = channel.empty() if(params.r2c.useAssembledContigs) { @@ -33,6 +32,7 @@ workflow { unpaired = channel.empty() if(params.modules.faqcs) { FAQCS(params.faqcs.plus(params.shared), fastqFiles,avgLen) + paired = FAQCS.out.paired.ifEmpty(params.pairedFiles) unpaired = FAQCS.out.unpaired.ifEmpty(params.unpairedFiles) } diff --git a/modules/runFaQCs/runFaQCs.nf b/modules/runFaQCs/runFaQCs.nf index 949858e..4ea188c 100644 --- a/modules/runFaQCs/runFaQCs.nf +++ b/modules/runFaQCs/runFaQCs.nf @@ -1,6 +1,5 @@ #!/usr/bin/env nextflow - //double-checks that any provided adapter file is in FASTA format process adapterFileCheck { label "qc" diff --git a/modules/sra2fastq/sra2fastq.nf b/modules/sra2fastq/sra2fastq.nf index 0cc3e76..04c03d1 100644 --- a/modules/sra2fastq/sra2fastq.nf +++ b/modules/sra2fastq/sra2fastq.nf @@ -10,6 +10,7 @@ process sraDownload { publishDir "${settings["outDir"]}/SRA_Download", mode: 'copy' //retries download in case of transient failure, then completes any downloads that didn't fail + maxRetries 3 errorStrategy { (task.attempt <= maxRetries) ? 'retry' : 'finish' } @@ -49,4 +50,5 @@ workflow SRA2FASTQ { emit: fastq + } \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index d7e944c..c1f8c17 100644 --- a/nextflow.config +++ b/nextflow.config @@ -24,6 +24,7 @@ params { sra2fastq { clean = false + accessions = [] } @@ -39,6 +40,7 @@ params { numN = 2 filtLC = 0.85 filtPhiX = false + } hostRemoval { @@ -139,6 +141,6 @@ executor { submitRateLimit = '1/5sec' } - //cleanup -cleanup = true \ No newline at end of file +cleanup = false + diff --git a/runAntiSmash/Dockerfile b/runAntiSmash/Dockerfile new file mode 100644 index 0000000..692a20d --- /dev/null +++ b/runAntiSmash/Dockerfile @@ -0,0 +1,7 @@ +# syntax=docker/dockerfile:1 +FROM antismash/standalone-lite-nonfree:7.1.0 + +#we override the base image's entrypoint for appropriate interaction with Nextflow +ENTRYPOINT ["/usr/bin/env"] +SHELL ["/bin/bash", "-c"] +CMD /bin/bash \ No newline at end of file diff --git a/runAntiSmash/nextflow.config b/runAntiSmash/nextflow.config new file mode 100644 index 0000000..e3194bc --- /dev/null +++ b/runAntiSmash/nextflow.config @@ -0,0 +1,29 @@ +params { + //defaults + input = null //either contig file or gbk from annotation + projName = "Project" + outDir = "." + numCPU=8 + database = "$projectDir/../../database/antiSMASH" //path to downloaded database location (download-antismash-databases --database-dir ) + //defaults + taxon = 'bacteria' + clusterblast = false + subclusterblast = true + knownclusterblast = true + mibig = false + smcogs = false + pfam2go = false + asf = true + rre = true + fullhmm = false + tigrfam = false + cassis = false //only with fungi +} + +process.container="apwat/sma:0.14" +singularity{ + enabled=true + runOptions="--compat -H $PWD --bind $projectDir/../../database/antiSMASH:$projectDir/../../database/antiSMASH" +} + +cleanup=true \ No newline at end of file diff --git a/runAntiSmash/runAntiSmash.nf b/runAntiSmash/runAntiSmash.nf new file mode 100644 index 0000000..34af481 --- /dev/null +++ b/runAntiSmash/runAntiSmash.nf @@ -0,0 +1,55 @@ + +//runs ANTISMASH on provided .fa or .gbk input. +process antismash { + publishDir( + path: "$params.outDir/AssemblyBasedAnalysis/AntiSmash", + mode: 'copy' + ) + + input: + path input + + output: + path "output/*" + path "antismashLog.txt" + + script: + def taxon = params.taxon.equalsIgnoreCase("fungi") ? "--taxon fungi" : "--taxon bacteria" + def clusterblast = params.clusterblast == true ? "--cb-general" : "" + def subclusterblast = params.subclusterblast == true ? "--cb-subclusters" : "" + def knownclusterblast = params.knownclusterblast == true ? "--cb-knownclusters" : "" + def mibig = params.mibig == true ? "--cc-mibig" : "" + def smcogs = params.smcogs == true ? "--smcog-trees" : "" + def asf = params.asf == true ? "--asf" : "" + def rre = params.rre == true ? "--rre" : "" + def fullhmmer = params.fullhmm == true ? "--fullhmmer" : "" + def tigrfam = params.tigrfam == true ? "--tigrfam" : "" + def pfam2go = params.pfam2go == true ? "--pfam2go" : "" + def genefinding = params.taxon.equalsIgnoreCase("fungi") ? "--genefinding-tool glimmerhmm" : "--genefinding-tool prodigal-m" + def cassis = (params.taxon.equalsIgnoreCase("fungi") && params.cassis == true) ? "--cassis" : "" + + """ + antismash -c $params.numCPU $taxon \ + --logfile antismashLog.txt --output-dir ./output \ + --html-title $params.projName --database $params.database \ + $clusterblast \ + $subclusterblast \ + $knownclusterblast \ + $mibig \ + $smcogs \ + $asf \ + $rre \ + $fullhmmer \ + $tigrfam \ + $pfam2go \ + $cassis \ + $genefinding \ + $input + """ + +} + + +workflow { + antismash(channel.fromPath(params.input,checkIfExists:true)) +} \ No newline at end of file diff --git a/runAntiSmash/test_files/parameters/antismash_all_opts.json b/runAntiSmash/test_files/parameters/antismash_all_opts.json new file mode 100644 index 0000000..842e92d --- /dev/null +++ b/runAntiSmash/test_files/parameters/antismash_all_opts.json @@ -0,0 +1,16 @@ +{ + "numCPU": 4, + "input": "${projectDir}/../test_data/contigs.fa", + "projName": "BasicAntismashTest", + "database": "${projectDir}/../../database/antiSMASH", + "clusterblast": true, + "subclusterblast": true, + "knownclusterblast": true, + "mibig": true, + "smcogs": true, + "pfam2go": true, + "asf": true, + "rre": true, + "fullhmm": true, + "tigrfam": true +} diff --git a/runAntiSmash/test_files/parameters/antismash_basic.json b/runAntiSmash/test_files/parameters/antismash_basic.json new file mode 100644 index 0000000..adaf06b --- /dev/null +++ b/runAntiSmash/test_files/parameters/antismash_basic.json @@ -0,0 +1,6 @@ +{ + "numCPU": 4, + "input": "${projectDir}/../test_data/contigs.fa", + "projName": "BasicAntismashTest", + "database": "${projectDir}/../../database/antiSMASH" +} diff --git a/runAntiSmash/test_files/parameters/antismash_fungi.json b/runAntiSmash/test_files/parameters/antismash_fungi.json new file mode 100644 index 0000000..c8490c9 --- /dev/null +++ b/runAntiSmash/test_files/parameters/antismash_fungi.json @@ -0,0 +1,8 @@ +{ + "numCPU": 4, + "input": "${projectDir}/../test_data/contigs.fa", + "projName": "FungiAntismashTest", + "database": "${projectDir}/../../database/antiSMASH", + "taxon": "fungi", + "cassis": true +} diff --git a/tests/modules/countFastq/countFastq.nf.test b/tests/modules/countFastq/countFastq.nf.test index 8ba3070..50759d1 100644 --- a/tests/modules/countFastq/countFastq.nf.test +++ b/tests/modules/countFastq/countFastq.nf.test @@ -57,6 +57,4 @@ nextflow_workflow { } } - - } diff --git a/tests/modules/countFastq/countFastq.nf.test.snap b/tests/modules/countFastq/countFastq.nf.test.snap index 00b7873..29758af 100644 --- a/tests/modules/countFastq/countFastq.nf.test.snap +++ b/tests/modules/countFastq/countFastq.nf.test.snap @@ -27,6 +27,7 @@ "nextflow": "24.10.3" }, "timestamp": "2025-01-06T13:53:45.128251613" + }, "1 Unpaired File": { "content": [ @@ -35,12 +36,14 @@ "151" ], "1": [ + "all.se.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de" ], "avgReadLen": [ "151" ], "fastqFiles": [ + "all.se.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de" ] } diff --git a/tests/modules/runFaQCs/runFaQCs.nf.test.snap b/tests/modules/runFaQCs/runFaQCs.nf.test.snap index 6433cb5..4b0c5df 100644 --- a/tests/modules/runFaQCs/runFaQCs.nf.test.snap +++ b/tests/modules/runFaQCs/runFaQCs.nf.test.snap @@ -13,6 +13,7 @@ "QC.1.trimmed.fastq:md5,deb773f1726c6134a7d2fc069af7b21b", "QC.2.trimmed.fastq:md5,a793e8ccfe60c0f9462a80d520eecd7a" ] + ] } ], @@ -21,6 +22,7 @@ "nextflow": "24.10.3" }, "timestamp": "2025-01-06T14:15:19.062459705" + }, "Basic SE": { "content": [ @@ -30,6 +32,7 @@ ], "trimmed": [ "QC.unpaired.trimmed.fastq:md5,3a0138c06e9cd504e2cca8e5d93532f1" + ] } ], @@ -38,6 +41,7 @@ "nextflow": "24.10.3" }, "timestamp": "2025-01-06T14:14:24.933787665" + }, "SE with adapter removal": { "content": [ @@ -47,6 +51,7 @@ ], "trimmed": [ "QC.unpaired.trimmed.fastq:md5,3e43d37648eea875f5583f5cfcbb16ca" + ] } ], @@ -55,6 +60,7 @@ "nextflow": "24.10.3" }, "timestamp": "2025-01-06T14:15:03.845678151" + }, "Basic PE": { "content": [ @@ -70,6 +76,7 @@ "QC.1.trimmed.fastq:md5,deb773f1726c6134a7d2fc069af7b21b", "QC.2.trimmed.fastq:md5,a793e8ccfe60c0f9462a80d520eecd7a" ] + ] } ], @@ -78,6 +85,7 @@ "nextflow": "24.10.3" }, "timestamp": "2025-01-06T14:14:13.196766924" + }, "PE with adapter removal": { "content": [ @@ -93,6 +101,7 @@ "QC.1.trimmed.fastq:md5,1e70223f29baaced4509b62a5e84f074", "QC.2.trimmed.fastq:md5,649bf376592b80e9ae1cee81d018a65f" ] + ] } ], diff --git a/tests/modules/sra2fastq/sra2fastq.nf.test b/tests/modules/sra2fastq/sra2fastq.nf.test index 4dc0bd0..6ca3375 100644 --- a/tests/modules/sra2fastq/sra2fastq.nf.test +++ b/tests/modules/sra2fastq/sra2fastq.nf.test @@ -91,5 +91,4 @@ nextflow_workflow { } } - } diff --git a/tests/modules/sra2fastq/sra2fastq.nf.test.snap b/tests/modules/sra2fastq/sra2fastq.nf.test.snap index 6baf701..af7e1d5 100644 --- a/tests/modules/sra2fastq/sra2fastq.nf.test.snap +++ b/tests/modules/sra2fastq/sra2fastq.nf.test.snap @@ -23,6 +23,7 @@ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ], "fastq": [ + "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ] } @@ -48,6 +49,5 @@ "nf-test": "0.9.2", "nextflow": "24.10.3" }, - "timestamp": "2025-01-06T14:20:03.994730963" } } \ No newline at end of file diff --git a/tests/nextflow.config b/tests/nextflow.config index 679f97f..77b6402 100644 --- a/tests/nextflow.config +++ b/tests/nextflow.config @@ -4,4 +4,5 @@ ======================================================================================== */ -cleanup = false //necessary to compare snapshotted files \ No newline at end of file +cleanup = false //necessary to compare snapshotted files +