1
- def diamond_contig_test ():
2
- import filecmp
1
+ import filecmp
2
+ import sys
3
3
4
- alignment_flag = filecmp . cmp ( "./tests/diamond_contig/alignment.out.smorfs.tsv" , "./examples_output/alignment.out.smorfs.tsv" )
5
- if not alignment_flag :
6
- print ( ' \n Contig input of Diamond mode alignment results have something wrong. \n ' )
4
+ def checkf ( f ):
5
+ return filecmp . cmp ( f"./tests/diamond_contig/$ { f } " ,
6
+ f"./examples_output/$ { f } " )
7
7
8
- predict_flag = filecmp .cmp ("./tests/diamond_contig/predicted.filterd.smorf.faa" , "./examples_output/predicted.filterd.smorf.faa" )
9
- if not predict_flag :
10
- print ('\n Contig input of Diamond mode predicted fasta results have something wrong.\n ' )
8
+ ok = True
11
9
12
- fasta_flag = filecmp . cmp ( "./tests/diamond_contig/mapped .smorfs.faa" , "./examples_output/mapped.smorfs.faa" )
13
- if not fasta_flag :
14
- print ('\n Contig input of Diamond mode mapped fasta results have something wrong.\n ' )
10
+ if not checkf ( "alignment.out .smorfs.tsv" ):
11
+ ok = False
12
+ print ('\n Contig input of Diamond mode alignment results have something wrong.\n ' )
15
13
16
- habitat_flag = filecmp . cmp ( "./tests/diamond_contig/habitat.out.smorfs.tsv" , "./examples_output/habitat.out.smorfs.tsv" )
17
- if not habitat_flag :
18
- print ('\n Contig input of Diamond mode habitat results have something wrong.\n ' )
14
+ if not checkf ( "predicted.filterd.smorf.faa" ):
15
+ ok = False
16
+ print ('\n Contig input of Diamond mode predicted fasta results have something wrong.\n ' )
19
17
20
- taxonomy_flag = filecmp . cmp ( "./tests/diamond_contig/taxonomy.out. smorfs.tsv" , "./examples_output/taxonomy.out.smorfs.tsv" )
21
- if not taxonomy_flag :
22
- print ('\n Contig input of Diamond mode taxonomy results have something wrong.\n ' )
18
+ if not checkf ( "mapped. smorfs.faa" ):
19
+ ok = False
20
+ print ('\n Contig input of Diamond mode mapped fasta results have something wrong.\n ' )
23
21
24
- quality_flag = filecmp . cmp ( "./tests/diamond_contig/quality. out.smorfs.tsv", "./examples_output/quality.out.smorfs.tsv" )
25
- if not quality_flag :
26
- print ('\n Contig input of Diamond mode quality results have something wrong.\n ' )
22
+ if not checkf ( "habitat. out.smorfs.tsv"):
23
+ ok = False
24
+ print ('\n Contig input of Diamond mode habitat results have something wrong.\n ' )
27
25
28
- summary_flag = filecmp . cmp ( "./tests/diamond_contig/summary.txt" , "./examples_output/summary.txt" )
29
- if not summary_flag :
30
- print ('\n Contig input of Diamond mode summary results have something wrong.\n ' )
26
+ if not checkf ( "taxonomy.out.smorfs.tsv" ):
27
+ ok = False
28
+ print ('\n Contig input of Diamond mode taxonomy results have something wrong.\n ' )
31
29
32
- if alignment_flag and predict_flag and fasta_flag and habitat_flag and taxonomy_flag and quality_flag and summary_flag :
33
- print ('\n Contig input of Diamond mode checking has passed.\n ' )
30
+ if not checkf ("quality.out.smorfs.tsv" ):
31
+ ok = False
32
+ print ('\n Contig input of Diamond mode quality results have something wrong.\n ' )
33
+
34
+ if not checkf ("summary.txt" ):
35
+ ok = False
36
+ print ('\n Contig input of Diamond mode summary results have something wrong.\n ' )
37
+
38
+ if ok :
39
+ print ('\n Contig input of Diamond mode checking has passed.\n ' )
40
+ else :
41
+ sys .exit (1 )
34
42
35
- return (alignment_flag ,predict_flag ,fasta_flag ,habitat_flag ,taxonomy_flag ,quality_flag ,summary_flag )
36
43
37
- diamond_contig_test ()
0 commit comments