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

Added nf-test for biobambam/bamsormadup #6579

Merged
merged 1 commit into from
Sep 5, 2024
Merged
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
18 changes: 18 additions & 0 deletions modules/nf-core/biobambam/bamsormadup/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,22 @@ process BIOBAMBAM_BAMSORMADUP {
bamsormadup: \$(echo \$(bamsormadup --version 2>&1) | sed 's/^This is biobambam2 version //; s/..biobambam2 is .*\$//' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = args.contains("outputformat=cram") ? "cram" : "bam"
if (args.contains("outputformat=cram") && reference == null) error "Reference required for CRAM output."

"""
touch ${prefix}.${suffix}
touch ${prefix}.metrics.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamcat: \$(echo \$(bamcat --version 2>&1) | sed 's/^This is biobambam2 version //; s/..biobambam2 is .*\$//' )
bamcollate2: \$(echo \$(bamcollate2 --version 2>&1) | sed 's/^This is biobambam2 version //; s/..biobambam2 is .*\$//' )
bamsormadup: \$(echo \$(bamsormadup --version 2>&1) | sed 's/^This is biobambam2 version //; s/..biobambam2 is .*\$//' )
END_VERSIONS
"""
}
105 changes: 105 additions & 0 deletions modules/nf-core/biobambam/bamsormadup/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@

nextflow_process {

name "Test Process BIOBAMBAM_BAMSORMADUP"
script "../main.nf"
process "BIOBAMBAM_BAMSORMADUP"

tag "modules"
tag "modules_nfcore"
tag "biobambam"
tag "biobambam/bamsormadup"

test("test-biobambam-bamsormadup-multi-input") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true)
]
]
input[1] = [[:],[]]

"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
bam(process.out.bam[0][1]).getReadsMD5(),
process.out.bam_index,
process.out.cram,
file(process.out.metrics[0][1]).readLines()[3..5],
process.out.versions
).match()
}
)
}
}

test("test-biobambam-bamsormadup-single-input") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]
]
input[1] = [[:],[]]

"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
bam(process.out.bam[0][1]).getReadsMD5(),
process.out.bam_index,
process.out.cram,
file(process.out.metrics[0][1]).readLines()[3..5],
process.out.versions
).match()
}
)
}
}

test("test-biobambam-bamsormadup-single-input-stub") {

options '-stub'

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]
]
input[1] = [[:],[]]

"""
}
}

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

}
115 changes: 115 additions & 0 deletions modules/nf-core/biobambam/bamsormadup/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"test-biobambam-bamsormadup-single-input": {
"content": [
"e296148e4f68882cc91fb624e392f539",
[

],
[

],
[
"LIBRARY\tUNPAIRED_READS_EXAMINED\tREAD_PAIRS_EXAMINED\tUNMAPPED_READS\tUNPAIRED_READ_DUPLICATES\tREAD_PAIR_DUPLICATES\tREAD_PAIR_OPTICAL_DUPLICATES\tPERCENT_DUPLICATION\tESTIMATED_LIBRARY_SIZE",
"lib1\t3\t97\t3\t0\t0\t0\t0\t-1",
""
],
[
"versions.yml:md5,67ab301f20567acd9d0e648c2a3e158c"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T22:00:39.772883"
},
"test-biobambam-bamsormadup-multi-input": {
"content": [
"3dc03384b330e3f16e15691c9189e890",
[

],
[

],
[
"LIBRARY\tUNPAIRED_READS_EXAMINED\tREAD_PAIRS_EXAMINED\tUNMAPPED_READS\tUNPAIRED_READ_DUPLICATES\tREAD_PAIR_DUPLICATES\tREAD_PAIR_OPTICAL_DUPLICATES\tPERCENT_DUPLICATION\tESTIMATED_LIBRARY_SIZE",
"lib1\t3\t97\t3\t0\t0\t0\t0\t-1",
"testN\t0\t2820\t2\t0\t828\t0\t0.293617\t3807"
],
[
"versions.yml:md5,67ab301f20567acd9d0e648c2a3e158c"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T22:00:31.187999"
},
"test-biobambam-bamsormadup-single-input-stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [

],
"2": [

],
"3": [
[
{
"id": "test",
"single_end": false
},
"test.metrics.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"4": [
"versions.yml:md5,67ab301f20567acd9d0e648c2a3e158c"
],
"bam": [
[
{
"id": "test",
"single_end": false
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"bam_index": [

],
"cram": [

],
"metrics": [
[
{
"id": "test",
"single_end": false
},
"test.metrics.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,67ab301f20567acd9d0e648c2a3e158c"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T21:57:13.430982"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ bedtools/intersect:
bedtools/unionbedg:
- modules/nf-core/bedtools/unionbedg/**
- tests/modules/nf-core/bedtools/unionbedg/**
biobambam/bamsormadup:
- modules/nf-core/biobambam/bamsormadup/**
- tests/modules/nf-core/biobambam/bamsormadup/**
biohansel:
- modules/nf-core/biohansel/**
- tests/modules/nf-core/biohansel/**
Expand Down
25 changes: 0 additions & 25 deletions tests/modules/nf-core/biobambam/bamsormadup/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/biobambam/bamsormadup/nextflow.config

This file was deleted.

23 changes: 0 additions & 23 deletions tests/modules/nf-core/biobambam/bamsormadup/test.yml

This file was deleted.

Loading