diff --git a/.gitignore b/.gitignore index bed1df98..4242417a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ eggnog kofam kofamscan eukulele +.nf-test.log +nf-test +.nf-test* diff --git a/CHANGELOG.md b/CHANGELOG.md index a433eddb..5b52f866 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Added` +- [#285](<[https://github.com/nf-core/metatdenovo/pull/285](https://github.com/nf-core/metatdenovo/pull/285)>) added nf-test for default settings. - [#280](<[https://github.com/nf-core/metatdenovo/issues/280](https://github.com/nf-core/metatdenovo/issues/280)>) - Added minid option to bbmap_align module. Now the threshold for mapping a read to a contig is an identity of 0.9. The previous version of nf-core/metatdenovo used the default for BBMap, 0.76. This version might hence give slightly different results than the previous. - [#271](<[https://github.com/nf-core/metatdenovo/issues/271](https://github.com/nf-core/metatdenovo/issues/271)>) - Added flavor to SPADES modules diff --git a/nf-test.config b/nf-test.config new file mode 100644 index 00000000..6f5e2c47 --- /dev/null +++ b/nf-test.config @@ -0,0 +1,10 @@ +config { + // Location of nf-tests + testsDir "." + + // nf-test directory used to create temporary files for each test + workDir System.getenv("NFT_WORKDIR") ?: ".nf-test" + + // Location of an optional nextflow.config file specific for executing pipeline tests + configFile "tests/nextflow.config" +} diff --git a/tests/main.nf.test b/tests/main.nf.test new file mode 100644 index 00000000..761582f0 --- /dev/null +++ b/tests/main.nf.test @@ -0,0 +1,35 @@ +nextflow_pipeline { + name "Test pipeline" + script "../main.nf" + tag "PIPELINE" + + test("Run with profile test") { + + when { + params { + outdir = "$outputDir" + input = 'https://raw.githubusercontent.com/nf-core/test-datasets/metatdenovo/samplesheet/samplesheet.csv' + skip_eukulele = true + skip_eggnog = true + skip_kofamscan = true + } + } + + then { + assert workflow.success + + assertAll( + { assert new File("$outputDir/trimgalore/SAMPLE1_PE_1.fastq.gz_trimming_report.txt").exists() }, + { assert new File("$outputDir/trimgalore/fastqc/SAMPLE1_PE_1_val_1_fastqc.html").exists() }, + { assert new File("$outputDir/megahit/megahit_out/megahit_assembly.log").exists() }, + { assert new File("$outputDir/prodigal/megahit.prodigal.gff.gz").exists() }, + { assert new File("$outputDir/samtools/SAMPLE1_PE.sorted.bam.bai").exists() }, + { assert new File("$outputDir/bbmap/logs/SAMPLE1_PE.bbmap.log").exists() }, + { assert new File("$outputDir/featurecounts/SAMPLE1_PE.featureCounts.txt.summary").exists() }, + { assert new File("$outputDir/summary_tables/megahit.prodigal.counts.tsv.gz").exists() }, + { assert new File("$outputDir/summary_tables/megahit.prodigal.overall_stats.tsv.gz").exists() }, + { assert new File("$outputDir/multiqc/multiqc_report.html").exists() }, + { assert new File("$outputDir/pipeline_info/nf_core_metatdenovo_software_mqc_versions.yml").exists() } + ) + } +} diff --git a/tests/nextflow.config b/tests/nextflow.config new file mode 100644 index 00000000..8087818e --- /dev/null +++ b/tests/nextflow.config @@ -0,0 +1,33 @@ +/* +======================================================================================== + Nextflow config file for running tests +======================================================================================== +*/ + +params { + // Base directory for nf-core/modules test data + modules_testdata_base_path = 's3://ngi-igenomes/testdata/nf-core/modules/' + + // Base directory for nf-core/rnaseq test data + pipelines_testdata_base_path = 's3://ngi-igenomes/testdata/nf-core/pipelines/rnaseq/3.15/' +} + +// Impose sensible resource limits for testing +process { + withName: '.*' { + cpus = 4 + memory = 4.GB + time = 2.h + } +} + +// Impose same minimum Nextflow version as the pipeline for testing +manifest { + nextflowVersion = '!>=23.04.0' +} + +// Disable all Nextflow reporting options +timeline { enabled = false } +report { enabled = false } +trace { enabled = false } +dag { enabled = false }