comparison clipkit_repo/tests/integration/test_writing_to_log_file.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 TestOutLog(object):
13 def test_simple(self):
14 """
15 test output in clustal format
16 usage: clipkit simple.fa -l
17 """
18 input_file = f"{here.parent}/samples/simple.fa"
19 output_file = "output/simple.fa.clipkit"
20
21 kwargs = dict(
22 input_file=input_file,
23 output_file=output_file,
24 input_file_format='fasta',
25 output_file_format='fasta',
26 complement=False,
27 gaps=0.9,
28 mode=TrimmingMode.gappy,
29 use_log=True,
30 )
31 execute(**kwargs)
32
33 with open(f"{here.parent}/expected/simple.fa.clipkit.log", "r") as expected:
34 expected_content = expected.read()
35
36 with open(f"{output_file}.log", "r") as out_file:
37 output_content = out_file.read()
38
39 assert expected_content == output_content
40
41 def test_simple_long_description(self):
42 """
43 test output in clustal format
44 usage: clipkit simple_long_description.fa -l
45 """
46 input_file = f"{here.parent}/samples/simple_long_description.fa"
47 output_file = "output/simple_long_description.fa.clipkit"
48
49 kwargs = dict(
50 input_file=input_file,
51 output_file=output_file,
52 input_file_format='fasta',
53 output_file_format='fasta',
54 complement=False,
55 gaps=0.9,
56 mode=TrimmingMode.gappy,
57 use_log=True,
58 )
59 execute(**kwargs)
60
61 with open(f"{here.parent}/expected/simple_long_description.fa.clipkit.log", "r") as expected:
62 expected_content = expected.read()
63
64 with open(f"{output_file}.log", "r") as out_file:
65 output_content = out_file.read()
66
67 assert expected_content == output_content
68
69 def test_12_YIL115C_Anc_2_253_codon_aln(self):
70 """
71 test output in clustal format
72 usage: clipkit 12_YIL115C_Anc_2.253_codon_aln.fasta -l
73 """
74 input_file = f"{here.parent}/samples/12_YIL115C_Anc_2.253_codon_aln.fasta"
75 output_file = "output/12_YIL115C_Anc_2.253_codon_aln.fasta.clipkit"
76
77 kwargs = dict(
78 input_file=input_file,
79 output_file=output_file,
80 input_file_format='fasta',
81 output_file_format='fasta',
82 complement=False,
83 gaps=0.9,
84 mode=TrimmingMode.gappy,
85 use_log=True,
86 )
87 execute(**kwargs)
88
89 with open(
90 f"{here.parent}/expected/12_YIL115C_Anc_2.253_codon_aln.fasta.clipkit.log",
91 "r",
92 ) as expected:
93 expected_content = expected.read()
94
95 with open(f"{output_file}.log", "r") as out_file:
96 output_content = out_file.read()
97
98 assert expected_content == output_content
99
100 def test_EOG091N44M8_nt(self):
101 """
102 test output in clustal format
103 usage: clipkit EOG091N44M8_nt.fa -l
104 """
105 input_file = f"{here.parent}/samples/EOG091N44M8_nt.fa"
106 output_file = "output/EOG091N44M8_nt.fa.clipkit"
107
108 kwargs = dict(
109 input_file=input_file,
110 output_file=output_file,
111 input_file_format='fasta',
112 output_file_format='fasta',
113 complement=False,
114 gaps=0.9,
115 mode=TrimmingMode.gappy,
116 use_log=True,
117 )
118 execute(**kwargs)
119
120 with open(
121 f"{here.parent}/expected/EOG091N44M8_nt.fa.clipkit.log", "r"
122 ) as expected:
123 expected_content = expected.read()
124
125 with open(f"{output_file}.log", "r") as out_file:
126 output_content = out_file.read()
127
128 assert expected_content == output_content