Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UMICollapse module: Drop external dependencies from UMICollapse module tests #7075

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading