Skip to content

Commit

Permalink
update tests organization
Browse files Browse the repository at this point in the history
  • Loading branch information
sateeshperi committed Sep 7, 2024
1 parent 1da66a1 commit 5f1a2cd
Show file tree
Hide file tree
Showing 16 changed files with 261 additions and 57 deletions.
2 changes: 0 additions & 2 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ params {
validationSchemaIgnoreParams = 'genomes,igenomes_base,test_data'
}

includeConfig './test_data.config'

process {
withName: PRESEQ_LCEXTRAP {
errorStrategy = 'ignore'
Expand Down
39 changes: 0 additions & 39 deletions conf/test_data.config

This file was deleted.

2 changes: 1 addition & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ params.bwameth_index = getGenomeAttribute('bwameth')
*/

include { METHYLSEQ } from './workflows/methylseq/methylseq'
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome/prepare_genome'
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome/'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_methylseq_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_methylseq_pipeline'

Expand Down
14 changes: 8 additions & 6 deletions nf-test.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ config {
testsDir "."

// nf-test directory including temporary files for each test
workDir "/tmp"

// location of library folder that is added automatically to the classpath
libDir "tests/lib/"
workDir System.getenv("NFT_WORKDIR") ?: ".nf-test"

// location of an optional nextflow.config file specific for executing tests
configFile "nextflow.config"
configFile "tests/nextflow.config"

// run all test with the defined docker profile from the main nextflow.config
profile ""
profile "test"

// load the necessary plugins
plugins {
load "[email protected]"
}
}
File renamed without changes.
33 changes: 33 additions & 0 deletions subworkflows/local/bismark/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
nextflow_workflow {

name "Test Workflow BISMARK"
script "../main.nf"
workflow "BISMARK"

test("Bismark Single-End") {

when {
params {
// define parameters here. Example:
// outdir = "tests/results"
}
workflow {
"""
input[0] = file("test-file.txt") // reads
input[1] = file("test-file.txt") // bismark_index
input[2] = file("test-file.txt") // skip_deduplication
input[3] = file("test-file.txt") // cytosine_report
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(workflow.out).match() }
)
}

}

}
File renamed without changes.
34 changes: 34 additions & 0 deletions subworkflows/local/bwameth/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
nextflow_workflow {

name "Test Workflow BWAMETH"
script "subworkflows/local/bwameth/main.nf"
workflow "BWAMETH"

test("Should run without failures") {

when {
params {
// define parameters here. Example:
// outdir = "tests/results"
}
workflow {
"""
input[0] = file("test-file.txt") // reads
input[1] = file("test-file.txt") // bwameth_index
input[2] = file("test-file.txt") // fasta
input[3] = file("test-file.txt") // fasta_index
input[4] = file("test-file.txt") // skip_deduplication
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(workflow.out).match() }
)
}

}

}
File renamed without changes.
33 changes: 33 additions & 0 deletions subworkflows/local/prepare_genome/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
nextflow_workflow {

name "Test Workflow PREPARE_GENOME"
script "subworkflows/local/prepare_genome/main.nf"
workflow "PREPARE_GENOME"

test("Should run without failures") {

when {
params {
// define parameters here. Example:
// outdir = "tests/results"
}
workflow {
"""
input[0] = file("test-file.txt") // fasta
input[1] = file("test-file.txt") // ch_fasta_index
input[2] = file("test-file.txt") // ch_bismark_index
input[3] = file("test-file.txt") // ch_bwameth_index
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(workflow.out).match() }
)
}

}

}
72 changes: 72 additions & 0 deletions tests/bismark.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "../main.nf"

test("Params: default") {

when {
params {
aligner = "bismark"
save_reference = true
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(path("$outputDir/bismark/deduplicated/Ecoli_1_val_1_bismark_bt2_pe.deduplicated.bam"),
path("$outputDir/bismark/deduplicated/SRR389222_sub1_trimmed_bismark_bt2.deduplicated.bam"),
path("$outputDir/bismark/deduplicated/SRR389222_sub2_trimmed_bismark_bt2.deduplicated.bam"),
path("$outputDir/bismark/deduplicated/SRR389222_sub3_trimmed_bismark_bt2.deduplicated.bam"),
path("$outputDir/bismark/methylation_calls/bedGraph/Ecoli_1_val_1_bismark_bt2_pe.deduplicated.bedGraph.gz"),
path("$outputDir/bismark/methylation_calls/bedGraph/SRR389222_sub1_trimmed_bismark_bt2.deduplicated.bedGraph.gz"),
path("$outputDir/bismark/methylation_calls/bedGraph/SRR389222_sub2_trimmed_bismark_bt2.deduplicated.bedGraph.gz"),
path("$outputDir/bismark/methylation_calls/bedGraph/SRR389222_sub3_trimmed_bismark_bt2.deduplicated.bedGraph.gz"),
path("$outputDir/bismark/methylation_calls/mbias/Ecoli_1_val_1_bismark_bt2_pe.deduplicated.M-bias.txt"),
path("$outputDir/bismark/methylation_calls/mbias/SRR389222_sub1_trimmed_bismark_bt2.deduplicated.M-bias.txt"),
path("$outputDir/bismark/methylation_calls/mbias/SRR389222_sub2_trimmed_bismark_bt2.deduplicated.M-bias.txt"),
path("$outputDir/bismark/methylation_calls/mbias/SRR389222_sub3_trimmed_bismark_bt2.deduplicated.M-bias.txt"),
path("$outputDir/bismark/methylation_calls/methylation_coverage/Ecoli_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz"),
path("$outputDir/bismark/methylation_calls/methylation_coverage/SRR389222_sub1_trimmed_bismark_bt2.deduplicated.bismark.cov.gz"),
path("$outputDir/bismark/methylation_calls/methylation_coverage/SRR389222_sub2_trimmed_bismark_bt2.deduplicated.bismark.cov.gz"),
path("$outputDir/bismark/methylation_calls/methylation_coverage/SRR389222_sub3_trimmed_bismark_bt2.deduplicated.bismark.cov.gz"),
path("$outputDir/bismark/methylation_calls/methylation_calls/").list(),
path("$outputDir/bismark/methylation_calls/splitting_report/Ecoli_1_val_1_bismark_bt2_pe.deduplicated_splitting_report.txt"),
path("$outputDir/bismark/methylation_calls/splitting_report/SRR389222_sub1_trimmed_bismark_bt2.deduplicated_splitting_report.txt"),
path("$outputDir/bismark/methylation_calls/splitting_report/SRR389222_sub2_trimmed_bismark_bt2.deduplicated_splitting_report.txt"),
path("$outputDir/bismark/methylation_calls/splitting_report/SRR389222_sub3_trimmed_bismark_bt2.deduplicated_splitting_report.txt"),
path("$outputDir/bismark/reference_genome/BismarkIndex/").list(),
path("$outputDir/qualimap/Ecoli/genome_results.txt"),
path("$outputDir/qualimap/SRR389222_sub1/genome_results.txt"),
path("$outputDir/qualimap/SRR389222_sub2/genome_results.txt"),
path("$outputDir/qualimap/SRR389222_sub3/genome_results.txt")).match("single_end") },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("single_end_software_versions") },
{ assert new File("$outputDir/bismark/alignments/logs/Ecoli_1_val_1_bismark_bt2_PE_report.txt").exists() },
{ assert new File("$outputDir/bismark/alignments/logs/SRR389222_sub1_trimmed_bismark_bt2_SE_report.txt").exists() },
{ assert new File("$outputDir/bismark/alignments/logs/SRR389222_sub2_trimmed_bismark_bt2_SE_report.txt").exists() },
{ assert new File("$outputDir/bismark/alignments/logs/SRR389222_sub3_trimmed_bismark_bt2_SE_report.txt").exists() },
{ assert new File("$outputDir/bismark/reports/Ecoli_1_val_1_bismark_bt2_PE_report.html").exists() },
{ assert new File("$outputDir/bismark/reports/SRR389222_sub1_trimmed_bismark_bt2_SE_report.html").exists() },
{ assert new File("$outputDir/bismark/reports/SRR389222_sub2_trimmed_bismark_bt2_SE_report.html").exists() },
{ assert new File("$outputDir/bismark/reports/SRR389222_sub3_trimmed_bismark_bt2_SE_report.html").exists() },
{ assert new File("$outputDir/bismark/summary/bismark_summary_report.html").exists() },
{ assert new File("$outputDir/bismark/summary/bismark_summary_report.txt").exists() },
{ assert new File("$outputDir/fastqc/Ecoli_1_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/Ecoli_2_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/SRR389222_sub1_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/SRR389222_sub2_fastqc.html").exists() },
{ assert new File("$outputDir/fastqc/SRR389222_sub3_fastqc.html").exists() },
{ assert new File("$outputDir/multiqc/bismark/multiqc_report.html").exists() },
{ assert new File("$outputDir/trimgalore/logs/Ecoli_1.fastq.gz_trimming_report.txt").exists() },
{ assert new File("$outputDir/trimgalore/logs/Ecoli_2.fastq.gz_trimming_report.txt").exists() },
{ assert new File("$outputDir/trimgalore/logs/SRR389222_sub1.fastq.gz_trimming_report.txt").exists() },
{ assert new File("$outputDir/trimgalore/logs/SRR389222_sub2.fastq.gz_trimming_report.txt").exists() },
{ assert new File("$outputDir/trimgalore/logs/SRR389222_sub3.fastq.gz_trimming_report.txt").exists() }
)
}

}

}
20 changes: 20 additions & 0 deletions tests/bismark_hisat.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "../main.nf"

test("Should run without failures") {

when {
params {
outdir = "$outputDir"
}
}

then {
assert workflow.success
}

}

}
20 changes: 20 additions & 0 deletions tests/bwameth.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "../main.nf"

test("Should run without failures") {

when {
params {
outdir = "$outputDir"
}
}

then {
assert workflow.success
}

}

}
7 changes: 0 additions & 7 deletions tests/config/tags.yml

This file was deleted.

38 changes: 38 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
========================================================================================
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/methylseq/2.7.0/'

fasta = "${params.pipelines_testdata_base_path}/reference/genome.fa"
fasta_index = "${params.pipelines_testdata_base_path}/reference/genome.fa.fai"

validationSchemaIgnoreParams = 'genomes,igenomes_base,modules_testdata_base_path,pipelines_testdata_base_path'
}

// 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 }
4 changes: 2 additions & 2 deletions workflows/methylseq/methylseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ include { validateInputSamplesheet } from '../../subworkflows/local/utils_nfcore

// Aligner: bismark or bismark_hisat
if( params.aligner =~ /bismark/ ){
include { BISMARK } from '../../subworkflows/local/bismark/bismark'
include { BISMARK } from '../../subworkflows/local/bismark/'
}
// Aligner: bwameth
else if ( params.aligner == 'bwameth' ){
include { BWAMETH } from '../../subworkflows/local/bwameth/bwameth'
include { BWAMETH } from '../../subworkflows/local/bwameth/'
}

/*
Expand Down

0 comments on commit 5f1a2cd

Please sign in to comment.