comparison clipkit_repo/tests/integration/test_kpi_mode.py @ 0:49b058e85902 draft

"planemo upload for repository https://github.com/jlsteenwyk/clipkit commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
author padge
date Fri, 25 Mar 2022 13:04:31 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:49b058e85902
1 import pytest
2 from pathlib import Path
3
4 from clipkit.clipkit import execute
5 from clipkit.files import FileFormat
6 from clipkit.modes import TrimmingMode
7
8 here = Path(__file__)
9
10
11 @pytest.mark.integration
12 class TestKpiMode(object):
13 def test_simple(self):
14 """
15 usage: clipkit simple.fa -kpi
16 """
17 input_file = f"{here.parent}/samples/simple.fa"
18 output_file = "output/simpla.fa.TestKpiMode_test_simple.clipkit"
19
20 kwargs = dict(
21 input_file=input_file,
22 output_file=output_file,
23 input_file_format='fasta',
24 output_file_format='fasta',
25 complement=False,
26 gaps=0.9,
27 mode=TrimmingMode.kpi,
28 use_log=False,
29 )
30 execute(**kwargs)
31
32 with open(f"{here.parent}/expected/simple.fa_kpi", "r") as expected:
33 expected_content = expected.read()
34
35 with open(output_file, "r") as out_file:
36 output_content = out_file.read()
37
38 assert expected_content == output_content
39
40 def test_simple_long_description(self):
41 """
42 usage: clipkit simple.fa -kpi
43 """
44 input_file = f"{here.parent}/samples/simple_long_description.fa"
45 output_file = "output/simple_long_description.fa.TestKpiMode_test_simple.clipkit"
46
47 kwargs = dict(
48 input_file=input_file,
49 output_file=output_file,
50 input_file_format='fasta',
51 output_file_format='fasta',
52 complement=False,
53 gaps=0.9,
54 mode=TrimmingMode.kpi,
55 use_log=False,
56 )
57 execute(**kwargs)
58
59 with open(f"{here.parent}/expected/simple_long_description.fa_kpi", "r") as expected:
60 expected_content = expected.read()
61
62 with open(output_file, "r") as out_file:
63 output_content = out_file.read()
64
65 assert expected_content == output_content
66
67 def test_12_YIL115C_Anc_2_253_codon_aln(self):
68 """
69 test kpi with codon alignment of yeast sequences
70 usage: clipkit 12_YIL115C_Anc_2.253_codon_aln.fasta -m kpi
71 """
72 input_file = f"{here.parent}/samples/12_YIL115C_Anc_2.253_codon_aln.fasta"
73 output_file = "output/12_YIL115C_Anc_2.253_codon_aln.fasta.clipkit"
74
75 kwargs = dict(
76 input_file=input_file,
77 output_file=output_file,
78 input_file_format='fasta',
79 output_file_format='fasta',
80 complement=False,
81 gaps=0.9,
82 mode=TrimmingMode.kpi,
83 use_log=False,
84 )
85 execute(**kwargs)
86
87 with open(
88 f"{here.parent}/expected/12_YIL115C_Anc_2.253_codon_aln.fasta_kpi", "r"
89 ) as expected:
90 expected_content = expected.read()
91
92 with open(output_file, "r") as out_file:
93 output_content = out_file.read()
94
95 assert expected_content == output_content
96
97 def test_12_YIL115C_Anc_2_253_aa_aln(self):
98 """
99 test kpi with amino acid alignment of yeast sequences
100 usage: clipkit 12_YIL115C_Anc_2.253_aa_aln.fasta -m kpi
101 """
102 input_file = f"{here.parent}/samples/12_YIL115C_Anc_2.253_aa_aln.fasta"
103 output_file = "output/12_YIL115C_Anc_2.253_aa_aln.fasta.clipkit"
104
105 kwargs = dict(
106 input_file=input_file,
107 output_file=output_file,
108 input_file_format='fasta',
109 output_file_format='fasta',
110 complement=False,
111 gaps=0.9,
112 mode=TrimmingMode.kpi,
113 use_log=False,
114 )
115 execute(**kwargs)
116
117 with open(
118 f"{here.parent}/expected/12_YIL115C_Anc_2.253_aa_aln.fasta_kpi", "r"
119 ) as expected:
120 expected_content = expected.read()
121
122 with open(output_file, "r") as out_file:
123 output_content = out_file.read()
124
125 assert expected_content == output_content
126
127 def test_24_ENSG00000163519_aa_aln(self):
128 """
129 test kpi with amino acid alignment of mammalian sequences
130 usage: clipkit 24_ENSG00000163519_aa_aln.fasta -m kpi
131 """
132 input_file = f"{here.parent}/samples/24_ENSG00000163519_aa_aln.fasta"
133 output_file = "output/24_ENSG00000163519_aa_aln.fasta.clipkit"
134
135 kwargs = dict(
136 input_file=input_file,
137 output_file=output_file,
138 input_file_format='fasta',
139 output_file_format='fasta',
140 complement=False,
141 gaps=0.9,
142 mode=TrimmingMode.kpi,
143 use_log=False,
144 )
145 execute(**kwargs)
146
147 with open(
148 f"{here.parent}/expected/24_ENSG00000163519_aa_aln.fasta_kpi", "r"
149 ) as expected:
150 expected_content = expected.read()
151
152 with open(output_file, "r") as out_file:
153 output_content = out_file.read()
154
155 assert expected_content == output_content
156
157 def test_24_ENSG00000163519_codon_aln(self):
158 """
159 test kpi with codon alignment of mammalian sequences
160 usage: clipkit 24_ENSG00000163519_codon_aln.fasta -m kpi
161 """
162 input_file = f"{here.parent}/samples/24_ENSG00000163519_codon_aln.fasta"
163 output_file = "output/24_ENSG00000163519_codon_aln.fasta.clipkit"
164
165 kwargs = dict(
166 input_file=input_file,
167 output_file=output_file,
168 input_file_format='fasta',
169 output_file_format='fasta',
170 complement=False,
171 gaps=0.9,
172 mode=TrimmingMode.kpi,
173 use_log=False,
174 )
175 execute(**kwargs)
176
177 with open(
178 f"{here.parent}/expected/24_ENSG00000163519_codon_aln.fasta_kpi", "r"
179 ) as expected:
180 expected_content = expected.read()
181
182 with open(output_file, "r") as out_file:
183 output_content = out_file.read()
184
185 assert expected_content == output_content
186
187 def test_EOG091N44M8_aa(self):
188 """
189 test kpi with amino acid alignment of Penicillium sequences
190 usage: clipkit EOG091N44M8_aa.fa -m kpi
191 """
192 input_file = f"{here.parent}/samples/EOG091N44M8_aa.fa"
193 output_file = "output/EOG091N44M8_aa.fa.clipkit"
194
195 kwargs = dict(
196 input_file=input_file,
197 output_file=output_file,
198 input_file_format='fasta',
199 output_file_format='fasta',
200 complement=False,
201 gaps=0.9,
202 mode=TrimmingMode.kpi,
203 use_log=False,
204 )
205 execute(**kwargs)
206
207 with open(f"{here.parent}/expected/EOG091N44M8_aa.fa_kpi", "r") as expected:
208 expected_content = expected.read()
209
210 with open(output_file, "r") as out_file:
211 output_content = out_file.read()
212
213 assert expected_content == output_content
214
215 def test_EOG091N44M8_nt(self):
216 """
217 test kpi with nucleotide alignment of Penicillium sequences
218 usage: clipkit EOG091N44M8_nt.fa -m kpi
219 """
220 input_file = f"{here.parent}/samples/EOG091N44M8_nt.fa"
221 output_file = "output/EOG091N44M8_nt.fa.clipkit"
222
223 kwargs = dict(
224 input_file=input_file,
225 output_file=output_file,
226 input_file_format='fasta',
227 output_file_format='fasta',
228 complement=False,
229 gaps=0.9,
230 mode=TrimmingMode.kpi,
231 use_log=False,
232 )
233 execute(**kwargs)
234
235 with open(f"{here.parent}/expected/EOG091N44M8_nt.fa_kpi", "r") as expected:
236 expected_content = expected.read()
237
238 with open(output_file, "r") as out_file:
239 output_content = out_file.read()
240
241 assert expected_content == output_content
242
243 @pytest.mark.slow
244 def test_EOG092C4VOX_aa(self):
245 """
246 test kpi with amino alignment of fungal sequences
247 usage: clipkit EOG092C4VOX_aa_aln.fasta -m kpi
248 """
249 input_file = f"{here.parent}/samples/EOG092C4VOX_aa_aln.fasta"
250 output_file = "output/EOG092C4VOX_aa_aln.fasta.clipkit"
251
252 kwargs = dict(
253 input_file=input_file,
254 output_file=output_file,
255 input_file_format='fasta',
256 output_file_format='fasta',
257 complement=False,
258 gaps=0.9,
259 mode=TrimmingMode.kpi,
260 use_log=False,
261 )
262 execute(**kwargs)
263
264 with open(
265 f"{here.parent}/expected/EOG092C4VOX_aa_aln.fasta_kpi", "r"
266 ) as expected:
267 expected_content = expected.read()
268
269 with open(output_file, "r") as out_file:
270 output_content = out_file.read()
271
272 assert expected_content == output_content