treesak 1.53.3__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.
- TreeSAK/ALE.py +63 -0
- TreeSAK/ALE1.py +268 -0
- TreeSAK/ALE2.py +168 -0
- TreeSAK/ALE2RTC.py +30 -0
- TreeSAK/ALE3.py +205 -0
- TreeSAK/ALE4.py +636 -0
- TreeSAK/ALE5.py +210 -0
- TreeSAK/ALE6.py +401 -0
- TreeSAK/ALE7.py +126 -0
- TreeSAK/ALE_backup.py +1081 -0
- TreeSAK/AssessCVG.py +128 -0
- TreeSAK/AssessMarker.py +306 -0
- TreeSAK/AssessMarkerDeltaLL.py +257 -0
- TreeSAK/AssessMarkerPA.py +317 -0
- TreeSAK/AssessPB.py +113 -0
- TreeSAK/BMGE.jar +0 -0
- TreeSAK/BMGE.py +49 -0
- TreeSAK/C60SR4.nex +127 -0
- TreeSAK/CompareMCMC.py +138 -0
- TreeSAK/ConcateMSA.py +111 -0
- TreeSAK/ConvertMSA.py +135 -0
- TreeSAK/Dir.rb +82 -0
- TreeSAK/ExtractMarkerSeq.py +263 -0
- TreeSAK/FastRoot.py +1175 -0
- TreeSAK/FastRoot_backup.py +1122 -0
- TreeSAK/FigTree.py +34 -0
- TreeSAK/GTDB_tree.py +76 -0
- TreeSAK/GeneTree.py +142 -0
- TreeSAK/KEGG_Luo17.py +807 -0
- TreeSAK/LcaToLeaves.py +66 -0
- TreeSAK/MarkerRef2Tree.py +616 -0
- TreeSAK/MarkerRef2Tree_backup.py +628 -0
- TreeSAK/MarkerSeq2Tree.py +299 -0
- TreeSAK/MarkerSeq2Tree_backup.py +259 -0
- TreeSAK/ModifyTopo.py +116 -0
- TreeSAK/Newick_tree_plotter.py +79 -0
- TreeSAK/OMA.py +170 -0
- TreeSAK/OMA2.py +212 -0
- TreeSAK/OneLineAln.py +50 -0
- TreeSAK/PB.py +155 -0
- TreeSAK/PMSF.py +115 -0
- TreeSAK/PhyloBiAssoc.R +84 -0
- TreeSAK/PhyloBiAssoc.py +167 -0
- TreeSAK/PlotMCMC.py +41 -0
- TreeSAK/PlotMcmcNode.py +152 -0
- TreeSAK/PlotMcmcNode_old.py +252 -0
- TreeSAK/RootTree.py +101 -0
- TreeSAK/RootTreeGTDB.py +371 -0
- TreeSAK/RootTreeGTDB214.py +288 -0
- TreeSAK/RootTreeGTDB220.py +300 -0
- TreeSAK/SequentialDating.py +16 -0
- TreeSAK/SingleAleHGT.py +157 -0
- TreeSAK/SingleLinePhy.py +50 -0
- TreeSAK/SliceMSA.py +142 -0
- TreeSAK/SplitScore.py +21 -0
- TreeSAK/SplitScore1.py +177 -0
- TreeSAK/SplitScore1OMA.py +148 -0
- TreeSAK/SplitScore2.py +608 -0
- TreeSAK/TaxaCountStats.R +256 -0
- TreeSAK/TaxonTree.py +47 -0
- TreeSAK/TreeSAK_config.py +32 -0
- TreeSAK/VERSION +164 -0
- TreeSAK/VisHPD95.R +45 -0
- TreeSAK/VisHPD95.py +200 -0
- TreeSAK/__init__.py +0 -0
- TreeSAK/ale_parser.py +74 -0
- TreeSAK/ale_splitter.py +63 -0
- TreeSAK/alignment_pruner.pl +1471 -0
- TreeSAK/assessOG.py +45 -0
- TreeSAK/batch_itol.py +171 -0
- TreeSAK/catfasta2phy.py +140 -0
- TreeSAK/cogTree.py +185 -0
- TreeSAK/compare_trees.R +30 -0
- TreeSAK/compare_trees.py +255 -0
- TreeSAK/dating.py +264 -0
- TreeSAK/dating_ss.py +361 -0
- TreeSAK/deltall.py +82 -0
- TreeSAK/do_rrtc.rb +464 -0
- TreeSAK/fa2phy.py +42 -0
- TreeSAK/filter_rename_ar53.py +118 -0
- TreeSAK/format_leaf_name.py +70 -0
- TreeSAK/gap_stats.py +38 -0
- TreeSAK/get_SCG_tree.py +742 -0
- TreeSAK/get_arCOG_seq.py +97 -0
- TreeSAK/global_functions.py +222 -0
- TreeSAK/gnm_leaves.py +43 -0
- TreeSAK/iTOL.py +791 -0
- TreeSAK/iTOL_gene_tree.py +80 -0
- TreeSAK/itol_msa_stats.py +56 -0
- TreeSAK/keep_highest_rrtc.py +37 -0
- TreeSAK/koTree.py +194 -0
- TreeSAK/label_gene_tree_by_gnm.py +34 -0
- TreeSAK/label_tree.R +75 -0
- TreeSAK/label_tree.py +121 -0
- TreeSAK/mad.py +708 -0
- TreeSAK/mcmc2tree.py +58 -0
- TreeSAK/mcmcTC copy.py +92 -0
- TreeSAK/mcmcTC.py +104 -0
- TreeSAK/mcmctree_vs_reltime.R +44 -0
- TreeSAK/mcmctree_vs_reltime.py +252 -0
- TreeSAK/merge_pdf.py +32 -0
- TreeSAK/pRTC.py +56 -0
- TreeSAK/parse_mcmctree.py +198 -0
- TreeSAK/parse_reltime.py +141 -0
- TreeSAK/phy2fa.py +37 -0
- TreeSAK/plot_distruibution_th.py +165 -0
- TreeSAK/prep_mcmctree_ctl.py +92 -0
- TreeSAK/print_leaves.py +32 -0
- TreeSAK/pruneMSA.py +63 -0
- TreeSAK/recode.py +73 -0
- TreeSAK/remove_bias.R +112 -0
- TreeSAK/rename_leaves.py +78 -0
- TreeSAK/replace_clade.py +55 -0
- TreeSAK/root_with_out_group.py +84 -0
- TreeSAK/run_TaxaCountStats_R_s1.py +455 -0
- TreeSAK/subsample_drep_gnms.py +74 -0
- TreeSAK/subset.py +69 -0
- TreeSAK/subset_tree_stupid_old_way.py +193 -0
- TreeSAK/supertree.py +330 -0
- TreeSAK/tmp_1.py +19 -0
- TreeSAK/tmp_2.py +19 -0
- TreeSAK/tmp_3.py +120 -0
- TreeSAK/tmp_4.py +43 -0
- TreeSAK/tmp_5.py +12 -0
- TreeSAK/weighted_rand.rb +23 -0
- treesak-1.53.3.data/scripts/TreeSAK +955 -0
- treesak-1.53.3.dist-info/LICENSE +674 -0
- treesak-1.53.3.dist-info/METADATA +27 -0
- treesak-1.53.3.dist-info/RECORD +131 -0
- treesak-1.53.3.dist-info/WHEEL +5 -0
- treesak-1.53.3.dist-info/top_level.txt +1 -0
TreeSAK/ALE7.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
ALE7_usage = '''
|
|
6
|
+
=============================== ALE7 example commands ===============================
|
|
7
|
+
|
|
8
|
+
# get presence/absence of interested functions in reconstructed ancestral genomes
|
|
9
|
+
|
|
10
|
+
TreeSAK ALE7 -6 ALE6_op_dir -fun ko.txt -node internal_node.txt -o Fun_PA.txt
|
|
11
|
+
TreeSAK ALE7 -6 ALE6_op_dir -fun K01995,K01995 -node 359,466,470 -o Fun_PA.txt
|
|
12
|
+
TreeSAK ALE7 -6 ALE6_op_dir -fun arCOG07811,K01995 -node 359,466,470 -o Fun_PA.txt
|
|
13
|
+
|
|
14
|
+
# needed input files:
|
|
15
|
+
-6: annotation_COG/annotation_KEGG
|
|
16
|
+
|
|
17
|
+
=====================================================================================
|
|
18
|
+
'''
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def sep_path_basename_ext(file_in):
|
|
22
|
+
|
|
23
|
+
f_path, f_name = os.path.split(file_in)
|
|
24
|
+
if f_path == '':
|
|
25
|
+
f_path = '.'
|
|
26
|
+
f_base, f_ext = os.path.splitext(f_name)
|
|
27
|
+
|
|
28
|
+
return f_name, f_path, f_base, f_ext[1:]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def ALE7(args):
|
|
32
|
+
|
|
33
|
+
ale6_op_dir = args['6']
|
|
34
|
+
interested_fun_txt = args['fun']
|
|
35
|
+
interested_gnm_txt = args['node']
|
|
36
|
+
op_txt = args['o']
|
|
37
|
+
|
|
38
|
+
op_txt_name, op_txt_path, op_txt_base, op_txt_ext = sep_path_basename_ext(op_txt)
|
|
39
|
+
op_txt_pct = '%s/%s_percentage.%s' % (op_txt_path, op_txt_base, op_txt_ext)
|
|
40
|
+
|
|
41
|
+
if os.path.isdir(ale6_op_dir) is False:
|
|
42
|
+
print('%s not found, program exited!' % ale6_op_dir)
|
|
43
|
+
exit()
|
|
44
|
+
|
|
45
|
+
interested_fun_set = set()
|
|
46
|
+
if os.path.isfile(interested_fun_txt) is False:
|
|
47
|
+
if ',' in interested_fun_txt:
|
|
48
|
+
interested_fun_set = interested_fun_txt.split(',')
|
|
49
|
+
else:
|
|
50
|
+
interested_fun_set.add(interested_fun_txt)
|
|
51
|
+
else:
|
|
52
|
+
for each_fun in open(interested_fun_txt):
|
|
53
|
+
interested_fun_set.add(each_fun.strip().split()[0])
|
|
54
|
+
|
|
55
|
+
node_desc_dict = dict()
|
|
56
|
+
interested_node_set = set()
|
|
57
|
+
if os.path.isfile(interested_gnm_txt) is False:
|
|
58
|
+
if ',' in interested_gnm_txt:
|
|
59
|
+
interested_node_set = interested_gnm_txt.split(',')
|
|
60
|
+
else:
|
|
61
|
+
interested_node_set.add(interested_gnm_txt)
|
|
62
|
+
else:
|
|
63
|
+
for each_node in open(interested_gnm_txt):
|
|
64
|
+
each_node_split = each_node.strip().split()
|
|
65
|
+
node_id = each_node_split[0]
|
|
66
|
+
interested_node_set.add(each_node.strip().split()[0])
|
|
67
|
+
if len(each_node_split) >= 2:
|
|
68
|
+
node_desc = each_node_split[1]
|
|
69
|
+
node_desc_dict[node_id] = node_desc
|
|
70
|
+
|
|
71
|
+
interested_fun_list_sorted = sorted(list(interested_fun_set))
|
|
72
|
+
interested_gnm_list_sorted = sorted(list(interested_node_set))
|
|
73
|
+
|
|
74
|
+
op_txt_handle = open(op_txt, 'w')
|
|
75
|
+
op_txt_pct_handle = open(op_txt_pct, 'w')
|
|
76
|
+
if len(node_desc_dict) == 0:
|
|
77
|
+
op_txt_handle.write('ID\t' + '\t'.join(interested_fun_list_sorted) + '\n')
|
|
78
|
+
op_txt_pct_handle.write('ID\tPercentage\n')
|
|
79
|
+
else:
|
|
80
|
+
op_txt_handle.write('ID\tDescription\t' + '\t'.join(interested_fun_list_sorted) + '\n')
|
|
81
|
+
op_txt_pct_handle.write('ID\tDescription\tPercentage\n')
|
|
82
|
+
for each_node in interested_gnm_list_sorted:
|
|
83
|
+
|
|
84
|
+
node_desc = node_desc_dict.get(each_node, 'na')
|
|
85
|
+
node_annotation_cog = '%s/annotation_COG/%s_COG.txt' % (ale6_op_dir, each_node)
|
|
86
|
+
node_annotation_kegg = '%s/annotation_KEGG/%s_KEGG.txt' % (ale6_op_dir, each_node)
|
|
87
|
+
|
|
88
|
+
node_fun_set = set()
|
|
89
|
+
if os.path.isfile(node_annotation_cog):
|
|
90
|
+
for each_line in open(node_annotation_cog):
|
|
91
|
+
node_fun_set.add(each_line.strip().split()[0])
|
|
92
|
+
if os.path.isfile(node_annotation_kegg):
|
|
93
|
+
for each_line in open(node_annotation_kegg):
|
|
94
|
+
node_fun_set.add(each_line.strip().split()[0])
|
|
95
|
+
|
|
96
|
+
fun_pa_list = []
|
|
97
|
+
for each_fun in interested_fun_list_sorted:
|
|
98
|
+
if each_fun in node_fun_set:
|
|
99
|
+
fun_pa_list.append('1')
|
|
100
|
+
else:
|
|
101
|
+
fun_pa_list.append('0')
|
|
102
|
+
|
|
103
|
+
fun_presence_pct = fun_pa_list.count('1')*100/len(fun_pa_list)
|
|
104
|
+
fun_presence_pct = float("{0:.2f}".format(fun_presence_pct))
|
|
105
|
+
if len(node_desc_dict) == 0:
|
|
106
|
+
op_txt_handle.write('%s\t%s\n' % (each_node, '\t'.join(fun_pa_list)))
|
|
107
|
+
op_txt_pct_handle.write('%s\t%s\n' % (each_node, fun_presence_pct))
|
|
108
|
+
else:
|
|
109
|
+
op_txt_handle.write('%s\t%s\t%s\n' % (each_node, node_desc, '\t'.join(fun_pa_list)))
|
|
110
|
+
op_txt_pct_handle.write('%s\t%s\t%s\n' % (each_node, node_desc, fun_presence_pct))
|
|
111
|
+
op_txt_handle.close()
|
|
112
|
+
op_txt_pct_handle.close()
|
|
113
|
+
|
|
114
|
+
print('Results exported to %s and %s' % (op_txt, op_txt_pct))
|
|
115
|
+
print('Done!')
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
if __name__ == '__main__':
|
|
119
|
+
|
|
120
|
+
ALE7_parser = argparse.ArgumentParser()
|
|
121
|
+
ALE7_parser.add_argument('-6', required=True, help='ALE6 output directory')
|
|
122
|
+
ALE7_parser.add_argument('-fun', required=True, help='interested functions')
|
|
123
|
+
ALE7_parser.add_argument('-node', required=True, help='interested internal nodes')
|
|
124
|
+
ALE7_parser.add_argument('-o', required=True, help='output directory')
|
|
125
|
+
args = vars(ALE7_parser.parse_args())
|
|
126
|
+
ALE7(args)
|