FunVIP 0.3.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- FunVIP-0.3.20.dist-info/LICENSE +674 -0
- FunVIP-0.3.20.dist-info/METADATA +32 -0
- FunVIP-0.3.20.dist-info/RECORD +36 -0
- FunVIP-0.3.20.dist-info/WHEEL +5 -0
- FunVIP-0.3.20.dist-info/entry_points.txt +3 -0
- FunVIP-0.3.20.dist-info/top_level.txt +3 -0
- data/__init__.py +0 -0
- external/BLAST_Windows/bin/cleanup-blastdb-volumes.py +162 -0
- external/__init__.py +0 -0
- src/__init__.py +0 -0
- src/align.py +124 -0
- src/cluster.py +510 -0
- src/command.py +360 -0
- src/concatenate.py +356 -0
- src/dataset.py +716 -0
- src/ext.py +448 -0
- src/hasher.py +98 -0
- src/initialize.py +335 -0
- src/logger.py +69 -0
- src/logics.py +104 -0
- src/modeltest.py +443 -0
- src/ncbi.py +160 -0
- src/opt_generator.py +72 -0
- src/patch.py +261 -0
- src/reporter.py +875 -0
- src/save.py +181 -0
- src/search.py +440 -0
- src/tool.py +309 -0
- src/tree.py +222 -0
- src/tree_interpretation.py +1379 -0
- src/tree_interpretation_pipe.py +679 -0
- src/trim.py +118 -0
- src/validate_input.py +846 -0
- src/validate_option.py +1609 -0
- src/validation.py +38 -0
- src/version.py +337 -0
src/validation.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from Bio import SeqIO
|
|
2
|
+
from Bio.Seq import Seq
|
|
3
|
+
from Bio.SeqRecord import SeqRecord
|
|
4
|
+
|
|
5
|
+
from io import StringIO
|
|
6
|
+
|
|
7
|
+
# from .logger import Mes
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# validate if string is good sequence
|
|
11
|
+
def validate_seq(seqstring):
|
|
12
|
+
if seqstring.startswith(">"):
|
|
13
|
+
tmp = StringIO(seqstring)
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
seqlist = list(SeqIO.parse(tmp, fasta))
|
|
17
|
+
return "seqrecord", seqlist
|
|
18
|
+
except:
|
|
19
|
+
logging.warning(f"Invalid seqrecord {seqstring}")
|
|
20
|
+
return "invalid", None
|
|
21
|
+
|
|
22
|
+
else:
|
|
23
|
+
seqstring = seqstring.replace(" ", "").replace("\n", "")
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
seq = Seq(seqstring)
|
|
27
|
+
seqlist = [
|
|
28
|
+
SeqRecord(
|
|
29
|
+
seq,
|
|
30
|
+
id="input",
|
|
31
|
+
description="tmp",
|
|
32
|
+
annotations={"molecule_type": "DNA"},
|
|
33
|
+
)
|
|
34
|
+
]
|
|
35
|
+
return "seqrecord", seqlist
|
|
36
|
+
except:
|
|
37
|
+
logging.warning(f"Invalid sequence {seqstring}")
|
|
38
|
+
return "invalid", None
|
src/version.py
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# Version management module
|
|
2
|
+
import sys
|
|
3
|
+
import subprocess
|
|
4
|
+
from importlib.metadata import version
|
|
5
|
+
|
|
6
|
+
# import
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
version = {
|
|
11
|
+
"FunVIP": "0.3.19.0.1.3",
|
|
12
|
+
"BLASTn": "",
|
|
13
|
+
"MMseqs2": "",
|
|
14
|
+
"MAFFT": "",
|
|
15
|
+
"TrimAl": "",
|
|
16
|
+
"Gblocks": "0.91b",
|
|
17
|
+
"FastTree": "",
|
|
18
|
+
"IQTREE2": "",
|
|
19
|
+
"RAxML": "",
|
|
20
|
+
}
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Version:
|
|
25
|
+
def __init__(self, opt, path):
|
|
26
|
+
self.FunVIP = ""
|
|
27
|
+
self.GenMine = ""
|
|
28
|
+
self.BLASTn = ""
|
|
29
|
+
self.MMseqs2 = ""
|
|
30
|
+
self.MAFFT = ""
|
|
31
|
+
self.trimAl = ""
|
|
32
|
+
self.Gblocks = "0.91b"
|
|
33
|
+
self.Modeltest_NG = ""
|
|
34
|
+
self.FastTree = ""
|
|
35
|
+
self.IQTREE2 = ""
|
|
36
|
+
self.RAxML = ""
|
|
37
|
+
|
|
38
|
+
# For windows platform
|
|
39
|
+
if sys.platform == "win32":
|
|
40
|
+
### FunVIP
|
|
41
|
+
self.FunVIP = version("FunVIP")
|
|
42
|
+
|
|
43
|
+
### GenMine
|
|
44
|
+
self.GenMine = version("GenMine")
|
|
45
|
+
|
|
46
|
+
### BLASTn
|
|
47
|
+
CMD = [f"{path.sys_path}/external/BLAST_Windows/bin/blastn.exe", "-version"]
|
|
48
|
+
result = subprocess.Popen(
|
|
49
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
50
|
+
)
|
|
51
|
+
stdout, stderr = result.communicate()
|
|
52
|
+
stdout_str = stdout.decode("utf-8")
|
|
53
|
+
## tableformat
|
|
54
|
+
# blastn: blastn: 2.12.0+
|
|
55
|
+
# Package: blast 2.12.0, build Jun 4 2021 03:25:07
|
|
56
|
+
self.BLASTn = stdout_str.split("\n")[0].split(" ")[1].strip()
|
|
57
|
+
# print("BLASTn", self.BLASTn)
|
|
58
|
+
|
|
59
|
+
### MMSeqs2
|
|
60
|
+
CMD = [
|
|
61
|
+
f"{path.sys_path}/external/mmseqs_Windows/mmseqs.bat",
|
|
62
|
+
"-h",
|
|
63
|
+
]
|
|
64
|
+
result = subprocess.Popen(
|
|
65
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
66
|
+
)
|
|
67
|
+
stdout, stderr = result.communicate()
|
|
68
|
+
stdout_str = stdout.decode("utf-8")
|
|
69
|
+
self.MMseqs2 = stdout_str.split("Version: ")[1].split("\n")[0].strip()
|
|
70
|
+
# print("MMseqs2", self.MMseqs2)
|
|
71
|
+
|
|
72
|
+
### MAFFT
|
|
73
|
+
CMD = [
|
|
74
|
+
f"{path.sys_path}/external/MAFFT_Windows/mafft-win/mafft.bat",
|
|
75
|
+
"--version",
|
|
76
|
+
]
|
|
77
|
+
result = subprocess.Popen(
|
|
78
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
79
|
+
)
|
|
80
|
+
stdout, stderr = result.communicate()
|
|
81
|
+
# MAFFT, output is on the stderr
|
|
82
|
+
stderr_str = stderr.decode("utf-8")
|
|
83
|
+
self.MAFFT = stderr_str.split("\n")[-2].split(" ")[0].strip()
|
|
84
|
+
# print("MAFFT", self.MAFFT)
|
|
85
|
+
|
|
86
|
+
### TrimAl
|
|
87
|
+
CMD = [
|
|
88
|
+
f"{path.sys_path}/external/trimal.v1.4/trimAl/bin/trimal.exe",
|
|
89
|
+
"--version",
|
|
90
|
+
]
|
|
91
|
+
result = subprocess.Popen(
|
|
92
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
93
|
+
)
|
|
94
|
+
stdout, stderr = result.communicate()
|
|
95
|
+
stdout_str = stdout.decode("utf-8")
|
|
96
|
+
self.trimAl = stdout_str.split("\n")[1].split(" ")[1]
|
|
97
|
+
# print("trimAl", self.trimAl)
|
|
98
|
+
|
|
99
|
+
### Modeltest-ng
|
|
100
|
+
## Not supported in Windows
|
|
101
|
+
self.Modeltest_NG = "not supported"
|
|
102
|
+
|
|
103
|
+
### FastTree
|
|
104
|
+
## Also use stderr of FastTree
|
|
105
|
+
CMD = [
|
|
106
|
+
f"{path.sys_path}/external/FastTree_Windows/FastTree.exe",
|
|
107
|
+
"-expert",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
result = subprocess.Popen(
|
|
111
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
112
|
+
)
|
|
113
|
+
stdout, stderr = result.communicate()
|
|
114
|
+
stdout_str = stdout.decode("utf-8")
|
|
115
|
+
stderr_str = stderr.decode("utf-8")
|
|
116
|
+
self.FastTree = stderr_str.split(" ")[4]
|
|
117
|
+
# print("FastTree", self.FastTree)
|
|
118
|
+
|
|
119
|
+
### IQTREE
|
|
120
|
+
CMD = [
|
|
121
|
+
f"{path.sys_path}/external/iqtree/bin/iqtree2.exe",
|
|
122
|
+
"--version",
|
|
123
|
+
]
|
|
124
|
+
result = subprocess.Popen(
|
|
125
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
126
|
+
)
|
|
127
|
+
stdout, stderr = result.communicate()
|
|
128
|
+
stdout_str = stdout.decode("utf-8")
|
|
129
|
+
self.IQTREE2 = stdout_str.split(" ")[3]
|
|
130
|
+
# print("IQTREE2", self.IQTREE2)
|
|
131
|
+
|
|
132
|
+
### RAxML
|
|
133
|
+
if opt.avx is True:
|
|
134
|
+
CMD = [
|
|
135
|
+
f"{path.sys_path}/external/RAxML_Windows/raxmlHPC-PTHREADS-AVX2.exe",
|
|
136
|
+
"-v",
|
|
137
|
+
]
|
|
138
|
+
else:
|
|
139
|
+
CMD = [
|
|
140
|
+
f"{path.sys_path}/external/RAxML_Windows/raxmlHPC-PTHREADS-SSE3.exe",
|
|
141
|
+
"-v",
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
result = subprocess.Popen(
|
|
145
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
146
|
+
)
|
|
147
|
+
stdout, stderr = result.communicate()
|
|
148
|
+
stdout_str = stdout.decode("utf-8")
|
|
149
|
+
self.RAxML = stdout_str.split("\n")[2].split(" ")[4]
|
|
150
|
+
# print("RAxML", self.RAxML)
|
|
151
|
+
|
|
152
|
+
# For apple silicon platform
|
|
153
|
+
elif sys.platform == "darwin":
|
|
154
|
+
### FunVIP
|
|
155
|
+
self.FunVIP = version("FunVIP")
|
|
156
|
+
|
|
157
|
+
### GenMine
|
|
158
|
+
self.GenMine = version("GenMine")
|
|
159
|
+
|
|
160
|
+
### BLASTn
|
|
161
|
+
CMD = ["blastn", "-version"]
|
|
162
|
+
result = subprocess.Popen(
|
|
163
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
164
|
+
)
|
|
165
|
+
stdout, stderr = result.communicate()
|
|
166
|
+
stdout_str = stdout.decode("utf-8")
|
|
167
|
+
## Format
|
|
168
|
+
# blastn: blastn: 2.12.0+
|
|
169
|
+
# Package: blast 2.12.0, build Jun 4 2021 03:25:07
|
|
170
|
+
self.BLASTn = stdout_str.split("\n")[0].split(" ")[1].strip()
|
|
171
|
+
# print("BLASTn", self.BLASTn)
|
|
172
|
+
|
|
173
|
+
### MMSeqs2
|
|
174
|
+
CMD = ["mmseqs", "-h"]
|
|
175
|
+
result = subprocess.Popen(
|
|
176
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
177
|
+
)
|
|
178
|
+
stdout, stderr = result.communicate()
|
|
179
|
+
stdout_str = stdout.decode("utf-8")
|
|
180
|
+
self.MMseqs2 = stdout_str.split("Version: ")[1].split("\n")[0].strip()
|
|
181
|
+
# print("MMseqs2", self.MMseqs2)
|
|
182
|
+
|
|
183
|
+
### MAFFT
|
|
184
|
+
CMD = ["mafft", "--version"]
|
|
185
|
+
result = subprocess.Popen(
|
|
186
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
187
|
+
)
|
|
188
|
+
stdout, stderr = result.communicate()
|
|
189
|
+
# MAFFT, output is on the stderr
|
|
190
|
+
stderr_str = stderr.decode("utf-8")
|
|
191
|
+
self.MAFFT = stderr_str.split("\n")[-2].split(" ")[0].strip()
|
|
192
|
+
# print("MAFFT", self.MAFFT)
|
|
193
|
+
|
|
194
|
+
### TrimAl
|
|
195
|
+
CMD = ["trimal", "--version"]
|
|
196
|
+
result = subprocess.Popen(
|
|
197
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
198
|
+
)
|
|
199
|
+
stdout, stderr = result.communicate()
|
|
200
|
+
stdout_str = stdout.decode("utf-8")
|
|
201
|
+
self.trimAl = stdout_str.split("\n")[1].split(" ")[1]
|
|
202
|
+
# print("trimAl", self.trimAl)
|
|
203
|
+
|
|
204
|
+
### Modeltest-ng
|
|
205
|
+
## Not supported in apple silicon
|
|
206
|
+
self.Modeltest_NG = "not supported"
|
|
207
|
+
|
|
208
|
+
### FastTree
|
|
209
|
+
## Also use stderr of FastTree
|
|
210
|
+
CMD = ["FastTree", "-expert"]
|
|
211
|
+
result = subprocess.Popen(
|
|
212
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
213
|
+
)
|
|
214
|
+
stdout, stderr = result.communicate()
|
|
215
|
+
stderr_str = stderr.decode("utf-8")
|
|
216
|
+
self.FastTree = stderr_str.split(" ")[4]
|
|
217
|
+
# print("FastTree", self.FastTree)
|
|
218
|
+
|
|
219
|
+
### IQTREE
|
|
220
|
+
CMD = ["iqtree", "--version"]
|
|
221
|
+
result = subprocess.Popen(
|
|
222
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
223
|
+
)
|
|
224
|
+
stdout, stderr = result.communicate()
|
|
225
|
+
stdout_str = stdout.decode("utf-8")
|
|
226
|
+
self.IQTREE2 = stdout_str.split(" ")[3]
|
|
227
|
+
# print("IQTREE2", self.IQTREE2)
|
|
228
|
+
|
|
229
|
+
### RAxML
|
|
230
|
+
if opt.avx is True:
|
|
231
|
+
CMD = ["raxmlHPC-PTHREADS-AVX2", "-v"]
|
|
232
|
+
else:
|
|
233
|
+
CMD = ["raxmlHPC-PTHREADS-SSE3", "-v"]
|
|
234
|
+
|
|
235
|
+
result = subprocess.Popen(
|
|
236
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
237
|
+
)
|
|
238
|
+
stdout, stderr = result.communicate()
|
|
239
|
+
stdout_str = stdout.decode("utf-8")
|
|
240
|
+
self.RAxML = stdout_str.split("\n")[2].split(" ")[4]
|
|
241
|
+
# print("RAxML", self.RAxML)
|
|
242
|
+
|
|
243
|
+
# For linux platform
|
|
244
|
+
else:
|
|
245
|
+
### FunVIP
|
|
246
|
+
self.FunVIP = version("FunVIP")
|
|
247
|
+
|
|
248
|
+
### GenMine
|
|
249
|
+
self.GenMine = version("GenMine")
|
|
250
|
+
|
|
251
|
+
### BLASTn
|
|
252
|
+
CMD = ["blastn", "-version"]
|
|
253
|
+
result = subprocess.Popen(
|
|
254
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
255
|
+
)
|
|
256
|
+
stdout, stderr = result.communicate()
|
|
257
|
+
stdout_str = stdout.decode("utf-8")
|
|
258
|
+
## Format
|
|
259
|
+
# blastn: blastn: 2.12.0+
|
|
260
|
+
# Package: blast 2.12.0, build Jun 4 2021 03:25:07
|
|
261
|
+
self.BLASTn = stdout_str.split("\n")[0].split(" ")[1].strip()
|
|
262
|
+
# print("BLASTn", self.BLASTn)
|
|
263
|
+
|
|
264
|
+
### MMSeqs2
|
|
265
|
+
CMD = ["mmseqs", "-h"]
|
|
266
|
+
result = subprocess.Popen(
|
|
267
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
268
|
+
)
|
|
269
|
+
stdout, stderr = result.communicate()
|
|
270
|
+
stdout_str = stdout.decode("utf-8")
|
|
271
|
+
self.MMseqs2 = stdout_str.split("Version: ")[1].split("\n")[0].strip()
|
|
272
|
+
# print("MMseqs2", self.MMseqs2)
|
|
273
|
+
|
|
274
|
+
### MAFFT
|
|
275
|
+
CMD = ["mafft", "--version"]
|
|
276
|
+
result = subprocess.Popen(
|
|
277
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
278
|
+
)
|
|
279
|
+
stdout, stderr = result.communicate()
|
|
280
|
+
# MAFFT, output is on the stderr
|
|
281
|
+
stderr_str = stderr.decode("utf-8")
|
|
282
|
+
self.MAFFT = stderr_str.split("\n")[-2].split(" ")[0].strip()
|
|
283
|
+
# print("MAFFT", self.MAFFT)
|
|
284
|
+
|
|
285
|
+
### TrimAl
|
|
286
|
+
CMD = ["trimal", "--version"]
|
|
287
|
+
result = subprocess.Popen(
|
|
288
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
289
|
+
)
|
|
290
|
+
stdout, stderr = result.communicate()
|
|
291
|
+
stdout_str = stdout.decode("utf-8")
|
|
292
|
+
self.trimAl = stdout_str.split("\n")[1].split(" ")[1]
|
|
293
|
+
# print("trimAl", self.trimAl)
|
|
294
|
+
|
|
295
|
+
### Modeltest-ng
|
|
296
|
+
## Not supported in Windows
|
|
297
|
+
CMD = ["modeltest-ng", "--version"]
|
|
298
|
+
result = subprocess.Popen(
|
|
299
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
300
|
+
)
|
|
301
|
+
stdout, stderr = result.communicate()
|
|
302
|
+
stdout_str = stdout.decode("utf-8")
|
|
303
|
+
self.Modeltest_NG = stdout_str.split("ModelTest-NG ")[1].split(" ")[0]
|
|
304
|
+
|
|
305
|
+
### FastTree
|
|
306
|
+
## Also use stderr of FastTree
|
|
307
|
+
CMD = ["FastTree", "-expert"]
|
|
308
|
+
result = subprocess.Popen(
|
|
309
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
310
|
+
)
|
|
311
|
+
stdout, stderr = result.communicate()
|
|
312
|
+
stderr_str = stderr.decode("utf-8")
|
|
313
|
+
self.FastTree = stderr_str.split(" ")[4]
|
|
314
|
+
# print("FastTree", self.FastTree)
|
|
315
|
+
|
|
316
|
+
### IQTREE
|
|
317
|
+
CMD = ["iqtree", "--version"]
|
|
318
|
+
result = subprocess.Popen(
|
|
319
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
320
|
+
)
|
|
321
|
+
stdout, stderr = result.communicate()
|
|
322
|
+
stdout_str = stdout.decode("utf-8")
|
|
323
|
+
self.IQTREE2 = stdout_str.split(" ")[3]
|
|
324
|
+
# print("IQTREE2", self.IQTREE2)
|
|
325
|
+
|
|
326
|
+
### RAxML
|
|
327
|
+
if opt.avx is True:
|
|
328
|
+
CMD = ["raxmlHPC-PTHREADS-AVX2", "-v"]
|
|
329
|
+
else:
|
|
330
|
+
CMD = ["raxmlHPC-PTHREADS-SSE3", "-v"]
|
|
331
|
+
|
|
332
|
+
result = subprocess.Popen(
|
|
333
|
+
CMD, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
334
|
+
)
|
|
335
|
+
stdout, stderr = result.communicate()
|
|
336
|
+
stdout_str = stdout.decode("utf-8")
|
|
337
|
+
self.RAxML = stdout_str.split("\n")[2].split(" ")[4]
|