TreeSAK 1.46.0__tar.gz → 1.46.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.
Files changed (116) hide show
  1. {TreeSAK-1.46.0/TreeSAK.egg-info → TreeSAK-1.46.2}/PKG-INFO +2 -2
  2. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE6.py +41 -22
  3. TreeSAK-1.46.2/TreeSAK/PlotMcmcNode.py +170 -0
  4. TreeSAK-1.46.0/TreeSAK/PlotMcmcNode.py → TreeSAK-1.46.2/TreeSAK/PlotMcmcNode_old.py +7 -5
  5. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/VERSION +3 -3
  6. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/cogTree.py +3 -2
  7. {TreeSAK-1.46.0 → TreeSAK-1.46.2/TreeSAK.egg-info}/PKG-INFO +2 -2
  8. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK.egg-info/SOURCES.txt +1 -0
  9. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/bin/TreeSAK +6 -8
  10. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/LICENSE +0 -0
  11. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/MANIFEST.in +0 -0
  12. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/README.md +0 -0
  13. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE.py +0 -0
  14. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE1.py +0 -0
  15. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE2.py +0 -0
  16. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE2RTC.py +0 -0
  17. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE3.py +0 -0
  18. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE4.py +0 -0
  19. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE5.py +0 -0
  20. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE7.py +0 -0
  21. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ALE_backup.py +0 -0
  22. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/AssessCVG.py +0 -0
  23. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/AssessMarker.py +0 -0
  24. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
  25. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/AssessMarkerPA.py +0 -0
  26. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/AssessPB.py +0 -0
  27. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/BMGE.jar +0 -0
  28. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/BMGE.py +0 -0
  29. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/CompareMCMC.py +0 -0
  30. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ConcateMSA.py +0 -0
  31. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ConvertMSA.py +0 -0
  32. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/Dir.rb +0 -0
  33. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ExtractMarkerSeq.py +0 -0
  34. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/FastRoot.py +0 -0
  35. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/FastRoot_backup.py +0 -0
  36. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/FigTree.py +0 -0
  37. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/GTDB_tree.py +0 -0
  38. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/KEGG_Luo17.py +0 -0
  39. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/LcaToLeaves.py +0 -0
  40. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/MarkerRef2Tree.py +0 -0
  41. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
  42. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/MarkerSeq2Tree.py +0 -0
  43. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ModifyTopo.py +0 -0
  44. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/Newick_tree_plotter.py +0 -0
  45. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/OMA.py +0 -0
  46. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/OMA2.py +0 -0
  47. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/OneLineAln.py +0 -0
  48. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/PB.py +0 -0
  49. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/PMSF.py +0 -0
  50. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/PhyloBiAssoc.R +0 -0
  51. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/PhyloBiAssoc.py +0 -0
  52. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/PlotMCMC.py +0 -0
  53. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/RootTree.py +0 -0
  54. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/RootTreeGTDB214.py +0 -0
  55. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/RootTreeGTDB220.py +0 -0
  56. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SequentialDating.py +0 -0
  57. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SingleAleHGT.py +0 -0
  58. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SingleLinePhy.py +0 -0
  59. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SliceMSA.py +0 -0
  60. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SplitScore.py +0 -0
  61. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SplitScore1.py +0 -0
  62. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SplitScore1OMA.py +0 -0
  63. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/SplitScore2.py +0 -0
  64. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/TaxaCountStats.R +0 -0
  65. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/TaxonTree.py +0 -0
  66. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/TreeSAK_config.py +0 -0
  67. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/VisHPD95.R +0 -0
  68. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/VisHPD95.py +0 -0
  69. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/__init__.py +0 -0
  70. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ale_parser.py +0 -0
  71. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/ale_splitter.py +0 -0
  72. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/alignment_pruner.pl +0 -0
  73. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/catfasta2phy.py +0 -0
  74. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/compare_trees.R +0 -0
  75. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/compare_trees.py +0 -0
  76. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/dating.py +0 -0
  77. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/dating_ss.py +0 -0
  78. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/deltall.py +0 -0
  79. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/do_rrtc.rb +0 -0
  80. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/fa2phy.py +0 -0
  81. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/format_leaf_name.py +0 -0
  82. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/gap_stats.py +0 -0
  83. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/get_SCG_tree.py +0 -0
  84. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/get_arCOG_seq.py +0 -0
  85. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/global_functions.py +0 -0
  86. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/gnm_leaves.py +0 -0
  87. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/iTOL.py +0 -0
  88. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/iTOL_gene_tree.py +0 -0
  89. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/keep_highest_rrtc.py +0 -0
  90. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/koTree.py +0 -0
  91. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/label_tree.R +0 -0
  92. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/label_tree.py +0 -0
  93. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/mad.py +0 -0
  94. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/mcmc2tree.py +0 -0
  95. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/mcmcTC.py +0 -0
  96. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/merge_pdf.py +0 -0
  97. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/pRTC.py +0 -0
  98. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/plot_distruibution_th.py +0 -0
  99. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/prep_mcmctree_ctl.py +0 -0
  100. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/print_leaves.py +0 -0
  101. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/pruneMSA.py +0 -0
  102. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/recode.py +0 -0
  103. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/rename_leaves.py +0 -0
  104. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/replace_clade.py +0 -0
  105. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/root_with_out_group.py +0 -0
  106. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
  107. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/subsample_drep_gnms.py +0 -0
  108. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/subset.py +0 -0
  109. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
  110. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/supertree.py +0 -0
  111. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK/weighted_rand.rb +0 -0
  112. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK.egg-info/dependency_links.txt +0 -0
  113. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK.egg-info/requires.txt +0 -0
  114. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/TreeSAK.egg-info/top_level.txt +0 -0
  115. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/setup.cfg +0 -0
  116. {TreeSAK-1.46.0 → TreeSAK-1.46.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.46.0
3
+ Version: 1.46.2
4
4
  Summary: BioSAK
5
5
  Home-page: https://github.com/songweizhi/TreeSAK
6
6
  Author: Weizhi Song
@@ -24,4 +24,4 @@ Requires-Dist: kaleido
24
24
  Requires-Dist: PyPDF3
25
25
  Requires-Dist: dendropy
26
26
 
27
- TreeSAK v1.46.0
27
+ TreeSAK v1.46.2
@@ -15,8 +15,8 @@ TreeSAK ALE6 -1 ALE1_op_dir -3 ALE3_op_dir_30 -s species_tree.rooted.treefile -o
15
15
 
16
16
  # Needed input files:
17
17
  -1: faa files
18
- -3: GeneContent.txt and SpeciesTreeRef.newick
19
- -s: the tree used as input for ALE2
18
+ -3: GeneContent.txt, SpeciesTreeRef.newick and Transfer_propensity.txt
19
+ -s: the tree used as input for ALE2, to rename leafs back
20
20
 
21
21
  # To be added:
22
22
  1. A dereplication step to the produced faa file.
@@ -47,6 +47,15 @@ def get_internal_node_leaves(ale_species_tree_file, internal_node_id):
47
47
  return internal_node_leaf_set
48
48
 
49
49
 
50
+ def rename_leaves(tree_file_in, rename_dict, tree_format, tree_file_out):
51
+
52
+ t = Tree(tree_file_in, format=tree_format)
53
+ for leaf in t:
54
+ leaf_name_new = rename_dict.get(leaf.name, leaf.name)
55
+ leaf.name = leaf_name_new
56
+ t.write(format=tree_format, outfile=tree_file_out)
57
+
58
+
50
59
  def ALE6(args):
51
60
 
52
61
  ale1_op_dir = args['1']
@@ -58,23 +67,33 @@ def ALE6(args):
58
67
  cog_annotation_wd = args['cog']
59
68
  kegg_annotation_wd = args['kegg']
60
69
 
61
- GeneContent_txt = '%s/GeneContent.txt' % ale3_op_dir
62
- SpeciesTreeRef = '%s/SpeciesTreeRef.newick' % ale3_op_dir
63
- transfer_propensity_txt = '%s/Transfer_propensity.txt' % ale3_op_dir
70
+ GeneContent_txt = '%s/GeneContent.txt' % ale3_op_dir
71
+ SpeciesTreeRef = '%s/SpeciesTreeRef.newick' % ale3_op_dir
72
+ transfer_propensity_txt = '%s/Transfer_propensity.txt' % ale3_op_dir
64
73
 
65
74
  ################################################## define op files #################################################
66
75
 
67
- faa_dir = '%s/faa_files' % op_dir
68
- cog_dir = '%s/annotation_COG' % op_dir
69
- kegg_dir = '%s/annotation_KEGG' % op_dir
70
- cog_df_txt = '%s/annotation_COG.txt' % op_dir
71
- cog_df_desc_txt = '%s/annotation_COG_desc.txt' % op_dir
72
- kegg_df_txt = '%s/annotation_KEGG.txt' % op_dir
73
- kegg_df_desc_txt = '%s/annotation_KEGG_desc.txt' % op_dir
74
- fun_transfer_propensity_txt = '%s/function_transfer_propensity_weighted.txt' % op_dir
76
+ _, _, tree_base, tree_ext = sep_path_basename_ext(genome_tree_file_rooted)
77
+
78
+ faa_dir = '%s/faa_files' % op_dir
79
+ cog_dir = '%s/annotation_COG' % op_dir
80
+ kegg_dir = '%s/annotation_KEGG' % op_dir
81
+ cog_df_txt = '%s/annotation_COG.txt' % op_dir
82
+ cog_df_desc_txt = '%s/annotation_COG_desc.txt' % op_dir
83
+ kegg_df_txt = '%s/annotation_KEGG.txt' % op_dir
84
+ kegg_df_desc_txt = '%s/annotation_KEGG_desc.txt' % op_dir
85
+ fun_transfer_propensity_txt = '%s/function_transfer_propensity_weighted.txt' % op_dir
86
+ genome_tree_file_rooted_with_ale_internal_node = '%s/%s_with_ALE_internal_nodes.%s' % (op_dir, tree_base, tree_ext)
75
87
 
76
88
  ########################################## get the id of nodes to process ##########################################
77
89
 
90
+ gnm_name_dict_ale_fmt_to_original_fmt = dict()
91
+ for leaf in Tree(genome_tree_file_rooted, format=1):
92
+ leaf_name = leaf.name
93
+ leaf_name_new = leaf_name.replace('_', '')
94
+ leaf.name = leaf_name_new
95
+ gnm_name_dict_ale_fmt_to_original_fmt[leaf_name_new] = leaf_name
96
+
78
97
  overall_internal_node_set = set()
79
98
  line_num_index = 0
80
99
  for each_line in open(GeneContent_txt):
@@ -98,20 +117,18 @@ def ALE6(args):
98
117
  for each_node in open(interested_internal_nodes):
99
118
  internal_nodes_to_process.add(each_node.strip())
100
119
 
101
- ####################################################################################################################
102
-
103
- gnm_name_dict_new_to_old = dict()
104
- for leaf in Tree(genome_tree_file_rooted, format=1):
105
- leaf_name = leaf.name
106
- leaf_name_new = leaf_name.replace('_', '')
107
- leaf.name = leaf_name_new
108
- gnm_name_dict_new_to_old[leaf_name_new] = leaf_name
120
+ #################### an addiitonal step (add ALE added internal node names to the rooted tree) #####################
109
121
 
110
122
  # create output directory
111
123
  if force_create_op_dir is True:
112
124
  if os.path.isdir(op_dir) is True:
113
125
  os.system('rm -r %s' % op_dir)
114
126
  os.system('mkdir %s' % op_dir)
127
+
128
+ rename_leaves(SpeciesTreeRef, gnm_name_dict_ale_fmt_to_original_fmt, 1, genome_tree_file_rooted_with_ale_internal_node)
129
+
130
+ ####################################################################################################################
131
+
115
132
  os.system('mkdir %s' % faa_dir)
116
133
 
117
134
  if cog_annotation_wd is not None:
@@ -144,7 +161,7 @@ def ALE6(args):
144
161
  branch_faa = '%s/%s.faa' % (faa_dir, each_branch)
145
162
  branch_content = branch_to_content_dict[each_branch]
146
163
  branch_child_set = branch_to_leaf_dict[each_branch]
147
- branch_child_set_original_name = {gnm_name_dict_new_to_old[i] for i in branch_child_set}
164
+ branch_child_set_original_name = {gnm_name_dict_ale_fmt_to_original_fmt[i] for i in branch_child_set}
148
165
  branch_faa_handle = open(branch_faa, 'w')
149
166
  branch_to_gene_dict[each_branch] = set()
150
167
  for each_prot_family in branch_content:
@@ -158,6 +175,8 @@ def ALE6(args):
158
175
  branch_to_gene_dict[each_branch].add(each_seq.id)
159
176
  branch_faa_handle.close()
160
177
 
178
+ ####################################################################################################################
179
+
161
180
  # Read in COG annotation results
162
181
  fun_to_gene_dict = dict()
163
182
  annotation_dict_cog = dict()
@@ -0,0 +1,170 @@
1
+ import os
2
+ import glob
3
+ import argparse
4
+ import pandas as pd
5
+ import plotly.express as px
6
+
7
+
8
+ PlotMcmcNode_usage = '''
9
+ ========================== PlotMcmcNode example commands ==========================
10
+
11
+ TreeSAK PlotMcmcNode -i McmcTree_op_files -n topo123_nodes.txt -o topo123_age.pdf
12
+
13
+ # file format (-n, tab separated, no header)
14
+ # column 1: file name, no extension
15
+ # column 2: node id
16
+ # column 3: file name on the figure
17
+ # column 4: node name on the figure
18
+ topo1_clock3_mcmc t_n171 Topo1 Symbiosis_event_1
19
+ topo1_clock3_mcmc t_n151 Topo1 Symbiosis_event_2
20
+ topo1_clock3_mcmc t_n131 Topo1 Symbiosis_event_3
21
+ topo2_clock3_mcmc t_n171 Topo2 Symbiosis_event_1
22
+ topo2_clock3_mcmc t_n171 Topo3 Symbiosis_event_1
23
+
24
+ ===================================================================================
25
+ '''
26
+
27
+
28
+ def sep_path_basename_ext(file_in):
29
+
30
+ # separate path and file name
31
+ f_path, file_name = os.path.split(file_in)
32
+ if f_path == '':
33
+ f_path = '.'
34
+
35
+ # separate file basename and extension
36
+ f_base, f_ext = os.path.splitext(file_name)
37
+
38
+ return f_path, f_base, f_ext
39
+
40
+
41
+ def plot_distribution(df_txt, output_plot):
42
+
43
+ df = pd.read_table(df_txt, sep=',')
44
+ run_id_list = df['Setting'].unique()
45
+ node_id_list = df['Node'].unique()
46
+
47
+ # sort dataframe by run id
48
+ df = df.sort_values(by='Setting', ascending=False)
49
+
50
+ plot_width = 900
51
+ plot_height = len(run_id_list)*100
52
+ if plot_height < 360:
53
+ plot_height = 360
54
+
55
+ fig = px.violin(df, x="Value", y="Setting", color="Node", points=False, orientation="h", width=plot_width, height=plot_height)
56
+ if len(node_id_list) == 1:
57
+ fig.update_traces(side="positive", fillcolor='lightblue', width=1.6, opacity=0.75)
58
+ else:
59
+ fig.update_traces(side="positive", fillcolor='rgba(0,0,0,0)', width=1.6)
60
+
61
+ fig.update_traces(showlegend=True)
62
+ fig.layout.template = "simple_white"
63
+ # fig.layout.width = 700
64
+ # fig.layout.height = 750
65
+ # fig.update_xaxes(range=[40, 0])
66
+ # fig.update_layout(margin_t=10, title_text='Demo', title_x=0.5)
67
+ fig.write_image(output_plot)
68
+
69
+
70
+ def PlotMcmcNode(args):
71
+
72
+ mcmc_in = args['i']
73
+ mcmc_file_ext = args['x']
74
+ node_txt = args['n']
75
+ output_plot = args['o']
76
+
77
+ # check MCMCTree output file/dir
78
+ if os.path.isfile(mcmc_in) is True:
79
+ mcmc_file_list = [mcmc_in]
80
+ else:
81
+ mcmc_file_re = '%s/*.%s' % (mcmc_in, mcmc_file_ext)
82
+ mcmc_file_list = glob.glob(mcmc_file_re)
83
+
84
+ if len(mcmc_file_list) == 0:
85
+ print('mcmc file not found, program exited!')
86
+ exit()
87
+
88
+ if output_plot[-4:] not in ['.PDF', '.pdf']:
89
+ output_plot = output_plot + '.pdf'
90
+ op_df_tmp = output_plot + '.txt'
91
+
92
+ mcmc_file_full_path_dict = dict()
93
+ for each_mcmc_file in mcmc_file_list:
94
+ mcmc_path, mcmc_base, mcmc_ext = sep_path_basename_ext(each_mcmc_file)
95
+ mcmc_file_full_path_dict[mcmc_base] = each_mcmc_file
96
+
97
+ # read in nodes to plot
98
+ file_to_node_dict = dict()
99
+ file_rename_dict = dict()
100
+ node_rename_dict = dict()
101
+ not_found_file_set = set()
102
+ for each_node in open(node_txt):
103
+ each_node_split = each_node.strip().split()
104
+ file_name = each_node_split[0]
105
+ if '/' in file_name:
106
+ file_name = file_name.split('/')[-1]
107
+
108
+ if file_name not in mcmc_file_full_path_dict:
109
+ not_found_file_set.add(file_name)
110
+
111
+ node_id = each_node_split[1]
112
+ node_id_with_file_name = '%s_____%s' % (file_name, node_id)
113
+
114
+ if file_name not in file_to_node_dict:
115
+ file_to_node_dict[file_name] = set()
116
+ file_to_node_dict[file_name].add(node_id)
117
+
118
+ if len(each_node_split) >= 3:
119
+ file_short_name = each_node_split[2]
120
+ file_rename_dict[file_name] = file_short_name
121
+
122
+ if len(each_node_split) == 4:
123
+ node_desc = each_node_split[3]
124
+ node_rename_dict[node_id_with_file_name] = node_desc
125
+
126
+ # report not found files and exit
127
+ if len(not_found_file_set) > 0:
128
+ print('MCMC file not found, program exited!')
129
+ exit()
130
+
131
+ found_matched_node = False
132
+ op_df_tmp_handle = open(op_df_tmp, 'w')
133
+ op_df_tmp_handle.write('Value,Node,Setting\n')
134
+ for mcmc_file in file_to_node_dict:
135
+ pwd_mcmc_file = mcmc_file_full_path_dict[mcmc_file]
136
+ current_node_set = file_to_node_dict.get(mcmc_file, set())
137
+ file_name_to_plot = file_rename_dict.get(mcmc_file, mcmc_file)
138
+ mcmc_df = pd.read_table(pwd_mcmc_file, index_col=0)
139
+ for each_col in mcmc_df:
140
+ if each_col in current_node_set:
141
+ node_desc_to_plot = node_rename_dict.get(('%s_____%s' % (mcmc_file, each_col)), each_col)
142
+ found_matched_node = True
143
+ value_list = mcmc_df[each_col].values
144
+ for each_value in value_list:
145
+ op_df_tmp_handle.write('%s,%s,%s\n' % (each_value, node_desc_to_plot, file_name_to_plot))
146
+ op_df_tmp_handle.close()
147
+
148
+ if found_matched_node is False:
149
+ print('Provided node(s) not found, program exited!')
150
+ exit()
151
+
152
+ # plot distribution
153
+ plot_distribution(op_df_tmp, output_plot)
154
+
155
+ # remove tmp files
156
+ os.system('rm %s' % op_df_tmp)
157
+
158
+ # final report
159
+ print('Plot exported to %s, done!' % output_plot)
160
+
161
+
162
+ if __name__ == '__main__':
163
+
164
+ PlotMcmcNode_parser = argparse.ArgumentParser()
165
+ PlotMcmcNode_parser.add_argument('-i', required=True, help='folder holds the *mcmc.txt files')
166
+ PlotMcmcNode_parser.add_argument('-x', required=False, default='txt', help='file extension, default txt')
167
+ PlotMcmcNode_parser.add_argument('-n', required=True, help='nodes to plot')
168
+ PlotMcmcNode_parser.add_argument('-o', required=True, help='output plot')
169
+ args = vars(PlotMcmcNode_parser.parse_args())
170
+ PlotMcmcNode(args)
@@ -15,14 +15,16 @@ TreeSAK PlotMcmcNode -i McmcTree_op_files -n nodes.txt -o multi_runs_multi_nodes
15
15
 
16
16
  # File name of the mcmc.txt and the corresponding mcmc out file need to follow
17
17
  # the rule as specified below:
18
- [prefix]_mcmc.txt
19
- [prefix]_out.txt
18
+ [setting_1]_mcmc.txt
19
+ [setting_1]_out.txt
20
+ [setting_2]_mcmc.txt
21
+ [setting_2]_out.txt
20
22
 
21
23
  # file format (-n, tab separated)
22
24
  # leave the 2nd column blank for nodes without renaming
23
- node1 Bacteria
24
- node2
25
- node3,node9 Archaea
25
+ setting_1 node1 Bacteria
26
+ setting_2 node2
27
+ setting_3 node3,node9 Archaea
26
28
 
27
29
  # Y-axis label file format (-l, tab separated)
28
30
  PA_75_DeltaLL_50_clock3_mcmc.txt DeltaLL_50
@@ -1,9 +1,9 @@
1
+ 1.46.2
2
+ - fixed bugs
3
+
1
4
  1.46.0
2
5
  - new module added: cogTree
3
6
 
4
- 1.45.5
5
- - fixed bugs
6
-
7
7
  1.45.0
8
8
  - new module added: iTOL_gene_tree
9
9
 
@@ -86,7 +86,7 @@ def cogTree(args):
86
86
  print('Reading in COG annotation results')
87
87
  file_re = '%s/*COG_wd/*_query_to_cog.txt' % (cog_annotation_wd)
88
88
  file_list = glob.glob(file_re)
89
-
89
+ print(file_list)
90
90
  if len(file_list) == 0:
91
91
  print('COG annotation file not detected, program exited!')
92
92
  exit()
@@ -98,7 +98,8 @@ def cogTree(args):
98
98
  each_line_split = each_line.strip().split('\t')
99
99
  if len(each_line_split) == 4:
100
100
  gene_id = each_line_split[0]
101
- cog_id = each_line_split[4][2:]
101
+ print(each_line_split)
102
+ cog_id = each_line_split[1]
102
103
  if cog_id in interested_fun_set:
103
104
  if cog_id not in fun_to_gene_dict:
104
105
  fun_to_gene_dict[cog_id] = set()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.46.0
3
+ Version: 1.46.2
4
4
  Summary: BioSAK
5
5
  Home-page: https://github.com/songweizhi/TreeSAK
6
6
  Author: Weizhi Song
@@ -24,4 +24,4 @@ Requires-Dist: kaleido
24
24
  Requires-Dist: PyPDF3
25
25
  Requires-Dist: dendropy
26
26
 
27
- TreeSAK v1.46.0
27
+ TreeSAK v1.46.2
@@ -44,6 +44,7 @@ TreeSAK/PhyloBiAssoc.R
44
44
  TreeSAK/PhyloBiAssoc.py
45
45
  TreeSAK/PlotMCMC.py
46
46
  TreeSAK/PlotMcmcNode.py
47
+ TreeSAK/PlotMcmcNode_old.py
47
48
  TreeSAK/RootTree.py
48
49
  TreeSAK/RootTreeGTDB214.py
49
50
  TreeSAK/RootTreeGTDB220.py
@@ -59,7 +59,7 @@ def print_main_help():
59
59
  iTOL -> Prepare iTOL files
60
60
  iTOL_gene_tree -> Genome metadata to gene metadata
61
61
  PB -> Infer tree with PhyloBayes-MPI
62
- supertree -> Infer species tree from gene trees
62
+ supertree -> Infer species tree from multiple gene trees
63
63
  AssessPB -> Compare PhyloBayes chains
64
64
  MarkerSeq2Tree -> Marker sequence to tree
65
65
  MarkerRef2Tree -> Marker (reference sequence) to Tree
@@ -350,12 +350,10 @@ if __name__ == '__main__':
350
350
  elif sys.argv[1] == 'PlotMcmcNode':
351
351
  from TreeSAK import PlotMcmcNode
352
352
  PlotMcmcNode_parser = subparsers.add_parser('PlotMcmcNode', usage=PlotMcmcNode.PlotMcmcNode_usage)
353
- PlotMcmcNode_parser.add_argument('-i', required=True, help='folder holds the *mcmc.txt and *out.txt files')
354
- PlotMcmcNode_parser.add_argument('-of', required=False, default=None, help='the *out.txt file')
355
- PlotMcmcNode_parser.add_argument('-n', required=True, help='Nodes to plot')
356
- PlotMcmcNode_parser.add_argument('-l', required=False, default=None, help='labels on y axis')
357
- PlotMcmcNode_parser.add_argument('-o', required=True, help='Output plot')
358
- PlotMcmcNode_parser.add_argument('-tmp', required=False, action="store_true", help='keep tmp files')
353
+ PlotMcmcNode_parser.add_argument('-i', required=True, help='folder holds the *mcmc.txt files')
354
+ PlotMcmcNode_parser.add_argument('-x', required=False, default='txt', help='file extension, default txt')
355
+ PlotMcmcNode_parser.add_argument('-n', required=True, help='nodes to plot')
356
+ PlotMcmcNode_parser.add_argument('-o', required=True, help='output plot')
359
357
  args = vars(parser.parse_args())
360
358
  PlotMcmcNode.PlotMcmcNode(args)
361
359
 
@@ -872,7 +870,7 @@ if __name__ == '__main__':
872
870
  iTOL_gene_tree.iTOL_gene_tree(args)
873
871
 
874
872
  else:
875
- print('Unrecognized module: %s, program exited' % sys.argv[1])
873
+ print('Unrecognized module: %s, program exited!' % sys.argv[1])
876
874
  exit()
877
875
 
878
876
 
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