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.
- {TreeSAK-1.43.1/TreeSAK.egg-info → TreeSAK-1.43.3}/PKG-INFO +2 -2
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE6.py +101 -20
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/VERSION +1 -1
- {TreeSAK-1.43.1 → TreeSAK-1.43.3/TreeSAK.egg-info}/PKG-INFO +2 -2
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/LICENSE +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/MANIFEST.in +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/README.md +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE1.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE2.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE2RTC.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE3.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE4.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE5.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE7.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ALE_backup.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessMarker.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessMarkerPA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/AssessPB.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/BMGE.jar +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/BMGE.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/CompareMCMC.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ConcateMSA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/Dir.rb +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/FastRoot.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/FastRoot_backup.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/GTDB_tree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/KEGG_Luo17.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/LcaToLeaves.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/MarkerRef2Tree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ModifyTopo.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/Newick_tree_plotter.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/OMA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/OMA2.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PB.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PMSF.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PhyloBiAssoc.R +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PhyloBiAssoc.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PlotMCMC.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/PlotMcmcNode.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/RootTree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/RootTreeGTDB214.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/RootTreeGTDB220.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SequentialDating.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SingleAleHGT.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SingleLinePhy.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore1.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore1OMA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/SplitScore2.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/TaxaCountStats.R +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/TaxonTree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/VisHPD95.R +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/VisHPD95.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ale_parser.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/ale_splitter.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/alignment_pruner.pl +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/catfasta2phy.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/dating.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/dating_ss.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/deltall.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/do_rrtc.rb +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/fa2phy.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/gap_stats.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/get_SCG_tree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/global_functions.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/iTOL.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/keep_highest_rrtc.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/label_tree.R +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/label_tree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/mad.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/mcmc2tree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/mcmcTC.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/merge_pdf.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/pRTC.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/plot_distruibution_th.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/print_leaves.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/pruneMSA.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/recode.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/replace_clade.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/root_with_out_group.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/subsample_drep_gnms.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/subset.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/supertree.py +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK/weighted_rand.rb +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/SOURCES.txt +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/bin/TreeSAK +0 -0
- {TreeSAK-1.43.1 → TreeSAK-1.43.3}/setup.cfg +0 -0
- {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.
|
|
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.
|
|
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
|
|
52
|
-
SpeciesTreeRef
|
|
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
|
|
57
|
-
cog_dir
|
|
58
|
-
kegg_dir
|
|
59
|
-
cog_df_txt
|
|
60
|
-
cog_df_desc_txt
|
|
61
|
-
kegg_df_txt
|
|
62
|
-
kegg_df_desc_txt
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
171
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
245
|
-
all_identified_kegg_list_sorted_desc = [('%s__%s' % (i,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.43.
|
|
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.
|
|
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
|
|
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
|