Skip to content

Commit

Permalink
UMICollapse module: Drop external dependencies from UMICollapse modul…
Browse files Browse the repository at this point in the history
…e tests (#7075)

* Update the umi-tools dedup tests to use the new test data with UMIs.

* Update umicollapse tests to use the new UMI test data.

* Switch to nf-bam plugin for output validation.

---------

Co-authored-by: Matthias Zepper <[email protected]>
Co-authored-by: Jonathan Manning <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2024
1 parent 06093bb commit 0b27602
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 387 deletions.
226 changes: 77 additions & 149 deletions modules/nf-core/umicollapse/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,18 @@ nextflow_process {
tag "modules"
tag "modules_nfcore"
tag "umicollapse"
tag "umitools/extract"
tag "samtools/index"
tag "bwa/index"
tag "bwa/mem"

test("umicollapse single end test") {
setup{
run("UMITOOLS_EXTRACT"){
script "../../umitools/extract/main.nf"
config "./nextflow_SE.config"
process{
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
]
"""
}
}

run("BWA_INDEX"){
script "../../bwa/index/main.nf"
process{
"""
input[0] = [[ id:'sarscov2'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
"""
}
}
run("BWA_MEM"){
script "../../bwa/mem/main.nf"
process{
"""
input[0] = UMITOOLS_EXTRACT.out.reads
input[1] = BWA_INDEX.out.index
input[2] = [[ id:'sarscov2'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
input[3] = true
"""
}
}
run("SAMTOOLS_INDEX"){
script "../../samtools/index/main.nf"
process{
"""
input[0] = BWA_MEM.out.bam
"""
}
}
}

when {
config "./nextflow_SE.config"
config "./nextflow.config"
process {
"""
input[0] = BWA_MEM.out.bam.join(SAMTOOLS_INDEX.out.bai, by: [0])
input[0] = Channel.of([
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.umi.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.umi.sorted.bam.bai', checkIfExists: true)
])
input[1] = 'bam'
"""
}
Expand All @@ -73,68 +28,24 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.bam,
bam(process.out.bam[0][1]).getSamLinesMD5(),
process.out.versions).match() }
)
}

}

test("umicollapse paired tests") {
setup{
run("UMITOOLS_EXTRACT"){
script "../../umitools/extract/main.nf"
config "./nextflow_PE.config"
process{
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
]
"""
}
}

run("BWA_INDEX"){
script "../../bwa/index/main.nf"
process{
"""
input[0] = [
[ id:'sarscov2'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}
run("BWA_MEM"){
script "../../bwa/mem/main.nf"
process{
"""
input[0] = UMITOOLS_EXTRACT.out.reads
input[1] = BWA_INDEX.out.index
input[2] = [[ id:'sarscov2'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
input[3] = true
"""
}
}
run("SAMTOOLS_INDEX"){
script "../../samtools/index/main.nf"
process{
"""
input[0] = BWA_MEM.out.bam
"""
}
}
}

when {
config "./nextflow_PE.config"
config "./nextflow.config"
process {
"""
input[0] = BWA_MEM.out.bam.join(SAMTOOLS_INDEX.out.bai, by: [0])
input[0] = Channel.of([
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.umi.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.umi.sorted.bam.bai', checkIfExists: true)
])
input[1] = 'bam'
"""
}
Expand All @@ -144,22 +55,22 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.bam,
bam(process.out.bam[0][1]).getSamLinesMD5(),
process.out.versions).match() }
)
}

}

test("umicollapse fastq tests") {
test("umicollapse fastq test (single-end)") {

when {
config "./nextflow_SE.config"
config "./nextflow.config"
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.umi_extract_single.fastq.gz', checkIfExists: true),
[]
]
input[1] = 'fastq'
Expand All @@ -177,61 +88,76 @@ nextflow_process {
}
}

test("umicollapse stub tests") {
options "-stub-run"
setup{
run("UMITOOLS_EXTRACT"){
script "../../umitools/extract/main.nf"
config "./nextflow_PE.config"
process{
test("umicollapse fastq test (paired-end)") {

when {
config "./nextflow.config"
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.umi_extract_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.umi_extract_2.fastq.gz', checkIfExists: true)
]
input[1] = 'fastq'
"""
}
}

run("BWA_INDEX"){
script "../../bwa/index/main.nf"
process{
"""
input[0] = [
[ id:'sarscov2'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}
run("BWA_MEM"){
script "../../bwa/mem/main.nf"
process{
"""
input[0] = UMITOOLS_EXTRACT.out.reads
input[1] = BWA_INDEX.out.index
input[2] = [[ id:'sarscov2'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
input[3] = true
"""
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.fastq,
process.out.versions).match() }
)
}
run("SAMTOOLS_INDEX"){
script "../../samtools/index/main.nf"
process{
"""
input[0] = BWA_MEM.out.bam
"""
}
}

// Stub tests

test("umicollapse single end test - stub") {

options "-stub"

when {
config "./nextflow.config"
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.umi.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.umi.sorted.bam.bai', checkIfExists: true)
])
input[1] = 'bam'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.bam,
process.out.versions).match() }
)
}

}

test("umicollapse paired tests - stub") {

options "-stub"

when {
config "./nextflow_PE.config"
config "./nextflow.config"
process {
"""
input[0] = BWA_MEM.out.bam.join(SAMTOOLS_INDEX.out.bai, by: [0])
input[0] = Channel.of([
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.umi.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.umi.sorted.bam.bai', checkIfExists: true)
])
input[1] = 'bam'
"""
}
Expand All @@ -240,7 +166,9 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.bam,
process.out.versions).match() }
)
}

Expand Down
Loading

0 comments on commit 0b27602

Please sign in to comment.