kssdtree 2.0.0__tar.gz → 2.0.2__tar.gz
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.
- {kssdtree-2.0.0/kssdtree.egg-info → kssdtree-2.0.2}/PKG-INFO +1 -1
- {kssdtree-2.0.0 → kssdtree-2.0.2/kssdtree.egg-info}/PKG-INFO +1 -1
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdtree.egg-info/requires.txt +1 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdtree.py +127 -103
- {kssdtree-2.0.0 → kssdtree-2.0.2}/setup.py +10 -16
- {kssdtree-2.0.0 → kssdtree-2.0.2}/toolutils.py +5 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/MANIFEST.in +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/README.md +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/align.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/buildtree.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/bytescale.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/cluster.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/co2mco.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/command_composite.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/command_dist.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/command_dist_wrapper.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/command_set.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/command_shuffle.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/distancemat.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnj.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/bytescale.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/dnj.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/filebuff.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/hclust.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/matrix.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/mman.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/nj.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/nwck.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/pherror.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/phy.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/qseqs.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/str.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/threader.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/tmp.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/dnjheaders/vector.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/filebuff.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/global_basic.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/hclust.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/iseq2comem.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/co2mco.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/command_composite.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/command_dist.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/command_dist_wrapper.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/command_set.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/command_shuffle.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/global_basic.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/iseq2comem.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/mman.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdheaders/mytime.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdtree.egg-info/SOURCES.txt +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdtree.egg-info/dependency_links.txt +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdtree.egg-info/not-zip-safe +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/kssdtree.egg-info/top_level.txt +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/matrix.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/mman.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/mytime.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/nj.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/align.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/buildtree.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/cluster.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/distancemat.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/sequence.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/tree.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/njheaders/util.h +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/nwck.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/pherror.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/phy.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/pydnj.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/pykssd.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/pynj.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/qseqs.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/sequence.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/setup.cfg +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/str.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/tmp.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/tree.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/util.c +0 -0
- {kssdtree-2.0.0 → kssdtree-2.0.2}/vector.c +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: kssdtree
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Kssdtree is a versatile Python package for phylogenetic analysis. It also provides one-stop tree construction and visualization. It can handle DNA sequences of both fasta or fastq format, whether gzipped or not.
|
|
5
5
|
Home-page: https://github.com/yhlink/kssdtree
|
|
6
6
|
Download-URL: https://pypi.org/project/kssdtree
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: kssdtree
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Kssdtree is a versatile Python package for phylogenetic analysis. It also provides one-stop tree construction and visualization. It can handle DNA sequences of both fasta or fastq format, whether gzipped or not.
|
|
5
5
|
Home-page: https://github.com/yhlink/kssdtree
|
|
6
6
|
Download-URL: https://pypi.org/project/kssdtree
|
|
@@ -26,12 +26,15 @@ def sketch(shuf_file=None, genome_files=None, output=None, set_opt=None):
|
|
|
26
26
|
print('Genome format error for file:', filename)
|
|
27
27
|
return False
|
|
28
28
|
if not os.path.exists(shuf_file):
|
|
29
|
-
if shuf_file in ['L3K9.shuf', './L3K9.shuf']:
|
|
29
|
+
if shuf_file in ['L3K9.shuf', './L3K9.shuf', 'L3K10.shuf', './L3K10.shuf']:
|
|
30
30
|
print('Downloading...', shuf_file)
|
|
31
31
|
import http.client
|
|
32
32
|
http.client.HTTPConnection._http_vsn = 10
|
|
33
33
|
http.client.HTTPConnection._http_vsn_str = 'HTTP/1.0'
|
|
34
|
-
|
|
34
|
+
if shuf_file == 'L3K9.shuf' or shuf_file == './L3K9.shuf':
|
|
35
|
+
url = 'https://zenodo.org/records/12699159/files/L3K9.shuf?download=1'
|
|
36
|
+
else:
|
|
37
|
+
url = 'https://zenodo.org/records/12699159/files/L3K10.shuf?download=1'
|
|
35
38
|
start_time = time.time()
|
|
36
39
|
response = requests.get(url, stream=True)
|
|
37
40
|
with open(shuf_file, 'wb') as file:
|
|
@@ -41,11 +44,10 @@ def sketch(shuf_file=None, genome_files=None, output=None, set_opt=None):
|
|
|
41
44
|
end_time = time.time()
|
|
42
45
|
if end_time - start_time > 120:
|
|
43
46
|
print(
|
|
44
|
-
"Network timeout, please manually download from
|
|
47
|
+
"Network timeout, please manually download from https://zenodo.org/records/12699159")
|
|
45
48
|
return False
|
|
46
49
|
print('Download finished: ', shuf_file)
|
|
47
|
-
elif shuf_file in ['L2K8.shuf', '
|
|
48
|
-
'./L2K9.shuf', './L3K11.shuf']:
|
|
50
|
+
elif shuf_file in ['L2K8.shuf', 'L2K9.shuf', 'L3K11.shuf', './L2K8.shuf', './L2K9.shuf', './L3K11.shuf']:
|
|
49
51
|
print('Shuffling...', shuf_file)
|
|
50
52
|
file_name = shuf_file.split('.')[0]
|
|
51
53
|
k = int(file_name[3:])
|
|
@@ -74,14 +76,14 @@ def sketch(shuf_file=None, genome_files=None, output=None, set_opt=None):
|
|
|
74
76
|
return False
|
|
75
77
|
|
|
76
78
|
|
|
77
|
-
def dist(
|
|
78
|
-
if
|
|
79
|
-
if not os.path.exists(
|
|
80
|
-
print('No such file or directory: ',
|
|
81
|
-
return False
|
|
82
|
-
if not os.path.exists(qry_sketch):
|
|
83
|
-
print('No such file or directory: ', qry_sketch)
|
|
79
|
+
def dist(genome_sketch=None, output=None, flag=None):
|
|
80
|
+
if genome_sketch is not None and output is not None:
|
|
81
|
+
if not os.path.exists(genome_sketch):
|
|
82
|
+
print('No such file or directory: ', genome_sketch)
|
|
84
83
|
return False
|
|
84
|
+
# if not os.path.exists(qry_sketch):
|
|
85
|
+
# print('No such file or directory: ', qry_sketch)
|
|
86
|
+
# return False
|
|
85
87
|
if flag is None:
|
|
86
88
|
flag = 0
|
|
87
89
|
print('Disting...')
|
|
@@ -95,7 +97,7 @@ def dist(ref_sketch=None, qry_sketch=None, output=None, flag=None):
|
|
|
95
97
|
else:
|
|
96
98
|
output_name = output
|
|
97
99
|
if output_name.endswith(".phy") or output_name.endswith(".phylip"):
|
|
98
|
-
kssd.dist_dispatch(
|
|
100
|
+
kssd.dist_dispatch(genome_sketch, output, genome_sketch, 2, 0, flag)
|
|
99
101
|
end = time.time()
|
|
100
102
|
print('Dist spend time:%.2fs' % (end - start))
|
|
101
103
|
print('Dist finished!')
|
|
@@ -108,23 +110,26 @@ def dist(ref_sketch=None, qry_sketch=None, output=None, flag=None):
|
|
|
108
110
|
return False
|
|
109
111
|
|
|
110
112
|
|
|
111
|
-
def retrieve(
|
|
112
|
-
if
|
|
113
|
+
def retrieve(database=None, genome_sketch=None, output=None, N=None, method=None):
|
|
114
|
+
if database is not None and genome_sketch is not None and output is not None:
|
|
113
115
|
if method is None:
|
|
114
116
|
method = 'nj'
|
|
115
117
|
if method not in ['nj', 'dnj']:
|
|
116
118
|
print('Only support nj and dnj methods!!!')
|
|
117
119
|
return
|
|
118
|
-
if not os.path.exists(
|
|
119
|
-
print('No such file or directory: ',
|
|
120
|
+
if not os.path.exists(genome_sketch):
|
|
121
|
+
print('No such file or directory: ', genome_sketch)
|
|
120
122
|
return False
|
|
121
|
-
if
|
|
123
|
+
if database == 'gtdbr214':
|
|
122
124
|
print('Retrieving...')
|
|
123
125
|
start = time.time()
|
|
124
126
|
if not os.path.exists(output):
|
|
125
127
|
os.makedirs(output)
|
|
126
128
|
print("Created directory:", output)
|
|
127
|
-
|
|
129
|
+
else:
|
|
130
|
+
print('Output path exist!!!')
|
|
131
|
+
return False
|
|
132
|
+
newick, accession_taxonomy = toolutils.upload_request(qry_sketch=genome_sketch, method=method, N=N)
|
|
128
133
|
if newick is None:
|
|
129
134
|
print('Server error!!!')
|
|
130
135
|
return False
|
|
@@ -138,7 +143,7 @@ def retrieve(ref_sketch=None, qry_sketch=None, output=None, N=None, method=None)
|
|
|
138
143
|
print('Retrieve finished!')
|
|
139
144
|
return True
|
|
140
145
|
else:
|
|
141
|
-
print("
|
|
146
|
+
print("database only support 'gtdbr214'")
|
|
142
147
|
return False
|
|
143
148
|
else:
|
|
144
149
|
print('Args error!!!')
|
|
@@ -184,6 +189,12 @@ def build(phylip=None, output=None, method=None):
|
|
|
184
189
|
print('Build spend time:%.2fs' % (end - start))
|
|
185
190
|
print('Build finished!')
|
|
186
191
|
return True
|
|
192
|
+
else:
|
|
193
|
+
print('phylip format error, Check that the phylip format is consistent with NJ or DNJ requirements!!!')
|
|
194
|
+
return False
|
|
195
|
+
else:
|
|
196
|
+
print('Output type error, only supports .newick (.nwk) format:', output_name)
|
|
197
|
+
return False
|
|
187
198
|
else:
|
|
188
199
|
print('Args error!!!')
|
|
189
200
|
return False
|
|
@@ -196,7 +207,12 @@ def visualize(newick=None, taxonomy=None, mode=None):
|
|
|
196
207
|
return False
|
|
197
208
|
if mode is None:
|
|
198
209
|
mode = 'r'
|
|
199
|
-
|
|
210
|
+
if taxonomy is not None and mode == 'c':
|
|
211
|
+
print('Warning: this pipeline only support 'r' (rectangle) mode !!!')
|
|
212
|
+
mode = 'r'
|
|
213
|
+
toolutils.view_tree(newick, taxonomy, mode=mode)
|
|
214
|
+
else:
|
|
215
|
+
toolutils.view_tree(newick, taxonomy, mode=mode)
|
|
200
216
|
else:
|
|
201
217
|
print('Args error!!!')
|
|
202
218
|
return False
|
|
@@ -266,9 +282,12 @@ def subtract(ref_sketch=None, genome_sketch=None, output=None, flag=None):
|
|
|
266
282
|
return False
|
|
267
283
|
|
|
268
284
|
|
|
269
|
-
def quick(shuf_file=None, genome_files=None, output=None, reference=None,
|
|
270
|
-
if reference is None and
|
|
285
|
+
def quick(shuf_file=None, genome_files=None, output=None, reference=None, database=None, method='nj', mode='r', N=0):
|
|
286
|
+
if reference is None and database is None:
|
|
271
287
|
if shuf_file is not None and genome_files is not None and output is not None:
|
|
288
|
+
if toolutils.is_positive_integer(N) or toolutils.is_negative_integer(N):
|
|
289
|
+
print("N must = 0 !!!")
|
|
290
|
+
return False
|
|
272
291
|
timeStamp = int(time.mktime(time.localtime(time.time())))
|
|
273
292
|
temp_sketch = toolutils.rs() + '_sketch_' + str(timeStamp)
|
|
274
293
|
temp_phy = toolutils.rs() + '_temp.phy'
|
|
@@ -286,9 +305,9 @@ def quick(shuf_file=None, genome_files=None, output=None, reference=None, taxono
|
|
|
286
305
|
return False
|
|
287
306
|
print('Step2...')
|
|
288
307
|
if method == 'nj':
|
|
289
|
-
s2 = dist(
|
|
308
|
+
s2 = dist(genome_sketch=temp_sketch, output=temp_phy, flag=0)
|
|
290
309
|
else:
|
|
291
|
-
s2 = dist(
|
|
310
|
+
s2 = dist(genome_sketch=temp_sketch, output=temp_phy, flag=1)
|
|
292
311
|
if not s2:
|
|
293
312
|
return False
|
|
294
313
|
print('Step3...')
|
|
@@ -297,7 +316,7 @@ def quick(shuf_file=None, genome_files=None, output=None, reference=None, taxono
|
|
|
297
316
|
return False
|
|
298
317
|
print('Step4...')
|
|
299
318
|
print('Tree visualization finished!')
|
|
300
|
-
visualize(newick=output,
|
|
319
|
+
visualize(newick=output, mode=mode)
|
|
301
320
|
if platform.system() == 'Linux':
|
|
302
321
|
current_directory = os.getcwd()
|
|
303
322
|
temp_dir1 = os.path.join(current_directory, temp_sketch)
|
|
@@ -311,11 +330,10 @@ def quick(shuf_file=None, genome_files=None, output=None, reference=None, taxono
|
|
|
311
330
|
else:
|
|
312
331
|
print('Args error, please see https://kssdtree.readthedocs.io/en/latest!!!')
|
|
313
332
|
return False
|
|
314
|
-
|
|
315
|
-
elif reference == 'gtdbr214_sketch' and taxonomy is None:
|
|
333
|
+
elif reference is None and database == 'gtdbr214':
|
|
316
334
|
if shuf_file is not None and genome_files is not None and output is not None:
|
|
317
335
|
if not toolutils.is_positive_integer(N):
|
|
318
|
-
print("N must >0 !!!")
|
|
336
|
+
print("N must > 0 !!!")
|
|
319
337
|
return False
|
|
320
338
|
if shuf_file != 'L3K9.shuf':
|
|
321
339
|
print("shuf_file must be set to 'L3K9.shuf'")
|
|
@@ -325,7 +343,7 @@ def quick(shuf_file=None, genome_files=None, output=None, reference=None, taxono
|
|
|
325
343
|
s1 = sketch(shuf_file=shuf_file, genome_files=genome_files, output=qry_sketch, set_opt=True)
|
|
326
344
|
if not s1:
|
|
327
345
|
return False
|
|
328
|
-
s2 = retrieve(
|
|
346
|
+
s2 = retrieve(database=database, genome_sketch=qry_sketch, output=output, N=N, method=method)
|
|
329
347
|
if not s2:
|
|
330
348
|
return False
|
|
331
349
|
print('Tree visualization finished!')
|
|
@@ -342,82 +360,88 @@ def quick(shuf_file=None, genome_files=None, output=None, reference=None, taxono
|
|
|
342
360
|
else:
|
|
343
361
|
print('Args error, please see https://kssdtree.readthedocs.io/en/latest!!!')
|
|
344
362
|
return False
|
|
345
|
-
|
|
363
|
+
elif reference is not None and database is None:
|
|
346
364
|
if shuf_file is not None and genome_files is not None and output is not None and method in ['nj', 'dnj']:
|
|
347
|
-
if
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
print('genome_files is a folder containing at least two . fasta or .fastq files, not a file!!!')
|
|
365
|
+
if toolutils.is_positive_integer(N) or toolutils.is_negative_integer(N):
|
|
366
|
+
print("N must = 0 !!!")
|
|
367
|
+
return False
|
|
368
|
+
if not toolutils.allowed_file(genome_files):
|
|
369
|
+
num = toolutils.get_file_num(genome_files)
|
|
370
|
+
if num == 1:
|
|
371
|
+
print('genome_files is a folder containing at least two . fasta or .fastq files!!!')
|
|
355
372
|
return False
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
else:
|
|
373
|
+
else:
|
|
374
|
+
print('genome_files is a folder containing at least two . fasta or .fastq files, not a file!!!')
|
|
375
|
+
return False
|
|
376
|
+
timeStamp = int(time.mktime(time.localtime(time.time())))
|
|
377
|
+
temp_reference_sketch = toolutils.rs() + '_ref_sketch_' + str(timeStamp)
|
|
378
|
+
temp_genomes_sketch = toolutils.rs() + '_sketch_' + str(timeStamp)
|
|
379
|
+
if not toolutils.allowed_file(reference):
|
|
380
|
+
# cur_path = os.getcwd()
|
|
381
|
+
# ref_path = os.path.join(cur_path, reference)
|
|
382
|
+
num = toolutils.get_file_num(reference)
|
|
383
|
+
if num == 1:
|
|
368
384
|
temp_union_sketch = temp_reference_sketch
|
|
369
|
-
temp_subtract_sketch = toolutils.rs() + '_subtract_sketch_' + str(timeStamp)
|
|
370
|
-
temp_phy = toolutils.rs() +'_temp.phy'
|
|
371
|
-
print('Step1...')
|
|
372
|
-
s1 = sketch(shuf_file=shuf_file, genome_files=reference, output=temp_reference_sketch, set_opt=True)
|
|
373
|
-
if not s1:
|
|
374
|
-
return False
|
|
375
|
-
s2 = sketch(shuf_file=shuf_file, genome_files=genome_files, output=temp_genomes_sketch, set_opt=True)
|
|
376
|
-
if not s2:
|
|
377
|
-
return False
|
|
378
|
-
print('Step2...')
|
|
379
|
-
s3 = union(ref_sketch=temp_reference_sketch, output=temp_union_sketch)
|
|
380
|
-
if not s3:
|
|
381
|
-
return False
|
|
382
|
-
s4 = subtract(ref_sketch=temp_union_sketch, genome_sketch=temp_genomes_sketch,
|
|
383
|
-
output=temp_subtract_sketch, flag=1)
|
|
384
|
-
if not s4:
|
|
385
|
-
return False
|
|
386
|
-
print('Step3...')
|
|
387
|
-
if method == 'nj':
|
|
388
|
-
s5 = dist(ref_sketch=temp_subtract_sketch, qry_sketch=temp_subtract_sketch, output=temp_phy,
|
|
389
|
-
flag=0)
|
|
390
385
|
else:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if os.path.exists(temp_dir4):
|
|
416
|
-
shutil.rmtree(temp_dir4)
|
|
417
|
-
if os.path.exists(temp_dir5):
|
|
418
|
-
shutil.rmtree(temp_dir5)
|
|
419
|
-
if os.path.exists(temp_phy):
|
|
420
|
-
os.remove(temp_phy)
|
|
386
|
+
temp_union_sketch = toolutils.rs() + '_ref_union_sketch_' + str(timeStamp)
|
|
387
|
+
else:
|
|
388
|
+
temp_union_sketch = temp_reference_sketch
|
|
389
|
+
temp_subtract_sketch = toolutils.rs() + '_subtract_sketch_' + str(timeStamp)
|
|
390
|
+
temp_phy = toolutils.rs() + '_temp.phy'
|
|
391
|
+
print('Step1...')
|
|
392
|
+
s1 = sketch(shuf_file=shuf_file, genome_files=reference, output=temp_reference_sketch, set_opt=True)
|
|
393
|
+
if not s1:
|
|
394
|
+
return False
|
|
395
|
+
s2 = sketch(shuf_file=shuf_file, genome_files=genome_files, output=temp_genomes_sketch, set_opt=True)
|
|
396
|
+
if not s2:
|
|
397
|
+
return False
|
|
398
|
+
print('Step2...')
|
|
399
|
+
s3 = union(ref_sketch=temp_reference_sketch, output=temp_union_sketch)
|
|
400
|
+
if not s3:
|
|
401
|
+
return False
|
|
402
|
+
s4 = subtract(ref_sketch=temp_union_sketch, genome_sketch=temp_genomes_sketch,
|
|
403
|
+
output=temp_subtract_sketch, flag=1)
|
|
404
|
+
if not s4:
|
|
405
|
+
return False
|
|
406
|
+
print('Step3...')
|
|
407
|
+
if method == 'nj':
|
|
408
|
+
s5 = dist(genome_sketch=temp_subtract_sketch, output=temp_phy,
|
|
409
|
+
flag=0)
|
|
421
410
|
else:
|
|
422
|
-
|
|
411
|
+
s5 = dist(genome_sketch=temp_subtract_sketch, output=temp_phy,
|
|
412
|
+
flag=1)
|
|
413
|
+
if not s5:
|
|
423
414
|
return False
|
|
415
|
+
print('Step4...')
|
|
416
|
+
s6 = build(phylip=temp_phy, output=output, method=method)
|
|
417
|
+
if not s6:
|
|
418
|
+
return False
|
|
419
|
+
print('Step5...')
|
|
420
|
+
print('Tree visualization finished!')
|
|
421
|
+
visualize(newick=output, mode=mode)
|
|
422
|
+
if platform.system() == 'Linux':
|
|
423
|
+
current_directory = os.getcwd()
|
|
424
|
+
temp_dir1 = os.path.join(current_directory, temp_reference_sketch)
|
|
425
|
+
temp_dir2 = os.path.join(current_directory, temp_genomes_sketch)
|
|
426
|
+
temp_dir3 = os.path.join(current_directory, temp_union_sketch)
|
|
427
|
+
temp_dir4 = os.path.join(current_directory, temp_subtract_sketch)
|
|
428
|
+
temp_dir5 = os.path.join(current_directory, 'distout')
|
|
429
|
+
if os.path.exists(temp_dir1):
|
|
430
|
+
shutil.rmtree(temp_dir1)
|
|
431
|
+
if os.path.exists(temp_dir2):
|
|
432
|
+
shutil.rmtree(temp_dir2)
|
|
433
|
+
if os.path.exists(temp_dir3):
|
|
434
|
+
shutil.rmtree(temp_dir3)
|
|
435
|
+
if os.path.exists(temp_dir4):
|
|
436
|
+
shutil.rmtree(temp_dir4)
|
|
437
|
+
if os.path.exists(temp_dir5):
|
|
438
|
+
shutil.rmtree(temp_dir5)
|
|
439
|
+
if os.path.exists(temp_phy):
|
|
440
|
+
os.remove(temp_phy)
|
|
441
|
+
else:
|
|
442
|
+
print('Args error, please see https://kssdtree.readthedocs.io/en/latest!!!')
|
|
443
|
+
return False
|
|
444
|
+
|
|
445
|
+
else:
|
|
446
|
+
print('Pipeline error, please see https://kssdtree.readthedocs.io/en/latest!!!')
|
|
447
|
+
return False
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
|
|
3
2
|
from setuptools import setup, Extension, find_packages
|
|
4
3
|
from os import environ
|
|
5
|
-
import subprocess
|
|
6
4
|
import os
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
# def get_gcc_version():
|
|
7
|
+
# gcc_version = subprocess.check_output(['gcc', '--version']).decode('utf-8')
|
|
8
|
+
# version_line = gcc_version.split('\n', 1)[0]
|
|
9
|
+
# version_str = version_line.split()[-1]
|
|
10
|
+
# return version_str
|
|
11
|
+
extra_compile_args = []
|
|
12
|
+
extra_link_args = []
|
|
15
13
|
if 'darwin' in sys.platform:
|
|
16
14
|
target_dirs = ["gcc-9", "gcc-10", "gcc-11", "gcc-12", "gcc-13", "gcc-14", "gcc-15"]
|
|
17
15
|
path = "/opt/homebrew/bin/"
|
|
@@ -32,12 +30,10 @@ if 'darwin' in sys.platform:
|
|
|
32
30
|
gcc_path = "/opt/homebrew/bin/gcc-15"
|
|
33
31
|
else:
|
|
34
32
|
gcc_path = "/opt/homebrew/bin/gcc-13"
|
|
35
|
-
gcc_command = 'gcc-' + str(gcc_version)
|
|
36
33
|
extra_compile_args = ['-fopenmp']
|
|
37
34
|
extra_link_args = ['-fopenmp']
|
|
38
35
|
os.environ["CC"] = gcc_path
|
|
39
36
|
else:
|
|
40
|
-
gcc_command = 'gcc'
|
|
41
37
|
if environ.get('CC') and 'clang' in environ['CC']:
|
|
42
38
|
# clang
|
|
43
39
|
extra_compile_args = ['-fopenmp=libomp']
|
|
@@ -90,13 +86,13 @@ include_dirs3 = ['dnjheaders']
|
|
|
90
86
|
require_pakages = [
|
|
91
87
|
'pyqt5',
|
|
92
88
|
'ete3',
|
|
93
|
-
'requests'
|
|
89
|
+
'requests',
|
|
90
|
+
'pandas'
|
|
94
91
|
]
|
|
95
92
|
|
|
96
|
-
|
|
97
93
|
setup(
|
|
98
94
|
name='kssdtree',
|
|
99
|
-
version='2.0.
|
|
95
|
+
version='2.0.2',
|
|
100
96
|
author='Hang Yang',
|
|
101
97
|
author_email='yhlink1207@gmail.com',
|
|
102
98
|
description="Kssdtree is a versatile Python package for phylogenetic analysis. It also provides one-stop tree construction and visualization. It can handle DNA sequences of both fasta or fastq format, whether gzipped or not. ",
|
|
@@ -118,5 +114,3 @@ setup(
|
|
|
118
114
|
zip_safe=False,
|
|
119
115
|
include_package_data=True
|
|
120
116
|
)
|
|
121
|
-
|
|
122
|
-
|
|
@@ -24,6 +24,11 @@ def is_positive_integer(num):
|
|
|
24
24
|
else:
|
|
25
25
|
return False
|
|
26
26
|
|
|
27
|
+
def is_negative_integer(num):
|
|
28
|
+
if isinstance(num, int) and num < 0:
|
|
29
|
+
return True
|
|
30
|
+
else:
|
|
31
|
+
return False
|
|
27
32
|
|
|
28
33
|
def randomcolor():
|
|
29
34
|
colorArr = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|