Skip to content

Commit 8be7d70

Browse files
authored
Merge pull request #1220 from adamrtalbot/nf-test-init
nf-test at the pipeline level
2 parents 48663bf + e05cc55 commit 8be7d70

8 files changed

+117
-4
lines changed

.gitignore

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
*.pyc
2+
.DS_Store
13
.nextflow*
2-
work/
4+
.nf-test.log
35
data/
6+
nf-test
7+
.nf-test*
48
results/
5-
.DS_Store
6-
testing/
9+
test.xml
710
testing*
8-
*.pyc
11+
testing/
12+
work/

.nf-core.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ lint:
33
files_unchanged:
44
- assets/email_template.html
55
- assets/email_template.txt
6+
- .gitignore
67
files_exist:
78
- conf/modules.config
89
nextflow_config:

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- [PR #1213](https://github.com/nf-core/rnaseq/pull/1213) - Pass transcriptome fasta through to samtools stats
1919
- [PR #1216](https://github.com/nf-core/rnaseq/pull/1216) - Delocalise catadditionalfasta ([#1162](https://github.com/nf-core/rnaseq/issues/1162))
2020
- [PR #1218](https://github.com/nf-core/rnaseq/pull/1218) - Template update for nf-core/tools v2.13
21+
- [PR #1220](https://github.com/nf-core/rnaseq/pull/1220) - Initialise nf-test and add pipeline level test
2122

2223
### Parameters
2324

nf-test.config

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
config {
2+
// Location of nf-tests
3+
testsDir "."
4+
5+
// nf-test directory used to create temporary files for each test
6+
workDir System.getenv("NFT_WORKDIR") ?: ".nf-test"
7+
8+
// Location of an optional nextflow.config file specific for executing pipeline tests
9+
configFile "tests/nextflow.config"
10+
11+
profile "test"
12+
}

tests/lib/UTILS.groovy

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Function to remove Nextflow version from software_versions.yml
2+
3+
class UTILS {
4+
public static String removeNextflowVersion(outputDir) {
5+
def softwareVersions = path("$outputDir/pipeline_info/software_versions.yml").yaml
6+
if (softwareVersions.containsKey("Workflow")) {
7+
softwareVersions.Workflow.remove("Nextflow")
8+
}
9+
return softwareVersions
10+
}
11+
}

tests/main.nf.test

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
nextflow_pipeline {
2+
3+
name "Test pipeline"
4+
script "../main.nf"
5+
tag "rnaseq"
6+
tag "PIPELINE"
7+
8+
test("Run with profile test") {
9+
10+
when {
11+
params {
12+
outdir = "$outputDir"
13+
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/7f1614baeb0ddf66e60be78c3d9fa55440465ac8/samplesheet/v3.10/samplesheet_test.csv'
14+
}
15+
}
16+
17+
then {
18+
assert workflow.success
19+
20+
assertAll(
21+
{ assert workflow.success },
22+
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("single_end_software_versions") },
23+
{ assert snapshot(path("$outputDir/bbsplit/").list(),
24+
path("$outputDir/salmon/").list(),
25+
path("$outputDir/star_salmon/").list(),
26+
path("$outputDir/trimgalore/").list()) },
27+
{ assert new File("$outputDir/fastqc/RAP1_IAA_30M_REP1_1_fastqc.html").exists() },
28+
{ assert new File("$outputDir/fastqc/RAP1_IAA_30M_REP1_2_fastqc.html").exists() },
29+
{ assert new File("$outputDir/fastqc/RAP1_UNINDUCED_REP1_fastqc.html").exists() },
30+
{ assert new File("$outputDir/fastqc/RAP1_UNINDUCED_REP2_fastqc.html").exists() },
31+
{ assert new File("$outputDir/fastqc/WT_REP1_1_fastqc.html").exists() },
32+
{ assert new File("$outputDir/fastqc/WT_REP1_2_fastqc.html").exists() },
33+
{ assert new File("$outputDir/fastqc/WT_REP2_1_fastqc.html").exists() },
34+
{ assert new File("$outputDir/fastqc/WT_REP2_2_fastqc.html").exists() },
35+
{ assert new File("$outputDir/multiqc/star_salmon/multiqc_report.html").exists() }
36+
)
37+
}
38+
}
39+
}

tests/main.nf.test.snap

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"single_end_software_versions": {
3+
"content": [
4+
"{BBMAP_BBSPLIT={bbmap=39.01}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, CAT_ADDITIONAL_FASTA={python=3.9.5}, CAT_FASTQ={cat=8.30}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.7, yaml=5.4.1}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DESEQ2_QC_PSEUDO={bioconductor-deseq2=1.28.0, r-base=4.0.3}, DESEQ2_QC_STAR_SALMON={bioconductor-deseq2=1.28.0, r-base=4.0.3}, DUPRADAR={bioconductor-dupradar=1.28.0, r-base=4.2.1}, FASTQC={fastqc=0.12.1}, FQ_SUBSAMPLE={fq=0.9.1 (2022-02-22)}, GTF2BED={perl=5.26.2}, GTF_FILTER={python=3.9.5}, GUNZIP_ADDITIONAL_FASTA={gunzip=1.10}, GUNZIP_GTF={gunzip=1.10}, MULTIQC_CUSTOM_BIOTYPE={python=3.9.5}, PICARD_MARKDUPLICATES={picard=3.0.0}, QUALIMAP_RNASEQ={qualimap=2.3}, RSEQC_BAMSTAT={rseqc=5.0.2}, RSEQC_INFEREXPERIMENT={rseqc=5.0.2}, RSEQC_INNERDISTANCE={rseqc=5.0.2}, RSEQC_JUNCTIONANNOTATION={rseqc=5.0.2}, RSEQC_JUNCTIONSATURATION={rseqc=5.0.2}, RSEQC_READDISTRIBUTION={rseqc=5.0.2}, RSEQC_READDUPLICATION={rseqc=5.0.2}, SALMON_QUANT={salmon=1.10.1}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, SE_GENE={bioconductor-summarizedexperiment=1.24.0, r-base=4.1.1}, STAR_ALIGN={gawk=5.1.0, samtools=1.16.1, star=2.7.9a}, STAR_GENOMEGENERATE={gawk=5.1.0, samtools=1.16.1, star=2.7.9a}, STRINGTIE_STRINGTIE={stringtie=2.2.1}, SUBREAD_FEATURECOUNTS={subread=2.0.1}, TRIMGALORE={cutadapt=3.4, trimgalore=0.6.7}, TX2GENE={python=3.9.5}, TXIMPORT={bioconductor-tximeta=1.12.0, r-base=4.1.1}, UCSC_BEDCLIP={ucsc=377}, UCSC_BEDGRAPHTOBIGWIG={ucsc=445}, UNTAR_SALMON_INDEX={untar=1.30}, Workflow={nf-core/rnaseq=3.15.0dev}}"
5+
],
6+
"meta": {
7+
"nf-test": "0.8.4",
8+
"nextflow": "23.10.1"
9+
},
10+
"timestamp": "2024-02-09T16:13:24.846838"
11+
}
12+
}

tests/nextflow.config

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
========================================================================================
3+
Nextflow config file for running tests
4+
========================================================================================
5+
*/
6+
7+
params {
8+
// Base directory for nf-core/modules test data
9+
modules_testdata_base_path = 's3://ngi-igenomes/testdata/nf-core/modules/'
10+
11+
// Base directory for nf-core/rnaseq test data
12+
pipelines_testdata_base_path = 's3://ngi-igenomes/testdata/nf-core/pipelines/rnaseq/3.15'
13+
}
14+
15+
// Impose sensible resource limits for testing
16+
process {
17+
withName: '.*' {
18+
cpus = 2
19+
memory = 3.GB
20+
time = 2.h
21+
}
22+
}
23+
24+
// Impose same minimum Nextflow version as the pipeline for testing
25+
manifest {
26+
nextflowVersion = '!>=23.04.0'
27+
}
28+
29+
// Disable all Nextflow reporting options
30+
timeline { enabled = false }
31+
report { enabled = false }
32+
trace { enabled = false }
33+
dag { enabled = false }

0 commit comments

Comments
 (0)