Skip to content

Commit

Permalink
stubs and test for rnaseq modules - part I (#5854)
Browse files Browse the repository at this point in the history
* stubs and test for bbmap_bbsplit

* add test for index

* add stubs for custom/catadditionalfasta

* add stubs for fq/subsample

* add stubs for hisat2/extractsplicesites

* update fastq_align_hisat2 snapshot

* add stubs for hisat2/build

* add stubs for hisat2/align

* more stubs bbmap/bbsplit

* add stubs for preseq/lcextrap

* more stubs for fq/subsample

* proper stubs for hisat2/align

* remove old snaps
  • Loading branch information
maxulysse authored Jun 21, 2024
1 parent 6c2309a commit 2c6b114
Show file tree
Hide file tree
Showing 22 changed files with 1,744 additions and 62 deletions.
19 changes: 19 additions & 0 deletions modules/nf-core/bbmap/bbsplit/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,23 @@ process BBMAP_BBSPLIT {
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def other_refs = ''
other_ref_names.eachWithIndex { name, index ->
other_refs += "echo '' | gzip > ${prefix}_primary_${name}.fastq.gz"
}
"""
mkdir bbsplit
echo '' | gzip > ${prefix}_primary.fastq.gz
${other_refs}
touch ${prefix}.stats.txt
touch ${prefix}.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bbmap: \$(bbversion.sh | grep -v "Duplicate cpuset")
END_VERSIONS
"""
}
93 changes: 93 additions & 0 deletions modules/nf-core/bbmap/bbsplit/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,66 @@ nextflow_process {
tag "bbmap"
tag "bbmap/bbsplit"

test("sarscov2_se_fastq_fasta_chr22_fasta - index") {

when {
params {
outdir = "$outputDir"
}
process {
"""
input[0] = [[:],[]]
input[1] = []
input[2] = Channel.of(file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true))
input[3] = Channel.of([
[ 'human' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr22/sequence/chr22_23800000-23980000.fa', checkIfExists: true)
])
input[4] = true
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path("${process.out.index[0]}").exists() },
{ assert path(process.out.log[0][1]).text.contains("No index available") },
{ assert snapshot(process.out.versions).match() }
)
}
}

test("sarscov2_se_fastq_fasta_chr22_fasta - index - stub") {

options "-stub"

when {
params {
outdir = "$outputDir"
}
process {
"""
input[0] = [[:],[]]
input[1] = []
input[2] = Channel.of(file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true))
input[3] = Channel.of([
[ 'human' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr22/sequence/chr22_23800000-23980000.fa', checkIfExists: true)
])
input[4] = true
"""
}
}

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

test("sarscov2_se_fastq_fasta_chr22_fasta") {

setup {
Expand Down Expand Up @@ -88,4 +148,37 @@ nextflow_process {
)
}
}

test("sarscov2_se_fastq_fasta_chr22_fasta - stub") {

options "-stub"

when {
params {
outdir = "$outputDir"
}
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] = []
input[2] = Channel.of(file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true))
input[3] = Channel.of([
[ 'human' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr22/sequence/chr22_23800000-23980000.fa', checkIfExists: true)
])
input[4] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
228 changes: 227 additions & 1 deletion modules/nf-core/bbmap/bbsplit/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,231 @@
"nextflow": "23.10.1"
},
"timestamp": "2024-02-01T17:11:22.441753642"
},
"sarscov2_se_fastq_fasta_chr22_fasta - index": {
"content": [
[
"versions.yml:md5,cb7f0e697ab2537f8ced951bfade90d4"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-20T16:41:29.784895"
},
"sarscov2_se_fastq_fasta_chr22_fasta - index - stub": {
"content": [
{
"0": [
[

]
],
"1": [
[
{

},
[
"null_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"null_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"2": [
[
{

},
[
"null_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"null_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"3": [
[
{

},
"null.stats.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"4": [
[
{

},
"null.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"5": [
"versions.yml:md5,cb7f0e697ab2537f8ced951bfade90d4"
],
"all_fastq": [
[
{

},
[
"null_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"null_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"index": [
[

]
],
"log": [
[
{

},
"null.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"primary_fastq": [
[
{

},
[
"null_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"null_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"stats": [
[
{

},
"null.stats.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,cb7f0e697ab2537f8ced951bfade90d4"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-20T18:49:27.280432"
},
"sarscov2_se_fastq_fasta_chr22_fasta - stub": {
"content": [
{
"0": [
[

]
],
"1": [
[
{
"id": "test",
"single_end": true
},
[
"test_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"2": [
[
{
"id": "test",
"single_end": true
},
[
"test_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"3": [
[
{
"id": "test",
"single_end": true
},
"test.stats.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"4": [
[
{
"id": "test",
"single_end": true
},
"test.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"5": [
"versions.yml:md5,cb7f0e697ab2537f8ced951bfade90d4"
],
"all_fastq": [
[
{
"id": "test",
"single_end": true
},
[
"test_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"index": [
[

]
],
"log": [
[
{
"id": "test",
"single_end": true
},
"test.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"primary_fastq": [
[
{
"id": "test",
"single_end": true
},
[
"test_primary.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_primary_human.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"stats": [
[
{
"id": "test",
"single_end": true
},
"test.stats.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,cb7f0e697ab2537f8ced951bfade90d4"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-20T16:16:05.793544"
}
}
}
13 changes: 13 additions & 0 deletions modules/nf-core/custom/catadditionalfasta/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,17 @@ process CUSTOM_CATADDITIONALFASTA {

script:
template 'fasta2gtf.py'

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir out
touch out/genome_transcriptome.fasta
touch out/genome_transcriptome.gtf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | grep -v "Python ")
END_VERSIONS
"""
}
Loading

0 comments on commit 2c6b114

Please sign in to comment.