Skip to content

Commit

Permalink
Add nf-tests for gem mapping module and update star tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emi80 committed May 2, 2024
1 parent 1c47bc9 commit 4402146
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 14 deletions.
65 changes: 65 additions & 0 deletions tests/modules/mapping/gem/main.index.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
nextflow_process {

name "Test Process index"
script "modules/mapping/gem/main.nf"
process "index"

tag "module"

test("Should create index using GEM (compressed references)") {

when {
process {
"""
input[0] = file("${baseDir}/data/genome.fa.gz")
input[1] = file("${baseDir}/data/annotation.gtf.gz")
"""
}
}

then {
assert process.success
with(process.out) {
def genomeDir = get(0)[0]
assert path(genomeDir).list().size() == 7
assert snapshot(
path("${genomeDir}/genome_index.gem"),
path("${genomeDir}/transcript_index.junctions"),
path("${genomeDir}/transcript_index.junctions.fa"),
path("${genomeDir}/transcript_index.junctions.gem"),
path("${genomeDir}/transcript_index.junctions.keys"),
).match()
}
}

}

test("Should create index using GEM (uncompressed references)") {

when {
process {
"""
input[0] = file("${baseDir}/data/genome.fa")
input[1] = file("${baseDir}/data/annotation.gtf")
"""
}
}

then {
assert process.success
with(process.out) {
def genomeDir = get(0)[0]
assert path(genomeDir).list().size() == 7
assert snapshot(
path("${genomeDir}/genome_index.gem"),
path("${genomeDir}/transcript_index.junctions"),
path("${genomeDir}/transcript_index.junctions.fa"),
path("${genomeDir}/transcript_index.junctions.gem"),
path("${genomeDir}/transcript_index.junctions.keys"),
).match()
}
}

}

}
30 changes: 30 additions & 0 deletions tests/modules/mapping/gem/main.index.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"Should create index using GEM (compressed references)": {
"content": [
"genome_index.gem:md5,ebd155f05251ace3a35ce3edd8816211",
"transcript_index.junctions:md5,a0433e39f0c35e798609ff15332e12d4",
"transcript_index.junctions.fa:md5,be0a28c75266e6969c11e308341810ae",
"transcript_index.junctions.gem:md5,b53971e7b5358fd8cae8bb7f2a4a729d",
"transcript_index.junctions.keys:md5,34985e55c280acd027d2dd32906ad59c"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-02T09:01:47.328374722"
},
"Should create index using GEM (uncompressed references)": {
"content": [
"genome_index.gem:md5,ebd155f05251ace3a35ce3edd8816211",
"transcript_index.junctions:md5,a0433e39f0c35e798609ff15332e12d4",
"transcript_index.junctions.fa:md5,be0a28c75266e6969c11e308341810ae",
"transcript_index.junctions.gem:md5,b53971e7b5358fd8cae8bb7f2a4a729d",
"transcript_index.junctions.keys:md5,34985e55c280acd027d2dd32906ad59c"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-02T09:02:27.226869622"
}
}
79 changes: 79 additions & 0 deletions tests/modules/mapping/gem/main.map.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
nextflow_process {

name "Test Process map"
script "modules/mapping/gem/main.nf"
process "map"

tag "module"

setup {
run("index") {
script "modules/mapping/gem/main.nf"
process {
"""
input[0] = file("${baseDir}/data/genome.fa")
input[1] = file("${baseDir}/data/annotation.gtf")
"""
}
}
}

test("Should align reads to the reference using GEM (compressed annotation)") {

when {
params {
maxMismatches = 4
maxMultimaps = 10
}
process {
"""
def fastqs = file("${baseDir}/data/test1_*.fastq.gz")
def qScore = fastq(fastqs[0]).qualityScore()
input[0] = file("${baseDir}/data/annotation.gtf.gz")
input[1] = index.out
input[2] = Channel.from(
[
[ "sample1", "test1", fastqs, "fastq", ["fqRd1", "fqRd2"], qScore]
]
)
"""
}
}

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

}

test("Should align reads to the reference using GEM (uncompressed annotation)") {

when {
params {
maxMismatches = 4
maxMultimaps = 10
}
process {
"""
def fastqs = file("${baseDir}/data/test1_*.fastq.gz")
def qScore = fastq(fastqs[0]).qualityScore()
input[0] = file("${baseDir}/data/annotation.gtf")
input[1] = index.out
input[2] = Channel.from(
[
[ "sample1", "test1", fastqs, "fastq", ["fqRd1", "fqRd2"], qScore]
]
)
"""
}
}

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

}

}
140 changes: 140 additions & 0 deletions tests/modules/mapping/gem/main.map.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"Should align reads to the reference using GEM (compressed annotation)": {
"content": [
{
"0": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam:md5,48faeddd5179ce7b5d629ad937851b45",
"bam",
"GenomeAlignments",
true
]
],
"1": [

],
"2": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam.bai:md5,f0b712d99d68ae3132bdb287ed5a5e5d",
"bai",
"GenomeAlignmentsIndex",
true
]
],
"3": [

],
"4": [

],
"genomeAlignments": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam:md5,48faeddd5179ce7b5d629ad937851b45",
"bam",
"GenomeAlignments",
true
]
],
"genomeAlignmentsIndices": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam.bai:md5,f0b712d99d68ae3132bdb287ed5a5e5d",
"bai",
"GenomeAlignmentsIndex",
true
]
],
"junctions": [

],
"stats": [

],
"transcriptomeAlignments": [

]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-02T08:54:34.740923082"
},
"Should align reads to the reference using GEM (uncompressed annotation)": {
"content": [
{
"0": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam:md5,48faeddd5179ce7b5d629ad937851b45",
"bam",
"GenomeAlignments",
true
]
],
"1": [

],
"2": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam.bai:md5,f0b712d99d68ae3132bdb287ed5a5e5d",
"bai",
"GenomeAlignmentsIndex",
true
]
],
"3": [

],
"4": [

],
"genomeAlignments": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam:md5,48faeddd5179ce7b5d629ad937851b45",
"bam",
"GenomeAlignments",
true
]
],
"genomeAlignmentsIndices": [
[
"sample1",
"test1",
"sample1_m4_n10_toGenome.bam.bai:md5,f0b712d99d68ae3132bdb287ed5a5e5d",
"bai",
"GenomeAlignmentsIndex",
true
]
],
"junctions": [

],
"stats": [

],
"transcriptomeAlignments": [

]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-02T08:55:30.059497532"
}
}
4 changes: 2 additions & 2 deletions tests/modules/mapping/star/main.index.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nextflow_process {

tag "module"

test("Should index compressed references") {
test("Should create index using STAR (compressed references)") {

when {
params {
Expand Down Expand Up @@ -47,7 +47,7 @@ nextflow_process {

}

test("Should index uncompressed references") {
test("Should create index using STAR (uncompressed references)") {

when {
params {
Expand Down
6 changes: 3 additions & 3 deletions tests/modules/mapping/star/main.index.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Should index compressed references": {
"Should create index using STAR (compressed references)": {
"content": [
"Genome:md5,7ede3c93094305c2b5c18e2f52110194",
"SA:md5,66c24435d4e28eeddb6a5014ac90c4ef",
Expand All @@ -23,7 +23,7 @@
},
"timestamp": "2024-04-17T17:20:31.357378"
},
"Should index uncompressed references": {
"Should create index using STAR (uncompressed references)": {
"content": [
"Genome:md5,7ede3c93094305c2b5c18e2f52110194",
"SA:md5,66c24435d4e28eeddb6a5014ac90c4ef",
Expand All @@ -47,4 +47,4 @@
},
"timestamp": "2024-04-17T17:20:43.134729"
}
}
}
6 changes: 2 additions & 4 deletions tests/modules/mapping/star/main.map.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ nextflow_process {
}
}

test("Should align reads to the reference with compressed annotation") {
test("Should align reads to the reference using STAR (compressed annotation)") {

when {
params {
mappingTool = "STAR"
sjOverHang = 100
quantificationTool = "RSEM"
maxMismatches = 4
Expand Down Expand Up @@ -53,11 +52,10 @@ nextflow_process {

}

test("Should align reads to the reference with uncompressed annotation") {
test("Should align reads to the reference using STAR (uncompressed annotation)") {

when {
params {
mappingTool = "STAR"
sjOverHang = 100
quantificationTool = "RSEM"
maxMismatches = 4
Expand Down
Loading

0 comments on commit 4402146

Please sign in to comment.