diff --git a/tests/lib/UTILS.groovy b/tests/lib/UTILS.groovy index 1bd58a49..7bd4a9b9 100644 --- a/tests/lib/UTILS.groovy +++ b/tests/lib/UTILS.groovy @@ -8,4 +8,38 @@ class UTILS { } return softwareVersions } + +// Recursively list all files in a directory and its sub-directories, matching a given suffix +// TODO: use regex pattern instead of suffix? +public static getAllFilesFromDir(dir, suffix) { + def output = [] + new File(dir).eachFileRecurse() { + if (it.name.toString().endsWith(suffix)) { + output.add(it) + } + } + return output.sort() +} +// Recursively list all files names in a directory and its sub-directories, matching a given suffix, return file names +public static getAllFileNamesFromDir(dir, suffix) { + def output = [] + new File(dir).eachFileRecurse() { + if (it.name.toString().endsWith(suffix)) { + output.add(it.toString().split("/")[-1]) + } + } + return output.sort() +} + +// Recursively list all files names in a directory and its sub-directories, matching a given suffix, return if check if given string is in file +public static checkAllFilesNamesFromDirForString(dir, suffix, string) { + def output = [] + new File(dir).eachFileRecurse() { + if (it.name.toString().endsWith(suffix)) { + output.add(it.text.contains(string)) + } + } + return output.sort() +} + } diff --git a/workflows/tests/aligner/bwa.nf.test b/workflows/tests/aligner/bwa.nf.test index d5c9cd3d..7ea62bb6 100644 --- a/workflows/tests/aligner/bwa.nf.test +++ b/workflows/tests/aligner/bwa.nf.test @@ -21,23 +21,19 @@ nextflow_pipeline { { assert snapshot(UTILS.removeNextflowVersion("$outputDir/pipeline_info/nf_core_pipeline_software_mqc_versions.yml")).match("software_versions") }, { assert snapshot( workflow.trace.tasks().size(), - // TODO path("$outputDir/preprocessing/fastp/*.json").list(), + UTILS.getAllFilesFromDir("$outputDir/preprocessing/fastp/", ".json"), path("$outputDir/bwa/log").list(), path("$outputDir/bwa/samtools_stats").list(), path("$outputDir/quality_control/bbsplit").list(), - // FIXME Empty - path("$outputDir/quality_control/preseq").list().findAll { it.contains(".txt") }, - // process.out.outs[0][1].findAll { file(it).name.contains('.pb') }, + UTILS.getAllFilesFromDir("$outputDir/quality_control/preseq", ".txt"), path("$outputDir/quality_control/rseqc/read_duplication/xls").list(), path("$outputDir/quality_control/rseqc/read_duplication/rscript").list(), path("$outputDir/quality_control/rseqc/infer_experiment").list(), path("$outputDir/quality_control/rseqc/read_distribution").list(), path("$outputDir/coverage_graphs/").list(), - // FIXME Empty - path("$outputDir/transcript_identification/").list().findAll { file(it.toString()).name.contains('.bed') }, path("$outputDir/transcript_identification/homer/cd4.bed"), path("$outputDir/transcript_identification/homer/jurkat.bed"), - // FIXME path("$outputDir/transcript_identification/pints/").list().findAll(), + // FIXME UTILS.getAllFilesFromDir("$outputDir/transcript_identification/pints/", ".bed"), path("$outputDir/transcript_identification/intersect/").list(), path("$outputDir/transcript_identification/filtered/").list(), // FIXME path("$outputDir/quantification/").list(), diff --git a/workflows/tests/aligner/bwa.nf.test.snap b/workflows/tests/aligner/bwa.nf.test.snap index 91b38b5d..a1ddee51 100644 --- a/workflows/tests/aligner/bwa.nf.test.snap +++ b/workflows/tests/aligner/bwa.nf.test.snap @@ -2,6 +2,14 @@ "output_files": { "content": [ 134, + [ + "cd4_REP1.trimmed.fastp.json:md5,bd9a3344c1591d6be4d524451f9dca53", + "cd4_REP2.trimmed.fastp.json:md5,bc6e3f9ff7835f220535cc393b8eb25f", + "cd4_REP3.trimmed.fastp.json:md5,c9c3a1dd0a2ebac77c9d7c3b0daf3790", + "cd4_REP4.trimmed.fastp.json:md5,c073bd26609ddca91396d0f374ec5b80", + "jurkat_REP1.trimmed.fastp.json:md5,329fd8e56421a196fc2ebd37ab3bc22d", + "jurkat_REP2.trimmed.fastp.json:md5,8bad5b02a27e5386255b998a6a69db15" + ], [ ], @@ -40,7 +48,18 @@ "jurkat_REP2.coverage.stats.txt:md5,b1940346719e4070091f2eef6e508f49" ], [ - + "cd4_REP1.c_curve.txt:md5,cf4743abdd355595d6ec1fb3f38e66e5", + "cd4_REP1.lc_extrap.txt:md5,8633f84ccd5cc725db9af4b33edd63b0", + "cd4_REP2.c_curve.txt:md5,cf4743abdd355595d6ec1fb3f38e66e5", + "cd4_REP2.lc_extrap.txt:md5,3ad9e4028c3711e6d46831c10ed04200", + "cd4_REP3.c_curve.txt:md5,cf4743abdd355595d6ec1fb3f38e66e5", + "cd4_REP3.lc_extrap.txt:md5,25ebbeabee46caa86a4d6d82dd0091f1", + "cd4_REP4.c_curve.txt:md5,cf4743abdd355595d6ec1fb3f38e66e5", + "cd4_REP4.lc_extrap.txt:md5,d0df86774dd54421fd362d46faa3f937", + "jurkat_REP1.c_curve.txt:md5,cf4743abdd355595d6ec1fb3f38e66e5", + "jurkat_REP1.lc_extrap.txt:md5,84faa937faa88476c942f330c5762cb5", + "jurkat_REP2.c_curve.txt:md5,cf4743abdd355595d6ec1fb3f38e66e5", + "jurkat_REP2.lc_extrap.txt:md5,8ae0a77bcc59da38ec2da0fc1f973227" ], [ "cd4_REP1.pos.DupRate.xls:md5,a80db2d20096ca839a7847ec5b11bf75", @@ -111,9 +130,6 @@ "jurkat_REP2.minus.bigWig:md5,686f719978de948f7045acc95f9d1c82", "jurkat_REP2.plus.bedGraph:md5,569e8a25c9cf48d1ef953f3da77c48a1", "jurkat_REP2.plus.bigWig:md5,cbe3fd38fe8f9508645bbfad83924212" - ], - [ - ], "cd4.bed:md5,ab94918610a560772fdbec591200295f", "jurkat.bed:md5,41908723fa423a78476feb2e7627a3a4", @@ -131,7 +147,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-08-09T17:35:32.797123474" + "timestamp": "2024-08-10T12:48:55.984269469" }, "Should work with gzipped references": { "content": [