Skip to content

Commit

Permalink
Added test to verify that GFFREAD can filter mRNA by CDS length
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Dec 11, 2024
1 parent d694431 commit 0f7784c
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 4 deletions.
38 changes: 38 additions & 0 deletions modules/local/tests/gffread/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nextflow_process {

name "Test Process GFFREAD"
script "../../../nf-core/gffread/main.nf"
config "./nextflow.config"
process "GFFREAD"

tag "gffread"
tag "modules_nfcore"
tag "modules"

test("filter by length") {

when {
process {
"""
input[0] = [
[id: 'test'],
file("$baseDir" + '/modules/local/tests/gffread/testdata/t.gff', checkIfExists: true)
]
input[1] = []
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert file(process.out.gffread_gff[0][1]).text.contains('gene19851') },
{ assert file(process.out.gffread_gff[0][1]).text.contains('gene19851.t1') },
{ assert ! file(process.out.gffread_gff[0][1]).text.contains('gene19851.t2') } // This is the only transcript which is being knocked out
)
}

}

}
47 changes: 47 additions & 0 deletions modules/local/tests/gffread/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"filter by length": {
"content": [
{
"0": [

],
"1": [
[
{
"id": "test"
},
"test.gff3:md5,59a7d6ff7123589ef2b90b20043a347c"
]
],
"2": [

],
"3": [
"versions.yml:md5,05f671c6c6e530acedad0af0a5948dbd"
],
"gffread_fasta": [

],
"gffread_gff": [
[
{
"id": "test"
},
"test.gff3:md5,59a7d6ff7123589ef2b90b20043a347c"
]
],
"gtf": [

],
"versions": [
"versions.yml:md5,05f671c6c6e530acedad0af0a5948dbd"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.04.4"
},
"timestamp": "2024-12-11T21:11:59.953464"
}
}
5 changes: 5 additions & 0 deletions modules/local/tests/gffread/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: GFFREAD {
ext.args = '--no-pseudo --keep-genes -C -l 72'
}
}
47 changes: 47 additions & 0 deletions modules/local/tests/gffread/testdata/t.gff
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
##gff-version 3
###
chr23 AUGUSTUS gene 16515075 16516672 . - . ID=gene19849;description=Protein%20of%20unknown%20function%20%28DUF1635%29
chr23 AUGUSTUS mRNA 16515075 16516597 1 - . ID=gene19849.t1;Parent=gene19849;description=Protein%20of%20unknown%20function%20%28DUF1635%29
chr23 AUGUSTUS exon 16515075 16515794 . - . ID=gene19849.t1.exon1;Parent=gene19849.t1
chr23 AUGUSTUS CDS 16515075 16515794 1 - 0 ID=gene19849.t1.cds1;Parent=gene19849.t1
chr23 AUGUSTUS exon 16516562 16516597 . - . ID=gene19849.t1.exon2;Parent=gene19849.t1
chr23 AUGUSTUS CDS 16516562 16516597 1 - 0 ID=gene19849.t1.cds2;Parent=gene19849.t1
chr23 gmst mRNA 16515075 16516672 . - . ID=gene19849.t2;Parent=gene19849;description=Protein%20of%20unknown%20function%20%28DUF1635%29
chr23 gmst exon 16515075 16515794 50.2 - 0 ID=gene19849.t2.exon1;Parent=gene19849.t2
chr23 gmst CDS 16515075 16515794 50.2 - 0 ID=gene19849.t2.cds1;Parent=gene19849.t2
chr23 gmst exon 16516562 16516672 50.2 - 0 ID=gene19849.t2.exon2;Parent=gene19849.t2
chr23 gmst CDS 16516562 16516672 50.2 - 0 ID=gene19849.t2.cds2;Parent=gene19849.t2
###
chr23 gmst gene 16530414 16531453 . - . ID=gene19850;description=Myb-like%20DNA-binding%20domain
chr23 gmst mRNA 16530414 16531453 . - . ID=gene19850.t1;Parent=gene19850;description=Myb-like%20DNA-binding%20domain
chr23 gmst exon 16530414 16531041 42.7 - 1 ID=gene19850.t1.exon1;Parent=gene19850.t1
chr23 gmst CDS 16530414 16531041 42.7 - 1 ID=gene19850.t1.cds1;Parent=gene19850.t1
chr23 gmst exon 16531197 16531453 42.7 - 0 ID=gene19850.t1.exon2;Parent=gene19850.t1
chr23 gmst CDS 16531197 16531453 42.7 - 0 ID=gene19850.t1.cds2;Parent=gene19850.t1
###
chr23 AUGUSTUS gene 16530414 16531542 . - . ID=gene19851;description=Differing%20isoform%20descriptions
chr23 AUGUSTUS mRNA 16530414 16531542 1 - . ID=gene19851.t1;Parent=gene19851;description=Myb-like%20DNA-binding%20domain
chr23 AUGUSTUS exon 16530414 16530721 . - . ID=gene19851.t1.exon1;Parent=gene19851.t1
chr23 AUGUSTUS CDS 16530414 16530721 1 - 2 ID=gene19851.t1.cds1;Parent=gene19851.t1
chr23 AUGUSTUS exon 16530824 16531041 . - . ID=gene19851.t1.exon2;Parent=gene19851.t1
chr23 AUGUSTUS CDS 16530824 16531041 1 - 1 ID=gene19851.t1.cds2;Parent=gene19851.t1
chr23 AUGUSTUS exon 16531197 16531326 . - . ID=gene19851.t1.exon3;Parent=gene19851.t1
chr23 AUGUSTUS CDS 16531197 16531326 1 - 2 ID=gene19851.t1.cds3;Parent=gene19851.t1
chr23 AUGUSTUS exon 16531428 16531542 . - . ID=gene19851.t1.exon4;Parent=gene19851.t1
chr23 AUGUSTUS CDS 16531428 16531542 1 - 0 ID=gene19851.t1.cds4;Parent=gene19851.t1
chr23 GeneMark.hmm3 mRNA 16531514 16531542 . - . ID=gene19851.t2;Parent=gene19851;description=Hypothetical%20protein%20%7C%20no%20eggnog%20hit
chr23 GeneMark.hmm3 exon 16531514 16531542 . - 0 ID=gene19851.t2.exon1;Parent=gene19851.t2
chr23 GeneMark.hmm3 CDS 16531514 16531542 . - 0 ID=gene19851.t2.cds1;Parent=gene19851.t2
###
chr23 AUGUSTUS gene 16539401 16545431 . + . ID=gene19852;description=nuclease%20HARBI1
chr23 AUGUSTUS mRNA 16539401 16545431 1 + . ID=gene19852.t1;Parent=gene19852;description=nuclease%20HARBI1
chr23 AUGUSTUS exon 16539401 16539509 . + . ID=gene19852.t1.exon1;Parent=gene19852.t1
chr23 AUGUSTUS CDS 16539401 16539509 1 + 0 ID=gene19852.t1.cds1;Parent=gene19852.t1
chr23 AUGUSTUS exon 16544386 16545431 . + . ID=gene19852.t1.exon2;Parent=gene19852.t1
chr23 AUGUSTUS CDS 16544386 16545431 1 + 2 ID=gene19852.t1.cds2;Parent=gene19852.t1
###
chr23 AUGUSTUS gene 16556338 16556796 . + . ID=gene19853;description=Zinc%20finger%20protein
chr23 AUGUSTUS mRNA 16556338 16556796 1 + . ID=gene19853.t1;Parent=gene19853;description=Zinc%20finger%20protein
chr23 AUGUSTUS exon 16556338 16556796 . + . ID=gene19853.t1.exon1;Parent=gene19853.t1
chr23 AUGUSTUS CDS 16556338 16556796 1 + 0 ID=gene19853.t1.cds1;Parent=gene19853.t1
###
8 changes: 4 additions & 4 deletions subworkflows/local/gff_eggnogmapper.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ workflow GFF_EGGNOGMAPPER {
| join(ch_fasta)

GFF2FASTA_FOR_EGGNOGMAPPER(
ch_gffread_inputs.map { meta, gff, fasta -> [ meta, gff ] },
ch_gffread_inputs.map { meta, gff, fasta -> fasta }
ch_gffread_inputs.map { meta, gff, _fasta -> [ meta, gff ] },
ch_gffread_inputs.map { _meta, _gff, fasta -> fasta }
)

ch_gffread_fasta = GFF2FASTA_FOR_EGGNOGMAPPER.out.gffread_fasta
Expand All @@ -30,9 +30,9 @@ workflow GFF_EGGNOGMAPPER {
| combine(Channel.fromPath(db_folder))

EGGNOGMAPPER(
ch_eggnogmapper_inputs.map { meta, fasta, db -> [ meta, fasta ] },
ch_eggnogmapper_inputs.map { meta, fasta, _db -> [ meta, fasta ] },
[],
ch_eggnogmapper_inputs.map { meta, fasta, db -> db },
ch_eggnogmapper_inputs.map { _meta, _fasta, db -> db },
[ [], [] ]
)

Expand Down

0 comments on commit 0f7784c

Please sign in to comment.