Skip to content

Commit

Permalink
Merge pull request nf-core#1220 from adamrtalbot/nf-test-init
Browse files Browse the repository at this point in the history
nf-test at the pipeline level
  • Loading branch information
drpatelh authored Feb 23, 2024
2 parents 48663bf + e05cc55 commit 8be7d70
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
*.pyc
.DS_Store
.nextflow*
work/
.nf-test.log
data/
nf-test
.nf-test*
results/
.DS_Store
testing/
test.xml
testing*
*.pyc
testing/
work/
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ lint:
files_unchanged:
- assets/email_template.html
- assets/email_template.txt
- .gitignore
files_exist:
- conf/modules.config
nextflow_config:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [PR #1213](https://github.com/nf-core/rnaseq/pull/1213) - Pass transcriptome fasta through to samtools stats
- [PR #1216](https://github.com/nf-core/rnaseq/pull/1216) - Delocalise catadditionalfasta ([#1162](https://github.com/nf-core/rnaseq/issues/1162))
- [PR #1218](https://github.com/nf-core/rnaseq/pull/1218) - Template update for nf-core/tools v2.13
- [PR #1220](https://github.com/nf-core/rnaseq/pull/1220) - Initialise nf-test and add pipeline level test

### Parameters

Expand Down
12 changes: 12 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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"

profile "test"
}
11 changes: 11 additions & 0 deletions tests/lib/UTILS.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Function to remove Nextflow version from software_versions.yml

class UTILS {
public static String removeNextflowVersion(outputDir) {
def softwareVersions = path("$outputDir/pipeline_info/software_versions.yml").yaml
if (softwareVersions.containsKey("Workflow")) {
softwareVersions.Workflow.remove("Nextflow")
}
return softwareVersions
}
}
39 changes: 39 additions & 0 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
nextflow_pipeline {

name "Test pipeline"
script "../main.nf"
tag "rnaseq"
tag "PIPELINE"

test("Run with profile test") {

when {
params {
outdir = "$outputDir"
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/7f1614baeb0ddf66e60be78c3d9fa55440465ac8/samplesheet/v3.10/samplesheet_test.csv'
}
}

then {
assert workflow.success

assertAll(
{ assert workflow.success },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("single_end_software_versions") },
{ assert snapshot(path("$outputDir/bbsplit/").list(),
path("$outputDir/salmon/").list(),
path("$outputDir/star_salmon/").list(),
path("$outputDir/trimgalore/").list()) },
{ assert new File("$outputDir/fastqc/RAP1_IAA_30M_REP1_1_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/RAP1_IAA_30M_REP1_2_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/RAP1_UNINDUCED_REP1_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/RAP1_UNINDUCED_REP2_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/WT_REP1_1_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/WT_REP1_2_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/WT_REP2_1_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/WT_REP2_2_fastqc.html").exists() },
{ assert new File("$outputDir/multiqc/star_salmon/multiqc_report.html").exists() }
)
}
}
}
12 changes: 12 additions & 0 deletions tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"single_end_software_versions": {
"content": [
"{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}}"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-02-09T16:13:24.846838"
}
}
33 changes: 33 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -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 = 2
memory = 3.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 }

0 comments on commit 8be7d70

Please sign in to comment.