diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 3a049c4..6314c1a 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -19,16 +19,16 @@ jobs: java-version: '17' distribution: 'adopt' - - name: Set up Apptainer 1.3.0 + - name: Set up Apptainer 1.3.6 uses: eWaterCycle/setup-apptainer@v2 with: - apptainer-version: 1.3.0 + apptainer-version: 1.3.6 - name: Setup Nextflow 24.10.1 uses: nf-core/setup-nextflow@v1 with: - version: "24.10.1" + version: "24.10.3" - name: Install nf-test run: | diff --git a/main.nf b/main.nf index eb5a500..1e2fa9d 100644 --- a/main.nf +++ b/main.nf @@ -9,30 +9,30 @@ include {READSTOCONTIGS} from './modules/runReadsToContig/runReadsToContig.nf' workflow { - //input specification - - pairedFiles = channel.fromPath(params.pairedFiles, checkIfExists:true) - unpairedFiles = channel.fromPath(params.unpairedFiles, checkIfExists:true) + //input specification + fastqFiles = channel.fromPath(params.shared.inputFastq, checkIfExists:true) contigs = channel.empty() if(params.r2c.useAssembledContigs) { - contigs = channel.fromPath(params.inputContigs, checkIfExists:true) + contigs = channel.fromPath(params.shared.inputContigs, checkIfExists:true) } + if(params.modules.sra2fastq) { SRA2FASTQ(params.sra2fastq.plus(params.shared)) - pairedFiles = pairedFiles.concat(SRA2FASTQ.out.paired).flatten() - unpairedFiles = unpairedFiles.concat(SRA2FASTQ.out.unpaired).flatten() + fastqFiles = fastqFiles.concat(SRA2FASTQ.out.fastq).flatten() } - COUNTFASTQ(pairedFiles.collect(), unpairedFiles.collect()) + COUNTFASTQ(params.shared, fastqFiles.collect()) avgLen = COUNTFASTQ.out.avgReadLen - paired = COUNTFASTQ.out.paired.ifEmpty(params.pairedFiles) - unpaired = COUNTFASTQ.out.unpaired.ifEmpty(params.unpairedFiles) + fastqFiles = COUNTFASTQ.out.fastqFiles + paired = channel.empty() + unpaired = channel.empty() if(params.modules.faqcs) { - FAQCS(params.faqcs.plus(params.shared),paired,unpaired,avgLen) + 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/countFastq/countFastq.nf b/modules/countFastq/countFastq.nf index 3eb4f80..2c177d1 100644 --- a/modules/countFastq/countFastq.nf +++ b/modules/countFastq/countFastq.nf @@ -3,37 +3,26 @@ process countFastq { label "countFastq" input: - path paired - path unpaired + val settings + path fastq output: path "fastqCount.txt", emit: counts - path "all.{1,2}.fastq", emit: allPaired, optional:true - path "all.se.fastq", emit: allUnpaired, optional:true + path "all.*.fastq", emit: allFiles script: - if(paired.size() > 1 && paired[0] =~ /NO_FILE/) { - paired = paired.tail().join(" ") + file_list = "" + if(settings["pairedFile"]) { + file_list = "-p $fastq" } else { - paired = paired.join(" ") + file_list = "-u $fastq" } - if(unpaired.size() > 1 && unpaired[0] =~ /NO_FILE/) { - unpaired = unpaired.tail().join(" ") - } - else { - unpaired = unpaired.join(" ") - } - - - paired_list = paired.startsWith("NO_FILE") ? "" : "-p ${paired}" - unpaired_list = unpaired.startsWith("NO_FILE2") ? "" : "-u ${unpaired}" """ getAvgLen.pl\ - $paired_list\ - $unpaired_list\ + $file_list\ -d . """ } @@ -70,19 +59,16 @@ process avgLen { //calculates average read length and concatenates input files workflow COUNTFASTQ { take: - pairedFiles - unpairedFiles + settings + inputFastq main: - countFastq(pairedFiles, unpairedFiles) + countFastq(settings, inputFastq) avgReadLen = avgLen(countFastq.out.counts) - paired = countFastq.out.allPaired - unpaired = countFastq.out.allUnpaired - + fastqFiles = countFastq.out.allFiles emit: avgReadLen - paired - unpaired + fastqFiles } \ No newline at end of file diff --git a/modules/hostRemoval/hostRemoval.nf b/modules/hostRemoval/hostRemoval.nf index 3b3083f..0b1986f 100644 --- a/modules/hostRemoval/hostRemoval.nf +++ b/modules/hostRemoval/hostRemoval.nf @@ -35,10 +35,17 @@ process hostRemoval { def prefix = "-prefix ${ref.name.take(ref.name.lastIndexOf('.'))}.clean " def similarity = settings["similarity"] != null ? "-similarity ${settings["similarity"]} " : "" def minScore = settings["bwaMemOptions"] != null ? "${settings["bwaMemOptions"]} " : "-T 50 " - def ontFlag = settings["fastqSource"].equalsIgnoreCase("nanopore") ? "-x ont2d " : "" - ontFlag = settings["fastqSource"].equalsIgnoreCase("pacbio") ? "-x pacbio " : ontFlag + ontFlag = "" + if(settings["fastqSource"] != null) { + if(settings["fastqSource"].equalsIgnoreCase("nanopore")) { + ontFlag = "-x ont2d " + } + else if(settings["fastqSource"].equalsIgnoreCase("pacbio")) { + ontFlag = "-x pacbio " + } + } minScore = ontFlag != "" ? "-T ${settings["minLen"]} " : minScore - def bwaMemOptions = "-bwaMemOptions \"${ontFlag} ${minScore}\" " + bwaMemOptions = "-bwaMemOptions \"${ontFlag} ${minScore}\" " def cpu = settings["cpus"] != null ? "-cpu ${settings["cpus"]} " : "" """ diff --git a/modules/runFaQCs/runFaQCs.nf b/modules/runFaQCs/runFaQCs.nf index e0e6fb9..4ea188c 100644 --- a/modules/runFaQCs/runFaQCs.nf +++ b/modules/runFaQCs/runFaQCs.nf @@ -1,49 +1,5 @@ #!/usr/bin/env nextflow -//plotting for trimmed reads from ONT -process nanoplot { - label "qc" - publishDir( - path: "${settings["outDir"]}/QcReads", - mode: 'copy' - ) - input: - val settings - path unpaired - - output: - path "*" //lots of output plots - - script: - """ - NanoPlot --fastq $unpaired --N50 --loglength -t ${settings["cpus"]} -f pdf --outdir . 2>/dev/null - """ - -} - - -//Porechop for removing adapters from ONT or PacBio reads -process porechop { - label "qc" - publishDir( - path: "${settings["outDir"]}/QcReads", - mode: 'copy' - ) - - - input: - val settings - path trimmed - path log - output: - path "*.porechop.fastq", emit: porechopped - - script: - """ - porechop -i $trimmed -o ./QC.unpaired.porechop.fastq -t ${settings["cpus"]} > $log - """ -} - //double-checks that any provided adapter file is in FASTA format process adapterFileCheck { label "qc" @@ -60,8 +16,6 @@ process adapterFileCheck { } //main QC process. puts parameters together and runs FaQCs. -//EDGE currently uses a custom script (illumina_fastq_QC.pl) to handle QC for long reads, -//but it was unable to create report files when I attempted using it. For now, all input reads go through FaQCs. process qc { label "qc" publishDir( @@ -71,8 +25,7 @@ process qc { input: val settings - path paired - path unpaired + path fastq val validAdapter path adapter val avgLen @@ -86,20 +39,15 @@ process qc { script: //adjust minLength - def min = settings["minLength"] - if(settings["minLength"] < 1) { - min = Math.abs(settings["minLength"] * avgLen.toInteger()) + def min = settings["minLen"] + if(settings["minLen"] < 1) { + min = Math.abs(settings["minLen"] * avgLen.toInteger()) } def qcSoftware = "FaQCs" - // if(params.ontFlag || params.pacbioFlag) { - // qcSoftware = "illumina_fastq_QC.pl" - // } - def pairedArg = paired.name != "NO_FILE" ? "-1 ${paired[0]} -2 ${paired[1]}" : "" - // if(pairedArg != "" && (params.ontFlag || params.pacbioFlag)) { - // pairedArg = "-p $paired" - // } - def unpairedArg = unpaired.name != "NO_FILE2" ? "-u $unpaired" : "" + + + def inputArg = settings["pairedFile"] ? "-1 ${fastq[0]} -2 ${fastq[1]}" : "-u $fastq" def adapterArg = "" if(adapter.name != "NO_FILE3" && validAdapter == "Yes"){ @@ -107,21 +55,16 @@ process qc { } def polyA = settings["polyA"] ? "--polyA" : "" - def trim = "" - // if(params.ontFlag || params.pacbioFlag) { - // trim = "--trim_only" - // } - def ascii = settings["phredOffset"] != null ? "--ascii ${settings["phredOffset"]}" : "" + def phiX = settings["filtPhiX"] ? "--phiX" : "" """ - $qcSoftware $pairedArg $unpairedArg \ - -q ${settings["qualityCutoff"]} --min_L $min --avg_q ${settings["avgQuality"]} \ - -n ${settings["numN"]} --lc ${settings["lowComplexity"]} --5end ${settings["cut5end"]} --3end ${settings["cut3end"]} \ - --split_size ${settings["splitSize"]} -d . -t ${settings["cpus"]} \ + $qcSoftware $inputArg \ + -q ${settings["trimQual"]} --min_L $min --avg_q ${settings["avgQual"]} \ + -n ${settings["numN"]} --lc ${settings["filtLC"]} --5end ${settings["trim5end"]} --3end ${settings["trim3end"]} \ + --split_size 1000000 -d . -t ${settings["cpus"]} \ $polyA \ - $trim \ $adapterArg \ - $ascii \ + $phiX 1>QC.log 2>&1 """ } @@ -129,41 +72,32 @@ process qc { workflow FAQCS { take: settings - paired - unpaired + fastq avgLen main: //adapter setup - adapter_ch = channel.fromPath(settings["adapter"], checkIfExists:true) + adapter_ch = channel.fromPath(settings["artifactFile"], checkIfExists:true) //checks to see if the provided adapter file is a valid FASTA adapterFileCheck(adapter_ch) //main QC process - qc(settings, paired, unpaired, adapterFileCheck.out, adapter_ch, avgLen) + qc(settings, fastq, adapterFileCheck.out, adapter_ch, avgLen) + + trimmed = channel.empty() + if(settings["pairedFile"]) { + trimmed = qc.out.pairedQC + } + else { + trimmed = qc.out.unpairedQC + } paired = qc.out.pairedQC unpaired = qc.out.unpairedQC - //long read trimming and plotting - if(settings["ontFlag"]) { - nanoplot_ch = channel.empty() - if(settings["porechop"]) { - porechop(settings, unpaired, qc.out.log) - nanoplot(settings, porechop.out.porechopped) - unpaired = porechop.out.porechopped - } - else { - nanoplot(settings, unpaired_ch) - unpaired = porechop.out.porechopped - - } - } - emit: - paired - unpaired + trimmed } \ No newline at end of file diff --git a/modules/sra2fastq/sra2fastq.nf b/modules/sra2fastq/sra2fastq.nf index cac3000..04c03d1 100644 --- a/modules/sra2fastq/sra2fastq.nf +++ b/modules/sra2fastq/sra2fastq.nf @@ -1,5 +1,5 @@ #!/usr/bin/env nextflow -//to run: nextflow [OPT: -log /path/to/log file] run sra2fastq.nf -params-file [JSON parameter file] +//to run: nextflow run sra2fastq.nf -params-file [JSON parameter file] //not supporting filesize or run count restrictions @@ -9,7 +9,8 @@ process sraDownload { tag "$accession" publishDir "${settings["outDir"]}/SRA_Download", mode: 'copy' - //retries download in case of transient failure, then completes any processes that didn't fail + //retries download in case of transient failure, then completes any downloads that didn't fail + maxRetries 3 errorStrategy { (task.attempt <= maxRetries) ? 'retry' : 'finish' } @@ -19,15 +20,14 @@ process sraDownload { val settings output: - path "$accession/${accession}.fastq.gz", emit: unpairedSRA, optional:true - path "$accession/${accession}_{1,2}.fastq.gz", emit: pairedSRA, optional:true + path "$accession/${accession}*.fastq.gz", emit: files path "$accession/${accession}_metadata.txt" path "$accession/sra2fastq_temp/*", optional: true //needed output? script: //conditionally create command-line options based on non-empty parameters, for use in the command below - def clean = settings["clean"] != null ? "--clean True" : "" - def platform_restrict = settings["platformRestrict"] != null ? "--platform_restrict ${settings["platformRestrict"]}" : "" + def clean = settings["clean"] ? "--clean True" : "" + def platform_restrict = settings["fastqSource"] != null ? "--platform_restrict ${settings["fastqSource"]}" : "" //invoke sra2fastq.py with those options """ @@ -46,10 +46,9 @@ workflow SRA2FASTQ { accessions_ch = channel.of(settings["accessions"]) sraDownload(accessions_ch.flatten().unique(), settings) - paired = sraDownload.out.pairedSRA - unpaired = sraDownload.out.unpairedSRA + fastq = sraDownload.out.files emit: - paired - unpaired + fastq + } \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index d05751a..c1f8c17 100644 --- a/nextflow.config +++ b/nextflow.config @@ -1,12 +1,6 @@ params { - //input - //pairedFiles = ["${projectDir}/nf_assets/NO_FILE"] - pairedFiles = ["${projectDir}/test_data/Ecoli_10x.1.fastq","${projectDir}/test_data/Ecoli_10x.2.fastq"] - unpairedFiles = ["${projectDir}/nf_assets/NO_FILE2"] - inputContigs = "${projectDir}/nf_assets/NO_FILE3" - //which modules are run modules { sra2fastq = false @@ -19,37 +13,34 @@ params { //module parameters -- passed directly into subworkflows according to best practices //these are the default values shared { - outDir = "./testing_output" - projName = "PROJECT" + inputFastq = null + inputContigs = "${projectDir}/nf_assets/NO_FILE3" + pairedFile = false + outDir = "EDGE_output" + projName = "Project" cpus = 8 - fastqSource = "Illumina" + fastqSource = null } sra2fastq { - clean = null - platformRestrict = null + clean = false + accessions = [] } faqcs{ - adapter = "${projectDir}/nf_assets/NO_FILE3" - - qualityCutoff = 5 - minLength = 50 - avgQuality = 0 - numN = 10 - lowComplexity = 0.85 - cut3end = 0 - cut5end = 0 - splitSize = 1000000 + trimQual = 20 + trim5end = 0 + trim3end = 0 + trimAdapter = false + trimPolyA = false + artifactFile = "${projectDir}/nf_assets/NO_FILE3" + minLen = 50 + avgQual = 0 + numN = 2 + filtLC = 0.85 + filtPhiX = false - ontFlag = false - pacbioFlag = false - polyA = false - - phredOffset = null - - porechop = false } hostRemoval { @@ -152,3 +143,4 @@ executor { //cleanup cleanup = false + diff --git a/tests/modules/countFastq/countFastq.nf.test b/tests/modules/countFastq/countFastq.nf.test index f2fe2ee..50759d1 100644 --- a/tests/modules/countFastq/countFastq.nf.test +++ b/tests/modules/countFastq/countFastq.nf.test @@ -8,11 +8,13 @@ nextflow_workflow { when { params { - // no special parameters + shared { + pairedFile = false + } } workflow { """ - input[0] = file("${projectDir}/nf_assets/NO_FILE") + input[0] = params.shared input[1] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") """ } @@ -33,38 +35,14 @@ nextflow_workflow { when { params { - // no special parameters + shared { + pairedFile = true + } } workflow { """ - input[0] = [file("${projectDir}/test_data/Ecoli_10x.1.fastq"),file("${projectDir}/test_data/Ecoli_10x.2.fastq")] - input[1] = file("${projectDir}/nf_assets/NO_FILE2") - """ - } - } - - then { - assertAll( - {assert workflow.success}, - {assert snapshot(workflow.out).match()}, - {assert workflow.out.avgReadLen.get(0) == "151"} - ) - - } - - } - - - test("PE and SE files") { - - when { - params { - // no special parameters - } - workflow { - """ - input[0] = [file("${projectDir}/test_data/Ecoli_10x.1.fastq"),file("${projectDir}/test_data/Ecoli_10x.2.fastq")] - input[1] = file("${projectDir}/test_data/Ecoli_10x_copy.1.fastq") + input[0] = params.shared + input[1] = [file("${projectDir}/test_data/Ecoli_10x.1.fastq"),file("${projectDir}/test_data/Ecoli_10x.2.fastq")] """ } } diff --git a/tests/modules/countFastq/countFastq.nf.test.snap b/tests/modules/countFastq/countFastq.nf.test.snap index 17e1500..29758af 100644 --- a/tests/modules/countFastq/countFastq.nf.test.snap +++ b/tests/modules/countFastq/countFastq.nf.test.snap @@ -1,39 +1,4 @@ { - "PE and SE files": { - "content": [ - { - "0": [ - "151" - ], - "1": [ - [ - "all.1.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de", - "all.2.fastq:md5,3b69b59ed5c7111e5d57b900174ef2f6" - ] - ], - "2": [ - "all.se.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de" - ], - "avgReadLen": [ - "151" - ], - "paired": [ - [ - "all.1.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de", - "all.2.fastq:md5,3b69b59ed5c7111e5d57b900174ef2f6" - ] - ], - "unpaired": [ - "all.se.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de" - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-28T13:16:37.86828" - }, "1 Pair of PE files": { "content": [ { @@ -45,29 +10,24 @@ "all.1.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de", "all.2.fastq:md5,3b69b59ed5c7111e5d57b900174ef2f6" ] - ], - "2": [ - ], "avgReadLen": [ "151" ], - "paired": [ + "fastqFiles": [ [ "all.1.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de", "all.2.fastq:md5,3b69b59ed5c7111e5d57b900174ef2f6" ] - ], - "unpaired": [ - ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-28T13:18:00.975139" + "timestamp": "2025-01-06T13:53:45.128251613" + }, "1 Unpaired File": { "content": [ @@ -76,26 +36,22 @@ "151" ], "1": [ - - ], - "2": [ + "all.se.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de" ], "avgReadLen": [ "151" ], - "paired": [ - - ], - "unpaired": [ + "fastqFiles": [ + "all.se.fastq:md5,c9cd5b2586c75c7448674ff3ff5451de" ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-28T13:10:05.310905" + "timestamp": "2025-01-06T13:51:42.65748549" } } \ No newline at end of file diff --git a/tests/modules/runFaQCs/runFaQCs.nf.test b/tests/modules/runFaQCs/runFaQCs.nf.test index 151fb2b..825b2ee 100644 --- a/tests/modules/runFaQCs/runFaQCs.nf.test +++ b/tests/modules/runFaQCs/runFaQCs.nf.test @@ -12,6 +12,7 @@ nextflow_workflow { outDir = "./testing_output" projName = "testFaQCs" cpus = 4 + pairedFile = true } faqcs { //all defaults @@ -21,8 +22,7 @@ nextflow_workflow { """ input[0] = params.faqcs.plus(params.shared) input[1] = [file("${projectDir}/test_data/Ecoli_10x.1.fastq"),file("${projectDir}/test_data/Ecoli_10x.2.fastq")] - input[2] = file("${projectDir}/nf_assets/NO_FILE2") - input[3] = channel.of("151") + input[2] = channel.of("151") """ } } @@ -42,6 +42,7 @@ nextflow_workflow { outDir = "./testing_output" projName = "testFaQCs" cpus = 4 + pairedFile = false } faqcs { //all defaults @@ -50,72 +51,8 @@ nextflow_workflow { workflow { """ input[0] = params.faqcs.plus(params.shared) - input[1] = [file("${projectDir}/nf_assets/NO_FILE")] - input[2] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") - input[3] = channel.of("151") - """ - } - } - - then { - assert workflow.success - assert snapshot(workflow.out).match() - } - - } - - test("Nanopore SE (porechop/nanoplot)") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "testFaQCs" - cpus = 4 - } - faqcs { - ontFlag = true - porechop = true - } - } - workflow { - """ - input[0] = params.faqcs.plus(params.shared) - input[1] = [file("${projectDir}/nf_assets/NO_FILE")] - input[2] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") - input[3] = channel.of("151") - """ - } - } - - then { - assert workflow.success - assert snapshot(workflow.out).match() - } - - } - - - test("PacBio SE (nanoplot)") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "testFaQCs" - cpus = 4 - } - faqcs { - pacbioFlag = true - porechop = true - } - } - workflow { - """ - input[0] = params.faqcs.plus(params.shared) - input[1] = [file("${projectDir}/nf_assets/NO_FILE")] - input[2] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") - input[3] = channel.of("151") + input[1] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") + input[2] = channel.of("151") """ } } @@ -135,17 +72,17 @@ nextflow_workflow { outDir = "./testing_output" projName = "testFaQCs" cpus = 4 + pairedFile = true } faqcs { - adapter = "${projectDir}/test_data/adapters.fasta" + artifactFile = "${projectDir}/test_data/adapters.fasta" } } workflow { """ input[0] = params.faqcs.plus(params.shared) input[1] = [file("${projectDir}/test_data/Ecoli_10x.1.fastq"),file("${projectDir}/test_data/Ecoli_10x.2.fastq")] - input[2] = file("${projectDir}/nf_assets/NO_FILE2") - input[3] = channel.of("151") + input[2] = channel.of("151") """ } } @@ -165,17 +102,17 @@ nextflow_workflow { outDir = "./testing_output" projName = "testFaQCs" cpus = 4 + pairedFile = false } faqcs { - adapter = "${projectDir}/test_data/adapters.fasta" + artifactFile = "${projectDir}/test_data/adapters.fasta" } } workflow { """ input[0] = params.faqcs.plus(params.shared) - input[1] = [file("${projectDir}/nf_assets/NO_FILE")] - input[2] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") - input[3] = channel.of("151") + input[1] = file("${projectDir}/test_data/Ecoli_10x.1.fastq") + input[2] = channel.of("151") """ } } @@ -195,6 +132,7 @@ nextflow_workflow { outDir = "./testing_output" projName = "testFaQCs" cpus = 4 + pairedFile = true } faqcs { polyA = true @@ -204,8 +142,7 @@ nextflow_workflow { """ input[0] = params.faqcs.plus(params.shared) input[1] = [file("${projectDir}/test_data/Ecoli_10x.1.fastq"),file("${projectDir}/test_data/Ecoli_10x.2.fastq")] - input[2] = file("${projectDir}/nf_assets/NO_FILE2") - input[3] = channel.of("151") + input[2] = channel.of("151") """ } } diff --git a/tests/modules/runFaQCs/runFaQCs.nf.test.snap b/tests/modules/runFaQCs/runFaQCs.nf.test.snap index a2374bf..4b0c5df 100644 --- a/tests/modules/runFaQCs/runFaQCs.nf.test.snap +++ b/tests/modules/runFaQCs/runFaQCs.nf.test.snap @@ -1,181 +1,114 @@ { - "Nanopore SE (porechop/nanoplot)": { - "content": [ - { - "0": [ - - ], - "1": [ - "QC.unpaired.porechop.fastq:md5,b8cdcb5e1eef7bdd518ef4e0a76dc63b" - ], - "paired": [ - - ], - "unpaired": [ - "QC.unpaired.porechop.fastq:md5,b8cdcb5e1eef7bdd518ef4e0a76dc63b" - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-29T09:06:54.716065" - }, - "PacBio SE (nanoplot)": { - "content": [ - { - "0": [ - - ], - "1": [ - "QC.unpaired.trimmed.fastq:md5,b8cdcb5e1eef7bdd518ef4e0a76dc63b" - ], - "paired": [ - - ], - "unpaired": [ - "QC.unpaired.trimmed.fastq:md5,b8cdcb5e1eef7bdd518ef4e0a76dc63b" - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-29T09:19:41.968222" - }, "PolyA removal": { "content": [ { "0": [ [ - "QC.1.trimmed.fastq:md5,eb49840329af7e3ed2d52cfb44d019d9", - "QC.2.trimmed.fastq:md5,8dd551b2245f963ffe37b69018284501" + "QC.1.trimmed.fastq:md5,deb773f1726c6134a7d2fc069af7b21b", + "QC.2.trimmed.fastq:md5,a793e8ccfe60c0f9462a80d520eecd7a" ] ], - "1": [ - "QC.unpaired.trimmed.fastq:md5,d696a313f70f88a47f67c18cc75b683d" - ], - "paired": [ + "trimmed": [ [ - "QC.1.trimmed.fastq:md5,eb49840329af7e3ed2d52cfb44d019d9", - "QC.2.trimmed.fastq:md5,8dd551b2245f963ffe37b69018284501" + "QC.1.trimmed.fastq:md5,deb773f1726c6134a7d2fc069af7b21b", + "QC.2.trimmed.fastq:md5,a793e8ccfe60c0f9462a80d520eecd7a" ] - ], - "unpaired": [ - "QC.unpaired.trimmed.fastq:md5,d696a313f70f88a47f67c18cc75b683d" + ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-29T09:08:42.429862" + "timestamp": "2025-01-06T14:15:19.062459705" + }, "Basic SE": { "content": [ { "0": [ - + "QC.unpaired.trimmed.fastq:md5,3a0138c06e9cd504e2cca8e5d93532f1" ], - "1": [ - "QC.unpaired.trimmed.fastq:md5,b8cdcb5e1eef7bdd518ef4e0a76dc63b" - ], - "paired": [ - - ], - "unpaired": [ - "QC.unpaired.trimmed.fastq:md5,b8cdcb5e1eef7bdd518ef4e0a76dc63b" + "trimmed": [ + "QC.unpaired.trimmed.fastq:md5,3a0138c06e9cd504e2cca8e5d93532f1" + ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-29T09:00:43.702411" + "timestamp": "2025-01-06T14:14:24.933787665" + }, "SE with adapter removal": { "content": [ { "0": [ - - ], - "1": [ - "QC.unpaired.trimmed.fastq:md5,83011948f673aac52bd300d247c2f6fa" - ], - "paired": [ - + "QC.unpaired.trimmed.fastq:md5,3e43d37648eea875f5583f5cfcbb16ca" ], - "unpaired": [ - "QC.unpaired.trimmed.fastq:md5,83011948f673aac52bd300d247c2f6fa" + "trimmed": [ + "QC.unpaired.trimmed.fastq:md5,3e43d37648eea875f5583f5cfcbb16ca" + ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-29T09:08:11.110565" + "timestamp": "2025-01-06T14:15:03.845678151" + }, "Basic PE": { "content": [ { "0": [ [ - "QC.1.trimmed.fastq:md5,eb49840329af7e3ed2d52cfb44d019d9", - "QC.2.trimmed.fastq:md5,8dd551b2245f963ffe37b69018284501" + "QC.1.trimmed.fastq:md5,deb773f1726c6134a7d2fc069af7b21b", + "QC.2.trimmed.fastq:md5,a793e8ccfe60c0f9462a80d520eecd7a" ] ], - "1": [ - "QC.unpaired.trimmed.fastq:md5,d696a313f70f88a47f67c18cc75b683d" - ], - "paired": [ + "trimmed": [ [ - "QC.1.trimmed.fastq:md5,eb49840329af7e3ed2d52cfb44d019d9", - "QC.2.trimmed.fastq:md5,8dd551b2245f963ffe37b69018284501" + "QC.1.trimmed.fastq:md5,deb773f1726c6134a7d2fc069af7b21b", + "QC.2.trimmed.fastq:md5,a793e8ccfe60c0f9462a80d520eecd7a" ] - ], - "unpaired": [ - "QC.unpaired.trimmed.fastq:md5,d696a313f70f88a47f67c18cc75b683d" + ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-28T14:51:51.359321" + "timestamp": "2025-01-06T14:14:13.196766924" + }, "PE with adapter removal": { "content": [ { "0": [ [ - "QC.1.trimmed.fastq:md5,d23266b2e5e5efdd1e086b54ce02f91b", - "QC.2.trimmed.fastq:md5,5f79a0182d6cb56921a9318a060988b2" + "QC.1.trimmed.fastq:md5,1e70223f29baaced4509b62a5e84f074", + "QC.2.trimmed.fastq:md5,649bf376592b80e9ae1cee81d018a65f" ] ], - "1": [ - "QC.unpaired.trimmed.fastq:md5,d696a313f70f88a47f67c18cc75b683d" - ], - "paired": [ + "trimmed": [ [ - "QC.1.trimmed.fastq:md5,d23266b2e5e5efdd1e086b54ce02f91b", - "QC.2.trimmed.fastq:md5,5f79a0182d6cb56921a9318a060988b2" + "QC.1.trimmed.fastq:md5,1e70223f29baaced4509b62a5e84f074", + "QC.2.trimmed.fastq:md5,649bf376592b80e9ae1cee81d018a65f" ] - ], - "unpaired": [ - "QC.unpaired.trimmed.fastq:md5,d696a313f70f88a47f67c18cc75b683d" + ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-29T09:07:34.857606" + "timestamp": "2025-01-06T14:14:46.464717034" } } \ No newline at end of file diff --git a/tests/modules/sra2fastq/sra2fastq.nf.test b/tests/modules/sra2fastq/sra2fastq.nf.test index 3e9b351..ddaf1a9 100644 --- a/tests/modules/sra2fastq/sra2fastq.nf.test +++ b/tests/modules/sra2fastq/sra2fastq.nf.test @@ -26,105 +26,13 @@ nextflow_workflow { then { assertAll( - {assert workflow.success }, - {assert snapshot(workflow.out).match()} - ) - } - - } - - test("Ensure ILLUMINA platform") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "PROJECT" - cpus = 4 - } - sra2fastq { - platformRestrict = "Illumina" - accessions = ["SRR29462562"] - } - } - workflow { - """ - input[0] = params.sra2fastq.plus(params.shared) - """ - } - } - - then { - assertAll ( {assert workflow.success}, {assert snapshot(workflow.out).match()} ) } } - - test("Ensure not PACBIO_SMRT platform") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "PROJECT" - cpus = 4 - } - sra2fastq { - platformRestrict = "PACBIO_SMRT" - accessions = ["SRR29462562"] - } - } - workflow { - """ - input[0] = params.sra2fastq.plus(params.shared) - """ - } - } - - then { - assertAll( - {assert workflow.success}, - {assert workflow.out.paired.size() == 0}, - {assert workflow.out.unpaired.size() == 0}, - {assert snapshot(workflow.out).match()} - ) - } - - } - test("Ensure not OXFORD_NANOPORE platform") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "PROJECT" - cpus = 4 - } - sra2fastq { - platformRestrict = "OXFORD_NANOPORE" - accessions = ["SRR29462562"] - } - } - workflow { - """ - input[0] = params.sra2fastq.plus(params.shared) - """ - } - } - - then { - assertAll ( - {assert workflow.success}, - {assert workflow.out.paired.size() == 0}, - {assert workflow.out.unpaired.size() == 0}, - {assert snapshot(workflow.out).match()} - ) - } - - } + test("Only Download Unique Accessions") { when { @@ -149,8 +57,7 @@ nextflow_workflow { assertAll ( {assert workflow.success}, {assert snapshot(workflow.out).match()}, - {assert workflow.trace.succeeded().size() == 1}, - {assert workflow.out.unpaired.size() == 1} + {assert workflow.out.fastq.size() == 1} ) } @@ -184,66 +91,4 @@ nextflow_workflow { } } - test("Multiple accessions") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "PROJECT" - cpus = 4 - } - sra2fastq { - accessions = ["SRR11241255", "SRX20564104", "SRR29462562", "SRX24960352"] - clean = true - } - } - workflow { - """ - input[0] = params.sra2fastq.plus(params.shared) - """ - } - } - - then { - assertAll ( - {assert workflow.success}, - {assert snapshot(workflow.out).match()}, - {assert workflow.out.unpaired.size() == 2}, - {assert workflow.out.paired.size() == 2} - ) - } - - } - test("Filtered Accessions") { - - when { - params { - shared { - outDir = "./testing_output" - projName = "PROJECT" - cpus = 4 - } - sra2fastq { - accessions = ["SRR11241255", "SRX20564104", "SRR29462562", "SRX24960352", "SRX26473729"] - platformRestrict = "PACBIO_SMRT" - clean = true - } - } - workflow { - """ - input[0] = params.sra2fastq.plus(params.shared) - """ - } - } - - then { - assertAll ( - {assert workflow.success}, - {assert snapshot(workflow.out).match()}, - {assert workflow.out.unpaired.size() == 1} - ) - } - - } } diff --git a/tests/modules/sra2fastq/sra2fastq.nf.test.snap b/tests/modules/sra2fastq/sra2fastq.nf.test.snap index 0f091ec..dc8017c 100644 --- a/tests/modules/sra2fastq/sra2fastq.nf.test.snap +++ b/tests/modules/sra2fastq/sra2fastq.nf.test.snap @@ -1,202 +1,53 @@ { - "Multiple accessions": { - "content": [ - { - "0": [ - [ - "SRX20564104_1.fastq.gz:md5,4e4c4f89c097d782364f55a4828ba4c3", - "SRX20564104_2.fastq.gz:md5,0a56586f63e03fc3c9d2cb26213b80f0" - ], - [ - "SRX24960352_1.fastq.gz:md5,e869779afbd424971f7e41aa342836cc", - "SRX24960352_2.fastq.gz:md5,cb316c949fcb308017bbfe8ff5863752" - ] - ], - "1": [ - "SRR11241255.fastq.gz:md5,2df0fa97a124de8b8d4d939f024bd594", - "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" - ], - "paired": [ - [ - "SRX20564104_1.fastq.gz:md5,4e4c4f89c097d782364f55a4828ba4c3", - "SRX20564104_2.fastq.gz:md5,0a56586f63e03fc3c9d2cb26213b80f0" - ], - [ - "SRX24960352_1.fastq.gz:md5,e869779afbd424971f7e41aa342836cc", - "SRX24960352_2.fastq.gz:md5,cb316c949fcb308017bbfe8ff5863752" - ] - ], - "unpaired": [ - "SRR11241255.fastq.gz:md5,2df0fa97a124de8b8d4d939f024bd594", - "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-23T16:05:34.897015" - }, - "Filtered Accessions": { - "content": [ - { - "0": [ - - ], - "1": [ - "SRX26473729.fastq.gz:md5,64e17afb49765db68336dbc9669f8a0d" - ], - "paired": [ - - ], - "unpaired": [ - "SRX26473729.fastq.gz:md5,64e17afb49765db68336dbc9669f8a0d" - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-23T16:56:11.003119" - }, - "Ensure not OXFORD_NANOPORE platform": { - "content": [ - { - "0": [ - - ], - "1": [ - - ], - "paired": [ - - ], - "unpaired": [ - - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-23T17:03:58.552875" - }, "Only Download Unique Accessions": { "content": [ { "0": [ - - ], - "1": [ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ], - "paired": [ - - ], - "unpaired": [ + "fastq": [ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-23T16:03:32.397274" - }, - "Ensure ILLUMINA platform": { - "content": [ - { - "0": [ - - ], - "1": [ - "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" - ], - "paired": [ - - ], - "unpaired": [ - "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-23T16:01:45.248109" - }, - "Ensure not PACBIO_SMRT platform": { - "content": [ - { - "0": [ - - ], - "1": [ - - ], - "paired": [ - - ], - "unpaired": [ - - ] - } - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" - }, - "timestamp": "2024-10-23T17:03:47.363828" + "timestamp": "2025-01-06T17:32:54.040414641" }, "Clean Output": { "content": [ { "0": [ - - ], - "1": [ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ], - "paired": [ - - ], - "unpaired": [ + "fastq": [ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-23T16:04:16.360353" + "timestamp": "2025-01-06T17:33:53.778426755" }, "Basic workflow": { "content": [ { "0": [ - - ], - "1": [ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ], - "paired": [ - - ], - "unpaired": [ + "fastq": [ "SRR29462562.fastq.gz:md5,31506ee0f339cb6398dd326d5cb23b77" ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2024-10-23T16:01:03.780856" + "timestamp": "2025-01-06T18:04:07.033920358" } } \ No newline at end of file diff --git a/tests/nextflow.config b/tests/nextflow.config index 7e7ba26..77b6402 100644 --- a/tests/nextflow.config +++ b/tests/nextflow.config @@ -4,4 +4,5 @@ ======================================================================================== */ -cleanup = false \ No newline at end of file +cleanup = false //necessary to compare snapshotted files +