Skip to content

Commit

Permalink
Merge pull request nf-core#1232 from maxulysse/star_igenomes
Browse files Browse the repository at this point in the history
Adding tests for star_align igenomes
  • Loading branch information
maxulysse authored Mar 5, 2024
2 parents 34e51dd + 4d9e2fb commit 4ef4025
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/local/star_genomegenerate_igenomes/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ process STAR_GENOMEGENERATE_IGENOMES {
def args = task.ext.args ?: ''
def args_list = args.tokenize()
def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : ''
def include_gtf = gtf ? "--sjdbGTFfile $gtf" : ''
if (args_list.contains('--genomeSAindexNbases')) {
"""
mkdir star
STAR \\
--runMode genomeGenerate \\
--genomeDir star/ \\
--genomeFastaFiles $fasta \\
--sjdbGTFfile $gtf \\
$include_gtf \\
--runThreadN $task.cpus \\
$memory \\
$args
Expand All @@ -51,7 +52,7 @@ process STAR_GENOMEGENERATE_IGENOMES {
--runMode genomeGenerate \\
--genomeDir star/ \\
--genomeFastaFiles $fasta \\
--sjdbGTFfile $gtf \\
$include_gtf \\
--runThreadN $task.cpus \\
--genomeSAindexNbases \$NUM_BASES \\
$memory \\
Expand Down
93 changes: 93 additions & 0 deletions modules/local/star_genomegenerate_igenomes/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
nextflow_process {

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

tag "STAR_GENOMEGENERATE_IGENOMES"

test("fasta with gtf") {

when {
process {
"""
input[0] = Channel.of([file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)])
input[1] = Channel.of([file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.index[0][1]).listFiles().collect { it.getName() }.sort().toString()).match("fasta_gtf_index") },
{ assert snapshot(process.out.versions).match("fasta_gtf_versions") }
)
}
}

test("fasta with gtf - stub") {

options '-stub'

when {
process {
"""
input[0] = Channel.of([file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)])
input[1] = Channel.of([file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.index[0][1]).listFiles().collect { it.getName() }.sort().toString()).match("fasta_gtf_stub_index") },
{ assert snapshot(process.out.versions).match("fasta_gtf_stub_versions") }
)
}
}

test("fasta no gtf") {

when {
process {
"""
input[0] = Channel.of([file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)])
input[1] = Channel.of([ ])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.index[0][1]).listFiles().collect { it.getName() }.sort().toString()).match("fasta_index") },
{ assert snapshot(process.out.versions).match("fasta_versions") }
)
}

}

test("fasta no gtf - stub") {

options '-stub'

when {
process {
"""
input[0] = Channel.of([file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)])
input[1] = Channel.of([ ])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.index[0][1]).listFiles().collect { it.getName() }.sort().toString()).match("fasta_stub_index") },
{ assert snapshot(process.out.versions).match("fasta_stub_versions") }
)
}
}
}
90 changes: 90 additions & 0 deletions modules/local/star_genomegenerate_igenomes/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"fasta_gtf_versions": {
"content": [
[
"versions.yml:md5,562a70f12dd9e695449b59fbf604e98d"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:28:05.069709"
},
"fasta_stub_versions": {
"content": [
[
"versions.yml:md5,562a70f12dd9e695449b59fbf604e98d"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:31:12.153651"
},
"fasta_gtf_stub_index": {
"content": [
"[]"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:28:16.309869"
},
"fasta_gtf_stub_versions": {
"content": [
[
"versions.yml:md5,562a70f12dd9e695449b59fbf604e98d"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:28:16.337298"
},
"fasta_index": {
"content": [
"[]"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:30:56.504744"
},
"fasta_versions": {
"content": [
[
"versions.yml:md5,562a70f12dd9e695449b59fbf604e98d"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:30:56.575367"
},
"fasta_gtf_index": {
"content": [
"[]"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:28:05.031195"
},
"fasta_stub_index": {
"content": [
"[]"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.01.0"
},
"timestamp": "2024-03-05T10:31:12.12097"
}
}
2 changes: 2 additions & 0 deletions modules/local/star_genomegenerate_igenomes/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
STAR_GENOMEGENERATE_IGENOMES:
- modules/local/star_genomegenerate_igenomes/**

0 comments on commit 4ef4025

Please sign in to comment.