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

add stub and stub test to chromap, change test names #5872

Merged
merged 8 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
15 changes: 15 additions & 0 deletions modules/nf-core/chromap/chromap/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,19 @@ process CHROMAP_CHROMAP {
END_VERSIONS
"""
}

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}.bed.gz
touch ${prefix}.bam
echo "" | gzip > ${prefix}.tagAlign.gz
echo "" | gzip > ${prefix}.pairs.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
chromap: \$(echo \$(chromap --version 2>&1))
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
}
87 changes: 44 additions & 43 deletions modules/nf-core/chromap/chromap/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ nextflow_process {
tag "chromap/chromap"
tag "chromap/index"

test("test_chromap_chromap_single_end") {

setup {
run("CHROMAP_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = Channel.of([
[:], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
])
"""
}
setup {
run("CHROMAP_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = Channel.of([
[:], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
])
"""
}
}
}

test("sarscov2 - single_end") {

when {
process {
Expand All @@ -51,21 +51,7 @@ nextflow_process {
}
}

test("test_chromap_chromap_paired_end") {

setup {
run("CHROMAP_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = Channel.of([
[:], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
])
"""
}
}
}
test("sarscov2 - paired_end ") {

when {
process {
Expand Down Expand Up @@ -96,21 +82,7 @@ nextflow_process {
}


test("test_chromap_chromap_paired_bam") {

setup {
run("CHROMAP_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = Channel.of([
[:], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
])
"""
}
}
}
test("sarscov2 - paired_end - bam") {

when {
config "./nextflow.config"
Expand Down Expand Up @@ -142,4 +114,33 @@ nextflow_process {
}

}

test("sarscov2 - single_end - stub") {

options "-stub"

when {
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true ], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]
])
input[1] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]])
input[2] = CHROMAP_INDEX.out.index
famosab marked this conversation as resolved.
Show resolved Hide resolved
input[3] = []
input[4] = []
input[5] = []
input[6] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
137 changes: 113 additions & 24 deletions modules/nf-core/chromap/chromap/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
{
"test_chromap_chromap_paired_end": {
"sarscov2 - single_end": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": true
},
"test.bed.gz:md5,c45f5bb1c6eb56359760ce3827bfe3f4"
]
],
"1": [

],
"2": [

],
"3": [

],
"4": [
"versions.yml:md5,80647c2956e504334ad25ce31d33b539"
],
"bam": [

],
"bed": [
[
{
"id": "test",
"single_end": true
},
"test.bed.gz:md5,c45f5bb1c6eb56359760ce3827bfe3f4"
]
],
"pairs": [

],
"tagAlign": [

],
"versions": [
"versions.yml:md5,80647c2956e504334ad25ce31d33b539"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-24T09:14:34.016756"
},
"sarscov2 - paired_end ": {
"content": [
{
"0": [
Expand Down Expand Up @@ -48,21 +101,23 @@
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-05-22T19:08:55.497043"
"timestamp": "2024-06-24T09:18:23.379305"
},
"test_chromap_chromap_paired_bam": {
"versions": {
"content": [
"test.bam"
[
"versions.yml:md5,80647c2956e504334ad25ce31d33b539"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
},
"timestamp": "2024-05-22T19:09:02.957218"
"timestamp": "2024-05-22T19:09:02.94685"
},
"test_chromap_chromap_single_end": {
"sarscov2 - single_end - stub": {
"content": [
{
"0": [
Expand All @@ -71,38 +126,74 @@
"id": "test",
"single_end": true
},
"test.bed.gz:md5,c45f5bb1c6eb56359760ce3827bfe3f4"
"test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [

[
{
"id": "test",
"single_end": true
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [

[
{
"id": "test",
"single_end": true
},
"test.tagAlign.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"3": [

[
{
"id": "test",
"single_end": true
},
"test.pairs.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"4": [
"versions.yml:md5,80647c2956e504334ad25ce31d33b539"
],
"bam": [

[
{
"id": "test",
"single_end": true
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"bed": [
[
{
"id": "test",
"single_end": true
},
"test.bed.gz:md5,c45f5bb1c6eb56359760ce3827bfe3f4"
"test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"pairs": [

[
{
"id": "test",
"single_end": true
},
"test.pairs.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"tagAlign": [

[
{
"id": "test",
"single_end": true
},
"test.tagAlign.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,80647c2956e504334ad25ce31d33b539"
Expand All @@ -111,20 +202,18 @@
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-05-22T19:08:47.822066"
"timestamp": "2024-06-24T09:14:51.782404"
},
"versions": {
"sarscov2 - paired_end - bam": {
"content": [
[
"versions.yml:md5,80647c2956e504334ad25ce31d33b539"
]
"test.bam"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-05-22T19:09:02.94685"
"timestamp": "2024-06-24T09:14:46.389216"
}
}
}
11 changes: 11 additions & 0 deletions modules/nf-core/chromap/index/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,15 @@ process CHROMAP_INDEX {
chromap: \$(echo \$(chromap --version 2>&1))
END_VERSIONS
"""

stub:
def prefix = fasta.baseName
"""
touch ${prefix}.index

cat <<-END_VERSIONS > versions.yml
"${task.process}":
chromap: \$(echo \$(chromap --version 2>&1))
END_VERSIONS
"""
}
23 changes: 22 additions & 1 deletion modules/nf-core/chromap/index/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ nextflow_process {
tag "chromap"
tag "chromap/index"

test("test_chromap_idx") {
test("sarscov2 - fasta") {

when {
process {
Expand All @@ -28,4 +28,25 @@ nextflow_process {
)
}
}

test("sarscov2 - fasta - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]
"""
}
}

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