TreeSAK 1.43.1__tar.gz → 1.43.3__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 (110) hide show
  1. {TreeSAK-1.43.1/TreeSAK.egg-info → TreeSAK-1.43.3}/PKG-INFO +2 -2
  2. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE6.py +101 -20
  3. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/VERSION +1 -1
  4. {TreeSAK-1.43.1 → TreeSAK-1.43.3/TreeSAK.egg-info}/PKG-INFO +2 -2
  5. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/LICENSE +0 -0
  6. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/MANIFEST.in +0 -0
  7. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/README.md +0 -0
  8. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE.py +0 -0
  9. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE1.py +0 -0
  10. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE2.py +0 -0
  11. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE2RTC.py +0 -0
  12. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE3.py +0 -0
  13. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE4.py +0 -0
  14. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE5.py +0 -0
  15. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE7.py +0 -0
  16. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE_backup.py +0 -0
  17. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessCVG.py +0 -0
  18. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessMarker.py +0 -0
  19. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
  20. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessMarkerPA.py +0 -0
  21. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessPB.py +0 -0
  22. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/BMGE.jar +0 -0
  23. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/BMGE.py +0 -0
  24. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/CompareMCMC.py +0 -0
  25. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ConcateMSA.py +0 -0
  26. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ConvertMSA.py +0 -0
  27. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/Dir.rb +0 -0
  28. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ExtractMarkerSeq.py +0 -0
  29. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/FastRoot.py +0 -0
  30. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/FastRoot_backup.py +0 -0
  31. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/GTDB_tree.py +0 -0
  32. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/KEGG_Luo17.py +0 -0
  33. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/LcaToLeaves.py +0 -0
  34. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/MarkerRef2Tree.py +0 -0
  35. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
  36. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/MarkerSeq2Tree.py +0 -0
  37. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ModifyTopo.py +0 -0
  38. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/Newick_tree_plotter.py +0 -0
  39. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/OMA.py +0 -0
  40. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/OMA2.py +0 -0
  41. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/OneLineAln.py +0 -0
  42. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PB.py +0 -0
  43. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PMSF.py +0 -0
  44. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PhyloBiAssoc.R +0 -0
  45. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PhyloBiAssoc.py +0 -0
  46. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PlotMCMC.py +0 -0
  47. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PlotMcmcNode.py +0 -0
  48. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/RootTree.py +0 -0
  49. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/RootTreeGTDB214.py +0 -0
  50. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/RootTreeGTDB220.py +0 -0
  51. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SequentialDating.py +0 -0
  52. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SingleAleHGT.py +0 -0
  53. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SingleLinePhy.py +0 -0
  54. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SliceMSA.py +0 -0
  55. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore.py +0 -0
  56. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore1.py +0 -0
  57. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore1OMA.py +0 -0
  58. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore2.py +0 -0
  59. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/TaxaCountStats.R +0 -0
  60. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/TaxonTree.py +0 -0
  61. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/TreeSAK_config.py +0 -0
  62. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/VisHPD95.R +0 -0
  63. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/VisHPD95.py +0 -0
  64. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/__init__.py +0 -0
  65. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ale_parser.py +0 -0
  66. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ale_splitter.py +0 -0
  67. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/alignment_pruner.pl +0 -0
  68. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/catfasta2phy.py +0 -0
  69. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/compare_trees.R +0 -0
  70. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/compare_trees.py +0 -0
  71. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/dating.py +0 -0
  72. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/dating_ss.py +0 -0
  73. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/deltall.py +0 -0
  74. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/do_rrtc.rb +0 -0
  75. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/fa2phy.py +0 -0
  76. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/format_leaf_name.py +0 -0
  77. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/gap_stats.py +0 -0
  78. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/get_SCG_tree.py +0 -0
  79. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/get_arCOG_seq.py +0 -0
  80. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/global_functions.py +0 -0
  81. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/iTOL.py +0 -0
  82. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/keep_highest_rrtc.py +0 -0
  83. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/label_tree.R +0 -0
  84. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/label_tree.py +0 -0
  85. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/mad.py +0 -0
  86. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/mcmc2tree.py +0 -0
  87. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/mcmcTC.py +0 -0
  88. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/merge_pdf.py +0 -0
  89. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/pRTC.py +0 -0
  90. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/plot_distruibution_th.py +0 -0
  91. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/prep_mcmctree_ctl.py +0 -0
  92. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/print_leaves.py +0 -0
  93. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/pruneMSA.py +0 -0
  94. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/recode.py +0 -0
  95. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/rename_leaves.py +0 -0
  96. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/replace_clade.py +0 -0
  97. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/root_with_out_group.py +0 -0
  98. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
  99. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/subsample_drep_gnms.py +0 -0
  100. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/subset.py +0 -0
  101. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
  102. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/supertree.py +0 -0
  103. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/weighted_rand.rb +0 -0
  104. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/SOURCES.txt +0 -0
  105. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/dependency_links.txt +0 -0
  106. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/requires.txt +0 -0
  107. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/top_level.txt +0 -0
  108. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/bin/TreeSAK +0 -0
  109. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/setup.cfg +0 -0
  110. {TreeSAK-1.43.1 → TreeSAK-1.43.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.43.1
3
+ Version: 1.43.3
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.43.1
27
+ TreeSAK v1.43.3
@@ -19,12 +19,22 @@ TreeSAK ALE6 -1 ALE1_op_dir -3 ALE3_op_dir_30 -s species_tree.rooted.treefile -o
19
19
  -s: the tree used as input for ALE2
20
20
 
21
21
  # To be added:
22
- A dereplication step to the produced faa file.
22
+ 1. A dereplication step to the produced faa file.
23
23
 
24
24
  ===================================================================================================
25
25
  '''
26
26
 
27
27
 
28
+ def sep_path_basename_ext(file_in):
29
+
30
+ f_path, f_name = os.path.split(file_in)
31
+ if f_path == '':
32
+ f_path = '.'
33
+ f_base, f_ext = os.path.splitext(f_name)
34
+
35
+ return f_name, f_path, f_base, f_ext[1:]
36
+
37
+
28
38
  def get_internal_node_leaves(ale_species_tree_file, internal_node_id):
29
39
 
30
40
  ale_species_tree = Tree(ale_species_tree_file, format=1)
@@ -48,18 +58,20 @@ def ALE6(args):
48
58
  cog_annotation_wd = args['cog']
49
59
  kegg_annotation_wd = args['kegg']
50
60
 
51
- GeneContent_txt = '%s/GeneContent.txt' % ale3_op_dir
52
- SpeciesTreeRef = '%s/SpeciesTreeRef.newick' % ale3_op_dir
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
53
64
 
54
65
  ################################################## define op files #################################################
55
66
 
56
- faa_dir = '%s/faa_files' % op_dir
57
- cog_dir = '%s/annotation_COG' % op_dir
58
- kegg_dir = '%s/annotation_KEGG' % op_dir
59
- cog_df_txt = '%s/annotation_COG.txt' % op_dir
60
- cog_df_desc_txt = '%s/annotation_COG_desc.txt' % op_dir
61
- kegg_df_txt = '%s/annotation_KEGG.txt' % op_dir
62
- kegg_df_desc_txt = '%s/annotation_KEGG_desc.txt' % op_dir
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
63
75
 
64
76
  ########################################## get the id of nodes to process ##########################################
65
77
 
@@ -138,7 +150,8 @@ def ALE6(args):
138
150
  for each_prot_family in branch_content:
139
151
  each_prot_family_faa = '%s/%s.faa' % (ale1_op_dir, each_prot_family)
140
152
  for each_seq in SeqIO.parse(each_prot_family_faa, 'fasta'):
141
- seq_gnm = '_'.join(each_seq.id.split('_')[:-1])
153
+ seq_id = each_seq.id
154
+ seq_gnm = '_'.join(seq_id.split('_')[:-1])
142
155
  if seq_gnm in branch_child_set_original_name:
143
156
  branch_faa_handle.write('>%s %s\n' % (each_seq.id, each_prot_family))
144
157
  branch_faa_handle.write('%s\n' % each_seq.seq)
@@ -146,8 +159,9 @@ def ALE6(args):
146
159
  branch_faa_handle.close()
147
160
 
148
161
  # Read in COG annotation results
162
+ fun_to_gene_dict = dict()
149
163
  annotation_dict_cog = dict()
150
- id_to_fun_dict_cog = dict()
164
+ fun_id_to_desc_dict = dict()
151
165
  if cog_annotation_wd is not None:
152
166
 
153
167
  print('Reading in COG annotation results')
@@ -167,13 +181,18 @@ def ALE6(args):
167
181
  if line_index > 0:
168
182
  each_line_split = each_line.strip().split('\t')
169
183
  if len(each_line_split) == 4:
170
- annotation_dict_cog[gnm_id][each_line_split[0]] = each_line_split[1]
171
- id_to_fun_dict_cog[each_line_split[1]] = each_line_split[3]
184
+ gene_id = each_line_split[0]
185
+ cog_id = each_line_split[1]
186
+ cog_desc = each_line_split[3]
187
+ annotation_dict_cog[gnm_id][gene_id] = cog_id
188
+ fun_id_to_desc_dict[cog_id] = cog_desc
189
+ if cog_id not in fun_to_gene_dict:
190
+ fun_to_gene_dict[cog_id] = set()
191
+ fun_to_gene_dict[cog_id].add(gene_id)
172
192
  line_index += 1
173
193
 
174
194
  # Read in KEGG annotation results
175
195
  annotation_dict_kegg = dict()
176
- id_to_fun_dict_kegg = dict()
177
196
  if kegg_annotation_wd is not None:
178
197
 
179
198
  print('Reading in KEGG annotation results')
@@ -198,7 +217,10 @@ def ALE6(args):
198
217
  ko_d_id = each_line_split[4][2:]
199
218
  ko_d_desc = each_line_split[8]
200
219
  annotation_dict_kegg[gnm_id][gene_id] = ko_d_id
201
- id_to_fun_dict_kegg[ko_d_id] = ko_d_desc
220
+ fun_id_to_desc_dict[ko_d_id] = ko_d_desc
221
+ if ko_d_id not in fun_to_gene_dict:
222
+ fun_to_gene_dict[ko_d_id] = set()
223
+ fun_to_gene_dict[ko_d_id].add(gene_id)
202
224
  line_index += 1
203
225
 
204
226
  cog_dod = dict()
@@ -229,20 +251,20 @@ def ALE6(args):
229
251
  cog_annotation_txt = '%s/%s_COG.txt' % (cog_dir, each_branch)
230
252
  cog_annotation_txt_handle = open(cog_annotation_txt, 'w')
231
253
  for each_cog in sorted(list(branch_cog_set)):
232
- cog_annotation_txt_handle.write('%s\t%s\n' % (each_cog, id_to_fun_dict_cog[each_cog]))
254
+ cog_annotation_txt_handle.write('%s\t%s\n' % (each_cog, fun_id_to_desc_dict[each_cog]))
233
255
  cog_annotation_txt_handle.close()
234
256
 
235
257
  if len(branch_kegg_set) > 0:
236
258
  kegg_annotation_txt = '%s/%s_KEGG.txt' % (kegg_dir, each_branch)
237
259
  kegg_annotation_txt_handle = open(kegg_annotation_txt, 'w')
238
260
  for each_kegg in sorted(list(branch_kegg_set)):
239
- kegg_annotation_txt_handle.write('%s\t%s\n' % (each_kegg, id_to_fun_dict_kegg[each_kegg]))
261
+ kegg_annotation_txt_handle.write('%s\t%s\n' % (each_kegg, fun_id_to_desc_dict[each_kegg]))
240
262
  kegg_annotation_txt_handle.close()
241
263
 
242
264
  all_identified_cog_list_sorted = sorted(list(all_identified_cog_set))
243
265
  all_identified_kegg_list_sorted = sorted(list(all_identified_kegg_set))
244
- all_identified_cog_list_sorted_desc = [('%s__%s' % (i, id_to_fun_dict_cog[i])) for i in all_identified_cog_list_sorted]
245
- all_identified_kegg_list_sorted_desc = [('%s__%s' % (i, id_to_fun_dict_kegg[i])) for i in all_identified_kegg_list_sorted]
266
+ all_identified_cog_list_sorted_desc = [('%s__%s' % (i, fun_id_to_desc_dict[i])) for i in all_identified_cog_list_sorted]
267
+ all_identified_kegg_list_sorted_desc = [('%s__%s' % (i, fun_id_to_desc_dict[i])) for i in all_identified_kegg_list_sorted]
246
268
 
247
269
  # write out COG dataframe
248
270
  if len(all_identified_cog_set) > 0:
@@ -284,8 +306,67 @@ def ALE6(args):
284
306
  kegg_df_desc_txt_handle.close()
285
307
  print('Annotation matrix exported to: %s' % kegg_df_txt)
286
308
 
309
+ ################################# get transfer propensity of individual functions ##################################
310
+
311
+ print('Getting transfer propensity of individual function')
312
+
313
+ # get gene_to_oma_dict
314
+ faa_file_re = '%s/*.faa' % ale1_op_dir
315
+ faa_file_list = glob.glob(faa_file_re)
316
+ gene_to_oma_dict = dict()
317
+ for faa_file in faa_file_list:
318
+ _, _, faa_base, _ = sep_path_basename_ext(faa_file)
319
+ for each_seq in SeqIO.parse(faa_file, 'fasta'):
320
+ seq_id = each_seq.id
321
+ gene_to_oma_dict[seq_id] = faa_base
322
+
323
+ # get oma_to_transfer_propensity_dict
324
+ oma_to_transfer_propensity_dict = dict()
325
+ line_index = 0
326
+ for each_oma in open(transfer_propensity_txt):
327
+ if line_index > 0:
328
+ each_oma_split = each_oma.strip().split('\t')
329
+ oma_id = each_oma_split[0]
330
+ transfer_propensity = float(each_oma_split[1])
331
+ oma_to_transfer_propensity_dict[oma_id] = transfer_propensity
332
+ line_index += 1
333
+
334
+ fun_transfer_propensity_txt_handle = open(fun_transfer_propensity_txt, 'w')
335
+ fun_transfer_propensity_txt_handle.write('ID\tWeighted_transfer_propensity\tDescription\n')
336
+ oma_weighted_transfer_propensity_dict = dict()
337
+ for fun_id in sorted(list(fun_to_gene_dict.keys())):
338
+ current_fun_gene_set = fun_to_gene_dict[fun_id]
339
+ current_fun_oma_stats_dict = dict()
340
+ for gene_id in current_fun_gene_set:
341
+ gene_oma = gene_to_oma_dict.get(gene_id, 'na')
342
+ if gene_oma not in current_fun_oma_stats_dict:
343
+ current_fun_oma_stats_dict[gene_oma] = 1
344
+ else:
345
+ current_fun_oma_stats_dict[gene_oma] += 1
346
+
347
+ total_transfer_propensity = 0
348
+ total_oma_num = 0
349
+ for oma_id in current_fun_oma_stats_dict:
350
+ oma_num = current_fun_oma_stats_dict[oma_id]
351
+ oma_transfer_propensity = oma_to_transfer_propensity_dict.get(oma_id, 'na')
352
+ if oma_transfer_propensity != 'na':
353
+ total_transfer_propensity += (oma_num*oma_transfer_propensity)
354
+ total_oma_num += oma_num
355
+
356
+ oma_transfer_propensity_weighted = 'na'
357
+ if total_oma_num != 0:
358
+ oma_transfer_propensity_weighted = total_transfer_propensity/total_oma_num
359
+ oma_transfer_propensity_weighted = float("{0:.3f}".format(oma_transfer_propensity_weighted))
360
+
361
+ if oma_transfer_propensity_weighted != 'na':
362
+ oma_weighted_transfer_propensity_dict[fun_id] = oma_transfer_propensity_weighted
363
+ fun_transfer_propensity_txt_handle.write('%s\t%s\t%s\n' % (fun_id, oma_transfer_propensity_weighted, fun_id_to_desc_dict[fun_id]))
364
+
365
+ fun_transfer_propensity_txt_handle.close()
366
+
287
367
  print('Done!')
288
368
 
369
+
289
370
  if __name__ == '__main__':
290
371
 
291
372
  ALE6_parser = argparse.ArgumentParser()
@@ -1,4 +1,4 @@
1
- 1.43.1
1
+ 1.43.3
2
2
  - fixed bugs
3
3
 
4
4
  1.43.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.43.1
3
+ Version: 1.43.3
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.43.1
27
+ TreeSAK v1.43.3
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