TreeSAK 1.8.4__tar.gz → 1.9.0__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.
- {TreeSAK-1.8.4/TreeSAK.egg-info → TreeSAK-1.9.0}/PKG-INFO +2 -2
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/README.md +0 -6
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/AssessMarkerDeltaLL.py +4 -0
- TreeSAK-1.9.0/TreeSAK/Dating.py +168 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/VERSION +3 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0/TreeSAK.egg-info}/PKG-INFO +2 -2
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK.egg-info/SOURCES.txt +1 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/bin/TreeSAK +18 -2
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/.gitignore +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/LICENSE +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/MANIFEST.in +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/AssessMarker.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/AssessMarkerPA.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/KEGG_Luo17.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/Marker2Tree.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/TreeSAK_config copy.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/global_functions.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/iTOL.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/parse_deltall_stdout.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/subset_tree.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK/test_1.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/bin/__init__.py +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/images/Bioinformatics.jpg +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/images/windows_cmds.docx +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/images/windows_cmds.pdf +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/setup.cfg +0 -0
- {TreeSAK-1.8.4 → TreeSAK-1.9.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/TreeSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -10,5 +10,5 @@ Keywords: Bioinformatics
|
|
|
10
10
|
Platform: UNKNOWN
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
|
|
13
|
-
TreeSAK v1.
|
|
13
|
+
TreeSAK v1.9.0
|
|
14
14
|
|
|
@@ -31,11 +31,8 @@ TreeSAK modules
|
|
|
31
31
|
...::: TreeSAK v1.7.7 :::...
|
|
32
32
|
|
|
33
33
|
Marker-related
|
|
34
|
-
parse_deltall_stdout -> Parse stdout of deltaLL.rb
|
|
35
34
|
get_arCOG_seq -> Retrieve arCOG sequences
|
|
36
|
-
Marker2Tree -> Marker to Tree
|
|
37
35
|
AssessMarkerPA -> Assess Markers by P/A among groups
|
|
38
|
-
AssessMarkerDeltaLL -> Assess Markers by DeltaLL
|
|
39
36
|
|
|
40
37
|
Multiple Sequence Alignment
|
|
41
38
|
ConvertMSA -> Convert MSA format
|
|
@@ -48,6 +45,3 @@ TreeSAK modules
|
|
|
48
45
|
compare_trees -> Compare trees with Mantel test
|
|
49
46
|
rename_leaves -> Rename tree leaves
|
|
50
47
|
FLN -> Format leaf names (e.g. remove spaces in names)
|
|
51
|
-
|
|
52
|
-
Dating-related
|
|
53
|
-
AssessCVG -> Assess dating convergence
|
|
@@ -239,6 +239,10 @@ def AssessMarkerDeltaLL(args):
|
|
|
239
239
|
else:
|
|
240
240
|
print('Job script for running iqtree exported to %s' % pwd_iqtree_js)
|
|
241
241
|
|
|
242
|
+
# prepare files for performing dating
|
|
243
|
+
print('Preparing files for performing dating')
|
|
244
|
+
|
|
245
|
+
|
|
242
246
|
|
|
243
247
|
if __name__ == '__main__':
|
|
244
248
|
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Dating_usage = '''
|
|
6
|
+
============================= Dating example commands =============================
|
|
7
|
+
|
|
8
|
+
Dependencies:
|
|
9
|
+
|
|
10
|
+
# example commands
|
|
11
|
+
TreeSAK Dating -deltall DeltaLL_stdout.txt -aod s11_marker_sets_by_DeltaLL -o s12_dating_wd -c 25-50-75-100 -mmn 20 -f
|
|
12
|
+
|
|
13
|
+
===================================================================================
|
|
14
|
+
'''
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def sep_path_basename_ext(file_in):
|
|
18
|
+
|
|
19
|
+
# separate path and file name
|
|
20
|
+
file_path, file_name = os.path.split(file_in)
|
|
21
|
+
if file_path == '':
|
|
22
|
+
file_path = '.'
|
|
23
|
+
|
|
24
|
+
# separate file basename and extension
|
|
25
|
+
file_basename, file_extension = os.path.splitext(file_name)
|
|
26
|
+
|
|
27
|
+
return file_path, file_basename, file_extension
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def submit_js(js):
|
|
31
|
+
current_wd = os.getcwd()
|
|
32
|
+
js_path, js_basename, js_ext = sep_path_basename_ext(js)
|
|
33
|
+
os.chdir(js_path)
|
|
34
|
+
os.system('qsub %s%s' % (js_basename, js_ext))
|
|
35
|
+
os.chdir(current_wd)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def Dating(args):
|
|
39
|
+
|
|
40
|
+
deltall_stdout_txt = args['deltall']
|
|
41
|
+
aod = args['aod']
|
|
42
|
+
op_dir = args['o']
|
|
43
|
+
deltall_keep_pct_str = args['c']
|
|
44
|
+
min_marker_num = args['mmn']
|
|
45
|
+
js_cpu_num = args['jst']
|
|
46
|
+
force_overwrite = args['f']
|
|
47
|
+
|
|
48
|
+
deltall_keep_pct_list = [int(i) for i in deltall_keep_pct_str.split('-')]
|
|
49
|
+
deltall_stdout_path, deltall_stdout_basename, deltall_stdout_ext = sep_path_basename_ext(deltall_stdout_txt)
|
|
50
|
+
|
|
51
|
+
# create dir
|
|
52
|
+
if os.path.isdir(op_dir) is True:
|
|
53
|
+
if force_overwrite is True:
|
|
54
|
+
os.system('rm -r %s' % op_dir)
|
|
55
|
+
else:
|
|
56
|
+
print('output folder detected, program exited!')
|
|
57
|
+
exit()
|
|
58
|
+
os.system('mkdir %s' % op_dir)
|
|
59
|
+
|
|
60
|
+
# read in deltall_stdout_txt
|
|
61
|
+
deltall_op_dict = dict()
|
|
62
|
+
for each_line in open(deltall_stdout_txt):
|
|
63
|
+
if not ((each_line.startswith('WARNING:')) or (each_line.startswith('awk:'))):
|
|
64
|
+
each_line_split = each_line.strip().split('\t')
|
|
65
|
+
marker_id = each_line_split[0]
|
|
66
|
+
value = float(each_line_split[1])
|
|
67
|
+
if marker_id not in deltall_op_dict:
|
|
68
|
+
deltall_op_dict[marker_id] = [value]
|
|
69
|
+
else:
|
|
70
|
+
deltall_op_dict[marker_id].append(value)
|
|
71
|
+
|
|
72
|
+
# assigned score to marker
|
|
73
|
+
metric_1_dict = dict()
|
|
74
|
+
metric_2_dict = dict()
|
|
75
|
+
for each_marker in deltall_op_dict:
|
|
76
|
+
metric_1_value = float("{0:.2f}".format(deltall_op_dict[each_marker][0]))
|
|
77
|
+
metric_2_value = float("{0:.2f}".format(deltall_op_dict[each_marker][1]))
|
|
78
|
+
metric_1_dict[each_marker] = metric_1_value
|
|
79
|
+
metric_2_dict[each_marker] = metric_2_value
|
|
80
|
+
|
|
81
|
+
metric_1_dict_sorted = {k: v for k, v in sorted(metric_1_dict.items(), key=lambda item: item[1])[::-1]}
|
|
82
|
+
metric_2_dict_sorted = {k: v for k, v in sorted(metric_2_dict.items(), key=lambda item: item[1])}
|
|
83
|
+
|
|
84
|
+
metric_1_score_dict = dict()
|
|
85
|
+
metric_1_score = 1
|
|
86
|
+
for each_marker_1 in metric_1_dict_sorted:
|
|
87
|
+
metric_1_score_dict[each_marker_1] = metric_1_score
|
|
88
|
+
metric_1_score += 1
|
|
89
|
+
|
|
90
|
+
metric_2_score_dict = dict()
|
|
91
|
+
metric_2_score = 1
|
|
92
|
+
for each_marker_2 in metric_2_dict_sorted:
|
|
93
|
+
metric_2_score_dict[each_marker_2] = metric_2_score
|
|
94
|
+
metric_2_score += 1
|
|
95
|
+
|
|
96
|
+
overall_score_dict = dict()
|
|
97
|
+
for each_marker in deltall_op_dict:
|
|
98
|
+
metric_score_1 = metric_1_score_dict[each_marker]
|
|
99
|
+
metric_score_2 = metric_2_score_dict[each_marker]
|
|
100
|
+
metric_score_overall = metric_score_1 + metric_score_2
|
|
101
|
+
overall_score_dict[each_marker] = metric_score_overall
|
|
102
|
+
marker_list_sorted_by_deltall = [k for k, v in sorted(overall_score_dict.items(), key=lambda item: item[1])]
|
|
103
|
+
|
|
104
|
+
# get qualified marker list
|
|
105
|
+
for each_keep_pct in deltall_keep_pct_list:
|
|
106
|
+
marker_num_to_keep = round(len(marker_list_sorted_by_deltall)*each_keep_pct/100)
|
|
107
|
+
|
|
108
|
+
if marker_num_to_keep < min_marker_num:
|
|
109
|
+
print('Ignored DeltaLL cutoff at %s , the number of qualified markers (%s) less than %s' % (each_keep_pct, marker_num_to_keep, min_marker_num))
|
|
110
|
+
else:
|
|
111
|
+
pwd_aln_concatenated = '%s/%s_DeltaLL_%s_concatenated.phy' % (aod, deltall_stdout_basename.split('_DeltaLL_stdout')[0], each_keep_pct)
|
|
112
|
+
pwd_c60_tree_file = '%s/%s_DeltaLL_%s_iqtree_C60_PMSF/concatenated.treefile' % (aod, deltall_stdout_basename.split('_DeltaLL_stdout')[0], each_keep_pct)
|
|
113
|
+
current_dating_wd = '%s/%s_DeltaLL_%s' % (op_dir, deltall_stdout_basename.split('_DeltaLL_stdout')[0], each_keep_pct)
|
|
114
|
+
pwd_c60_tree_file_renamed = '%s/concatenated_raw.treefile' % current_dating_wd
|
|
115
|
+
pwd_to_do_note_txt = '%s/to_do.txt' % current_dating_wd
|
|
116
|
+
pwd_dating_js = '%s/js_%s_DeltaLL_%s_dating.sh' % (op_dir, deltall_stdout_basename.split('_DeltaLL_stdout')[0], each_keep_pct)
|
|
117
|
+
|
|
118
|
+
print('Alignment:\t%s' % pwd_aln_concatenated)
|
|
119
|
+
print('Tree file:\t%s' % pwd_c60_tree_file)
|
|
120
|
+
print('Dating wd:\t%s' % current_dating_wd)
|
|
121
|
+
print()
|
|
122
|
+
|
|
123
|
+
# create dating wd and copy file into it
|
|
124
|
+
os.mkdir(current_dating_wd)
|
|
125
|
+
os.system('cp %s %s' % (pwd_c60_tree_file, pwd_c60_tree_file_renamed))
|
|
126
|
+
os.system('cp %s %s/' % (pwd_aln_concatenated, current_dating_wd))
|
|
127
|
+
|
|
128
|
+
# write out to do
|
|
129
|
+
with open(pwd_to_do_note_txt, 'w') as pwd_to_do_note_txt_handle:
|
|
130
|
+
pwd_to_do_note_txt_handle.write('1. Root the tree in iTOL\n')
|
|
131
|
+
pwd_to_do_note_txt_handle.write('2. Replace the eukaryotic clade with the one has EU time constraints using TreeGraph2\n')
|
|
132
|
+
pwd_to_do_note_txt_handle.write('3. Add time constraints to the tree\n')
|
|
133
|
+
pwd_to_do_note_txt_handle.write('4. Renamed the modified tree to concatenated_modified.treefile\n')
|
|
134
|
+
|
|
135
|
+
# write job script
|
|
136
|
+
with open(pwd_dating_js, 'w') as pwd_dating_js_handle:
|
|
137
|
+
dating_cmd = ''
|
|
138
|
+
pwd_dating_js_handle.write('cd %s/%s\n' % (os.getcwd(), current_dating_wd))
|
|
139
|
+
pwd_dating_js_handle.write(dating_cmd + '\n')
|
|
140
|
+
|
|
141
|
+
if submit_job is True:
|
|
142
|
+
print(pwd_dating_js)
|
|
143
|
+
submit_js(pwd_dating_js)
|
|
144
|
+
else:
|
|
145
|
+
print('Job script for dating exported to %s' % pwd_dating_js)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if __name__ == '__main__':
|
|
149
|
+
|
|
150
|
+
# initialize the options parser
|
|
151
|
+
parser = argparse.ArgumentParser()
|
|
152
|
+
parser.add_argument('-deltall', required=True, help='DeltaLL stdout')
|
|
153
|
+
parser.add_argument('-aod', required=True, help='AssessMarkerDeltaLL output dir')
|
|
154
|
+
parser.add_argument('-o', required=True, help='dating wd')
|
|
155
|
+
parser.add_argument('-c', required=False, default='25-50-75-100', help='cutoffs, default: 25-50-75-100')
|
|
156
|
+
parser.add_argument('-mmn', required=False, default=20, type=int, help='minimal marker number, default: 20')
|
|
157
|
+
parser.add_argument('-jst', required=False, default='6', help='threads to request in job script, for performing dating')
|
|
158
|
+
parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
159
|
+
args = vars(parser.parse_args())
|
|
160
|
+
Dating(args)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
'''
|
|
164
|
+
|
|
165
|
+
cd /Users/songweizhi/Desktop/dating_test
|
|
166
|
+
python3 /Users/songweizhi/PycharmProjects/TreeSAK/TreeSAK/Dating.py -deltall Marker_set_2_Betts_2018_29_arCOG_Marker2Tree_e30/s10_assess_marker_deltaLL/PA_75_DeltaLL_stdout.txt -aod Marker_set_2_Betts_2018_29_arCOG_Marker2Tree_e30/s11_marker_sets_by_DeltaLL -o Marker_set_2_Betts_2018_29_arCOG_Marker2Tree_e30/s12_dating_wd -c 25-50-75-100 -mmn 20 -f
|
|
167
|
+
|
|
168
|
+
'''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/TreeSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -10,5 +10,5 @@ Keywords: Bioinformatics
|
|
|
10
10
|
Platform: UNKNOWN
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
|
|
13
|
-
TreeSAK v1.
|
|
13
|
+
TreeSAK v1.9.0
|
|
14
14
|
|
|
@@ -35,9 +35,7 @@ def print_main_help():
|
|
|
35
35
|
Marker-related
|
|
36
36
|
parse_deltall_stdout -> Parse stdout of deltaLL.rb
|
|
37
37
|
get_arCOG_seq -> Retrieve arCOG sequences
|
|
38
|
-
Marker2Tree -> Marker to Tree
|
|
39
38
|
AssessMarkerPA -> Assess Markers by P/A among groups
|
|
40
|
-
AssessMarkerDeltaLL -> Assess Markers by DeltaLL
|
|
41
39
|
|
|
42
40
|
Multiple Sequence Alignment
|
|
43
41
|
ConvertMSA -> Convert MSA format
|
|
@@ -54,6 +52,11 @@ def print_main_help():
|
|
|
54
52
|
Dating-related
|
|
55
53
|
AssessCVG -> Assess dating convergence
|
|
56
54
|
|
|
55
|
+
Dating workflow
|
|
56
|
+
Marker2Tree -> Marker to Tree
|
|
57
|
+
AssessMarkerDeltaLL -> Assess Markers by DeltaLL
|
|
58
|
+
Dating -> Perform dating
|
|
59
|
+
|
|
57
60
|
''' % version(config_dict)
|
|
58
61
|
|
|
59
62
|
print(help_message)
|
|
@@ -242,6 +245,19 @@ if __name__ == '__main__':
|
|
|
242
245
|
args = vars(parser.parse_args())
|
|
243
246
|
AssessMarkerDeltaLL.AssessMarkerDeltaLL(args)
|
|
244
247
|
|
|
248
|
+
elif sys.argv[1] == 'Dating':
|
|
249
|
+
from TreeSAK import Dating
|
|
250
|
+
Dating_parser = subparsers.add_parser('Dating', usage=Dating.Dating_usage)
|
|
251
|
+
Dating_parser.add_argument('-deltall', required=True, help='DeltaLL stdout')
|
|
252
|
+
Dating_parser.add_argument('-aod', required=True, help='AssessMarkerDeltaLL output dir')
|
|
253
|
+
Dating_parser.add_argument('-o', required=True, help='dating wd')
|
|
254
|
+
Dating_parser.add_argument('-c', required=False, default='25-50-75-100', help='cutoffs, default: 25-50-75-100')
|
|
255
|
+
Dating_parser.add_argument('-mmn', required=False, default=20, type=int, help='minimal marker number, default: 20')
|
|
256
|
+
Dating_parser.add_argument('-jst', required=False, default='6', help='threads to request in job script, for performing dating')
|
|
257
|
+
Dating_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
258
|
+
args = vars(parser.parse_args())
|
|
259
|
+
Dating.Dating(args)
|
|
260
|
+
|
|
245
261
|
else:
|
|
246
262
|
print('Unrecognized command: %s, program exited' % sys.argv[1])
|
|
247
263
|
exit()
|
|
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
|