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.
Files changed (131) hide show
  1. TreeSAK/ALE.py +63 -0
  2. TreeSAK/ALE1.py +268 -0
  3. TreeSAK/ALE2.py +168 -0
  4. TreeSAK/ALE2RTC.py +30 -0
  5. TreeSAK/ALE3.py +205 -0
  6. TreeSAK/ALE4.py +636 -0
  7. TreeSAK/ALE5.py +210 -0
  8. TreeSAK/ALE6.py +401 -0
  9. TreeSAK/ALE7.py +126 -0
  10. TreeSAK/ALE_backup.py +1081 -0
  11. TreeSAK/AssessCVG.py +128 -0
  12. TreeSAK/AssessMarker.py +306 -0
  13. TreeSAK/AssessMarkerDeltaLL.py +257 -0
  14. TreeSAK/AssessMarkerPA.py +317 -0
  15. TreeSAK/AssessPB.py +113 -0
  16. TreeSAK/BMGE.jar +0 -0
  17. TreeSAK/BMGE.py +49 -0
  18. TreeSAK/C60SR4.nex +127 -0
  19. TreeSAK/CompareMCMC.py +138 -0
  20. TreeSAK/ConcateMSA.py +111 -0
  21. TreeSAK/ConvertMSA.py +135 -0
  22. TreeSAK/Dir.rb +82 -0
  23. TreeSAK/ExtractMarkerSeq.py +263 -0
  24. TreeSAK/FastRoot.py +1175 -0
  25. TreeSAK/FastRoot_backup.py +1122 -0
  26. TreeSAK/FigTree.py +34 -0
  27. TreeSAK/GTDB_tree.py +76 -0
  28. TreeSAK/GeneTree.py +142 -0
  29. TreeSAK/KEGG_Luo17.py +807 -0
  30. TreeSAK/LcaToLeaves.py +66 -0
  31. TreeSAK/MarkerRef2Tree.py +616 -0
  32. TreeSAK/MarkerRef2Tree_backup.py +628 -0
  33. TreeSAK/MarkerSeq2Tree.py +299 -0
  34. TreeSAK/MarkerSeq2Tree_backup.py +259 -0
  35. TreeSAK/ModifyTopo.py +116 -0
  36. TreeSAK/Newick_tree_plotter.py +79 -0
  37. TreeSAK/OMA.py +170 -0
  38. TreeSAK/OMA2.py +212 -0
  39. TreeSAK/OneLineAln.py +50 -0
  40. TreeSAK/PB.py +155 -0
  41. TreeSAK/PMSF.py +115 -0
  42. TreeSAK/PhyloBiAssoc.R +84 -0
  43. TreeSAK/PhyloBiAssoc.py +167 -0
  44. TreeSAK/PlotMCMC.py +41 -0
  45. TreeSAK/PlotMcmcNode.py +152 -0
  46. TreeSAK/PlotMcmcNode_old.py +252 -0
  47. TreeSAK/RootTree.py +101 -0
  48. TreeSAK/RootTreeGTDB.py +371 -0
  49. TreeSAK/RootTreeGTDB214.py +288 -0
  50. TreeSAK/RootTreeGTDB220.py +300 -0
  51. TreeSAK/SequentialDating.py +16 -0
  52. TreeSAK/SingleAleHGT.py +157 -0
  53. TreeSAK/SingleLinePhy.py +50 -0
  54. TreeSAK/SliceMSA.py +142 -0
  55. TreeSAK/SplitScore.py +21 -0
  56. TreeSAK/SplitScore1.py +177 -0
  57. TreeSAK/SplitScore1OMA.py +148 -0
  58. TreeSAK/SplitScore2.py +608 -0
  59. TreeSAK/TaxaCountStats.R +256 -0
  60. TreeSAK/TaxonTree.py +47 -0
  61. TreeSAK/TreeSAK_config.py +32 -0
  62. TreeSAK/VERSION +164 -0
  63. TreeSAK/VisHPD95.R +45 -0
  64. TreeSAK/VisHPD95.py +200 -0
  65. TreeSAK/__init__.py +0 -0
  66. TreeSAK/ale_parser.py +74 -0
  67. TreeSAK/ale_splitter.py +63 -0
  68. TreeSAK/alignment_pruner.pl +1471 -0
  69. TreeSAK/assessOG.py +45 -0
  70. TreeSAK/batch_itol.py +171 -0
  71. TreeSAK/catfasta2phy.py +140 -0
  72. TreeSAK/cogTree.py +185 -0
  73. TreeSAK/compare_trees.R +30 -0
  74. TreeSAK/compare_trees.py +255 -0
  75. TreeSAK/dating.py +264 -0
  76. TreeSAK/dating_ss.py +361 -0
  77. TreeSAK/deltall.py +82 -0
  78. TreeSAK/do_rrtc.rb +464 -0
  79. TreeSAK/fa2phy.py +42 -0
  80. TreeSAK/filter_rename_ar53.py +118 -0
  81. TreeSAK/format_leaf_name.py +70 -0
  82. TreeSAK/gap_stats.py +38 -0
  83. TreeSAK/get_SCG_tree.py +742 -0
  84. TreeSAK/get_arCOG_seq.py +97 -0
  85. TreeSAK/global_functions.py +222 -0
  86. TreeSAK/gnm_leaves.py +43 -0
  87. TreeSAK/iTOL.py +791 -0
  88. TreeSAK/iTOL_gene_tree.py +80 -0
  89. TreeSAK/itol_msa_stats.py +56 -0
  90. TreeSAK/keep_highest_rrtc.py +37 -0
  91. TreeSAK/koTree.py +194 -0
  92. TreeSAK/label_gene_tree_by_gnm.py +34 -0
  93. TreeSAK/label_tree.R +75 -0
  94. TreeSAK/label_tree.py +121 -0
  95. TreeSAK/mad.py +708 -0
  96. TreeSAK/mcmc2tree.py +58 -0
  97. TreeSAK/mcmcTC copy.py +92 -0
  98. TreeSAK/mcmcTC.py +104 -0
  99. TreeSAK/mcmctree_vs_reltime.R +44 -0
  100. TreeSAK/mcmctree_vs_reltime.py +252 -0
  101. TreeSAK/merge_pdf.py +32 -0
  102. TreeSAK/pRTC.py +56 -0
  103. TreeSAK/parse_mcmctree.py +198 -0
  104. TreeSAK/parse_reltime.py +141 -0
  105. TreeSAK/phy2fa.py +37 -0
  106. TreeSAK/plot_distruibution_th.py +165 -0
  107. TreeSAK/prep_mcmctree_ctl.py +92 -0
  108. TreeSAK/print_leaves.py +32 -0
  109. TreeSAK/pruneMSA.py +63 -0
  110. TreeSAK/recode.py +73 -0
  111. TreeSAK/remove_bias.R +112 -0
  112. TreeSAK/rename_leaves.py +78 -0
  113. TreeSAK/replace_clade.py +55 -0
  114. TreeSAK/root_with_out_group.py +84 -0
  115. TreeSAK/run_TaxaCountStats_R_s1.py +455 -0
  116. TreeSAK/subsample_drep_gnms.py +74 -0
  117. TreeSAK/subset.py +69 -0
  118. TreeSAK/subset_tree_stupid_old_way.py +193 -0
  119. TreeSAK/supertree.py +330 -0
  120. TreeSAK/tmp_1.py +19 -0
  121. TreeSAK/tmp_2.py +19 -0
  122. TreeSAK/tmp_3.py +120 -0
  123. TreeSAK/tmp_4.py +43 -0
  124. TreeSAK/tmp_5.py +12 -0
  125. TreeSAK/weighted_rand.rb +23 -0
  126. treesak-1.53.3.data/scripts/TreeSAK +955 -0
  127. treesak-1.53.3.dist-info/LICENSE +674 -0
  128. treesak-1.53.3.dist-info/METADATA +27 -0
  129. treesak-1.53.3.dist-info/RECORD +131 -0
  130. treesak-1.53.3.dist-info/WHEEL +5 -0
  131. 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)