1
+ import filecmp
2
+ import sys
3
+ import pytest
4
+ import subprocess
5
+
6
+ def checkf (f ):
7
+ return filecmp .cmp (f"./tests/diamond_contig/{ f } " ,
8
+ f"./examples_output/{ f } " )
9
+
10
+ def test_diamond_contig ():
11
+ ok = True
12
+
13
+ subprocess .check_call (['gmsc-mapper' ,'createdb' ,
14
+ '-i' ,'examples/target.faa' ,
15
+ '-o' ,'examples/' ,
16
+ '-m' ,'diamond' ,
17
+ '--quiet' ])
18
+
19
+ subprocess .check_call (['gmsc-mapper' ,
20
+ '-i' ,'examples/example.fa' ,
21
+ '-o' ,'examples_output/' ,
22
+ '--db' ,'examples/diamond_targetdb.dmnd' ,
23
+ '--habitat' ,'examples/ref_habitat.npy' ,
24
+ '--habitat-index' ,'examples/ref_habitat_index.tsv' ,
25
+ '--quality' ,'examples/ref_quality.txt' ,
26
+ '--taxonomy' ,'examples/ref_taxonomy.npy' ,
27
+ '--taxonomy-index' ,'examples/ref_taxonomy_index.tsv' ,
28
+ '--domain' ,'examples/ref_domain.txt' ,'--quiet' ])
29
+
30
+ if not checkf ("predicted.filterd.smorf.faa" ):
31
+ ok = False
32
+ print ('\n Contig input of Diamond mode predicted fasta results have something wrong.\n ' )
33
+
34
+ if not checkf ("alignment.out.smorfs.tsv" ):
35
+ ok = False
36
+ print ('\n Contig input of Diamond mode alignment results have something wrong.\n ' )
37
+
38
+ if not checkf ("mapped.smorfs.faa" ):
39
+ ok = False
40
+ print ('\n Contig input of Diamond mode mapped fasta results have something wrong.\n ' )
41
+
42
+ if not checkf ("habitat.out.smorfs.tsv" ):
43
+ ok = False
44
+ print ('\n Contig input of Diamond mode habitat results have something wrong.\n ' )
45
+
46
+ if not checkf ("taxonomy.out.smorfs.tsv" ):
47
+ ok = False
48
+ print ('\n Contig input of Diamond mode taxonomy results have something wrong.\n ' )
49
+
50
+ if not checkf ("quality.out.smorfs.tsv" ):
51
+ ok = False
52
+ print ('\n Contig input of Diamond mode quality results have something wrong.\n ' )
53
+
54
+ if not checkf ("domain.out.smorfs.tsv" ):
55
+ ok = False
56
+ print ('\n Contig input of Diamond mode domain results have something wrong.\n ' )
57
+
58
+ if not checkf ("summary.txt" ):
59
+ ok = False
60
+ print ('\n Contig input of Diamond mode summary results have something wrong.\n ' )
61
+
62
+ assert ok
63
+
64
+ if __name__ == '__main__' :
65
+ pytest .main ()
0 commit comments