TreeSAK 1.43.0__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.0/TreeSAK.egg-info → TreeSAK-1.43.3}/PKG-INFO +2 -2
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE6.py +106 -20
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE7.py +4 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/VERSION +3 -3
- {TreeSAK-1.43.0 → TreeSAK-1.43.3/TreeSAK.egg-info}/PKG-INFO +2 -2
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/LICENSE +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/MANIFEST.in +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/README.md +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE1.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE2.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE2RTC.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE3.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE4.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE5.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ALE_backup.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/AssessMarker.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/AssessMarkerPA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/AssessPB.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/BMGE.jar +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/BMGE.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/CompareMCMC.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ConcateMSA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/Dir.rb +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/FastRoot.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/FastRoot_backup.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/GTDB_tree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/KEGG_Luo17.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/LcaToLeaves.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/MarkerRef2Tree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ModifyTopo.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/Newick_tree_plotter.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/OMA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/OMA2.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/PB.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/PMSF.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/PhyloBiAssoc.R +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/PhyloBiAssoc.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/PlotMCMC.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/PlotMcmcNode.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/RootTree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/RootTreeGTDB214.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/RootTreeGTDB220.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SequentialDating.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SingleAleHGT.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SingleLinePhy.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SplitScore.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SplitScore1.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SplitScore1OMA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/SplitScore2.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/TaxaCountStats.R +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/TaxonTree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/VisHPD95.R +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/VisHPD95.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ale_parser.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/ale_splitter.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/alignment_pruner.pl +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/catfasta2phy.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/dating.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/dating_ss.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/deltall.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/do_rrtc.rb +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/fa2phy.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/gap_stats.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/get_SCG_tree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/global_functions.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/iTOL.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/keep_highest_rrtc.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/label_tree.R +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/label_tree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/mad.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/mcmc2tree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/mcmcTC.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/merge_pdf.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/pRTC.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/plot_distruibution_th.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/print_leaves.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/pruneMSA.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/recode.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/replace_clade.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/root_with_out_group.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/subsample_drep_gnms.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/subset.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/supertree.py +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK/weighted_rand.rb +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK.egg-info/SOURCES.txt +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/bin/TreeSAK +0 -0
- {TreeSAK-1.43.0 → TreeSAK-1.43.3}/setup.cfg +0 -0
- {TreeSAK-1.43.0 → 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
|
|
@@ -13,15 +13,28 @@ TreeSAK ALE6 -1 ALE1_op_dir -3 ALE3_op_dir_30 -s species_tree.rooted.treefile -o
|
|
|
13
13
|
TreeSAK ALE6 -1 ALE1_op_dir -3 ALE3_op_dir_30 -s species_tree.rooted.treefile -o ALE6_op_dir_30 -n 294,309,380,404
|
|
14
14
|
TreeSAK ALE6 -1 ALE1_op_dir -3 ALE3_op_dir_30 -s species_tree.rooted.treefile -o ALE6_op_dir_30 -n interested_nodes.txt
|
|
15
15
|
|
|
16
|
-
#
|
|
16
|
+
# Needed input files:
|
|
17
17
|
-1: faa files
|
|
18
18
|
-3: GeneContent.txt and SpeciesTreeRef.newick
|
|
19
19
|
-s: the tree used as input for ALE2
|
|
20
20
|
|
|
21
|
+
# To be added:
|
|
22
|
+
1. A dereplication step to the produced faa file.
|
|
23
|
+
|
|
21
24
|
===================================================================================================
|
|
22
25
|
'''
|
|
23
26
|
|
|
24
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
|
+
|
|
25
38
|
def get_internal_node_leaves(ale_species_tree_file, internal_node_id):
|
|
26
39
|
|
|
27
40
|
ale_species_tree = Tree(ale_species_tree_file, format=1)
|
|
@@ -45,17 +58,20 @@ def ALE6(args):
|
|
|
45
58
|
cog_annotation_wd = args['cog']
|
|
46
59
|
kegg_annotation_wd = args['kegg']
|
|
47
60
|
|
|
48
|
-
GeneContent_txt
|
|
49
|
-
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
|
|
50
64
|
|
|
51
65
|
################################################## define op files #################################################
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
59
75
|
|
|
60
76
|
########################################## get the id of nodes to process ##########################################
|
|
61
77
|
|
|
@@ -96,6 +112,7 @@ def ALE6(args):
|
|
|
96
112
|
if os.path.isdir(op_dir) is True:
|
|
97
113
|
os.system('rm -r %s' % op_dir)
|
|
98
114
|
os.system('mkdir %s' % op_dir)
|
|
115
|
+
os.system('mkdir %s' % faa_dir)
|
|
99
116
|
|
|
100
117
|
if cog_annotation_wd is not None:
|
|
101
118
|
os.system('mkdir %s' % cog_dir)
|
|
@@ -124,7 +141,7 @@ def ALE6(args):
|
|
|
124
141
|
|
|
125
142
|
branch_to_gene_dict = dict()
|
|
126
143
|
for each_branch in branch_to_content_dict:
|
|
127
|
-
branch_faa = '%s/%s.faa' % (
|
|
144
|
+
branch_faa = '%s/%s.faa' % (faa_dir, each_branch)
|
|
128
145
|
branch_content = branch_to_content_dict[each_branch]
|
|
129
146
|
branch_child_set = branch_to_leaf_dict[each_branch]
|
|
130
147
|
branch_child_set_original_name = {gnm_name_dict_new_to_old[i] for i in branch_child_set}
|
|
@@ -133,7 +150,8 @@ def ALE6(args):
|
|
|
133
150
|
for each_prot_family in branch_content:
|
|
134
151
|
each_prot_family_faa = '%s/%s.faa' % (ale1_op_dir, each_prot_family)
|
|
135
152
|
for each_seq in SeqIO.parse(each_prot_family_faa, 'fasta'):
|
|
136
|
-
|
|
153
|
+
seq_id = each_seq.id
|
|
154
|
+
seq_gnm = '_'.join(seq_id.split('_')[:-1])
|
|
137
155
|
if seq_gnm in branch_child_set_original_name:
|
|
138
156
|
branch_faa_handle.write('>%s %s\n' % (each_seq.id, each_prot_family))
|
|
139
157
|
branch_faa_handle.write('%s\n' % each_seq.seq)
|
|
@@ -141,8 +159,9 @@ def ALE6(args):
|
|
|
141
159
|
branch_faa_handle.close()
|
|
142
160
|
|
|
143
161
|
# Read in COG annotation results
|
|
162
|
+
fun_to_gene_dict = dict()
|
|
144
163
|
annotation_dict_cog = dict()
|
|
145
|
-
|
|
164
|
+
fun_id_to_desc_dict = dict()
|
|
146
165
|
if cog_annotation_wd is not None:
|
|
147
166
|
|
|
148
167
|
print('Reading in COG annotation results')
|
|
@@ -162,13 +181,18 @@ def ALE6(args):
|
|
|
162
181
|
if line_index > 0:
|
|
163
182
|
each_line_split = each_line.strip().split('\t')
|
|
164
183
|
if len(each_line_split) == 4:
|
|
165
|
-
|
|
166
|
-
|
|
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)
|
|
167
192
|
line_index += 1
|
|
168
193
|
|
|
169
194
|
# Read in KEGG annotation results
|
|
170
195
|
annotation_dict_kegg = dict()
|
|
171
|
-
id_to_fun_dict_kegg = dict()
|
|
172
196
|
if kegg_annotation_wd is not None:
|
|
173
197
|
|
|
174
198
|
print('Reading in KEGG annotation results')
|
|
@@ -193,7 +217,10 @@ def ALE6(args):
|
|
|
193
217
|
ko_d_id = each_line_split[4][2:]
|
|
194
218
|
ko_d_desc = each_line_split[8]
|
|
195
219
|
annotation_dict_kegg[gnm_id][gene_id] = ko_d_id
|
|
196
|
-
|
|
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)
|
|
197
224
|
line_index += 1
|
|
198
225
|
|
|
199
226
|
cog_dod = dict()
|
|
@@ -224,20 +251,20 @@ def ALE6(args):
|
|
|
224
251
|
cog_annotation_txt = '%s/%s_COG.txt' % (cog_dir, each_branch)
|
|
225
252
|
cog_annotation_txt_handle = open(cog_annotation_txt, 'w')
|
|
226
253
|
for each_cog in sorted(list(branch_cog_set)):
|
|
227
|
-
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]))
|
|
228
255
|
cog_annotation_txt_handle.close()
|
|
229
256
|
|
|
230
257
|
if len(branch_kegg_set) > 0:
|
|
231
258
|
kegg_annotation_txt = '%s/%s_KEGG.txt' % (kegg_dir, each_branch)
|
|
232
259
|
kegg_annotation_txt_handle = open(kegg_annotation_txt, 'w')
|
|
233
260
|
for each_kegg in sorted(list(branch_kegg_set)):
|
|
234
|
-
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]))
|
|
235
262
|
kegg_annotation_txt_handle.close()
|
|
236
263
|
|
|
237
264
|
all_identified_cog_list_sorted = sorted(list(all_identified_cog_set))
|
|
238
265
|
all_identified_kegg_list_sorted = sorted(list(all_identified_kegg_set))
|
|
239
|
-
all_identified_cog_list_sorted_desc = [('%s__%s' % (i,
|
|
240
|
-
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]
|
|
241
268
|
|
|
242
269
|
# write out COG dataframe
|
|
243
270
|
if len(all_identified_cog_set) > 0:
|
|
@@ -279,8 +306,67 @@ def ALE6(args):
|
|
|
279
306
|
kegg_df_desc_txt_handle.close()
|
|
280
307
|
print('Annotation matrix exported to: %s' % kegg_df_txt)
|
|
281
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
|
+
|
|
282
367
|
print('Done!')
|
|
283
368
|
|
|
369
|
+
|
|
284
370
|
if __name__ == '__main__':
|
|
285
371
|
|
|
286
372
|
ALE6_parser = argparse.ArgumentParser()
|
|
@@ -25,6 +25,10 @@ def ALE7(args):
|
|
|
25
25
|
interested_gnm_txt = args['node']
|
|
26
26
|
op_txt = args['o']
|
|
27
27
|
|
|
28
|
+
if os.path.isdir(ale6_op_dir) is False:
|
|
29
|
+
print('%s not found, program exited!' % ale6_op_dir)
|
|
30
|
+
exit()
|
|
31
|
+
|
|
28
32
|
interested_fun_set = set()
|
|
29
33
|
if os.path.isfile(interested_fun_txt) is False:
|
|
30
34
|
if ',' in interested_fun_txt:
|
|
@@ -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
|