TreeSAK 1.43.3__tar.gz → 1.45.0__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.3/TreeSAK.egg-info → TreeSAK-1.45.0}/PKG-INFO +2 -2
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE7.py +4 -4
- TreeSAK-1.45.0/TreeSAK/FunTree.py +197 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/VERSION +6 -0
- TreeSAK-1.45.0/TreeSAK/gnm_leaves.py +43 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/iTOL.py +1 -0
- TreeSAK-1.45.0/TreeSAK/iTOL_gene_tree.py +57 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/supertree.py +1 -1
- {TreeSAK-1.43.3 → TreeSAK-1.45.0/TreeSAK.egg-info}/PKG-INFO +2 -2
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK.egg-info/SOURCES.txt +3 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/bin/TreeSAK +28 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/LICENSE +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/MANIFEST.in +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/README.md +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE1.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE2.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE2RTC.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE3.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE4.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE5.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE6.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ALE_backup.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/AssessMarker.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/AssessMarkerPA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/AssessPB.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/BMGE.jar +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/BMGE.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/CompareMCMC.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ConcateMSA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/Dir.rb +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/FastRoot.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/FastRoot_backup.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/GTDB_tree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/KEGG_Luo17.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/LcaToLeaves.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/MarkerRef2Tree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ModifyTopo.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/Newick_tree_plotter.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/OMA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/OMA2.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/PB.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/PMSF.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/PhyloBiAssoc.R +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/PhyloBiAssoc.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/PlotMCMC.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/PlotMcmcNode.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/RootTree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/RootTreeGTDB214.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/RootTreeGTDB220.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SequentialDating.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SingleAleHGT.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SingleLinePhy.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SplitScore.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SplitScore1.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SplitScore1OMA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/SplitScore2.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/TaxaCountStats.R +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/TaxonTree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/VisHPD95.R +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/VisHPD95.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ale_parser.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/ale_splitter.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/alignment_pruner.pl +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/catfasta2phy.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/dating.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/dating_ss.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/deltall.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/do_rrtc.rb +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/fa2phy.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/gap_stats.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/get_SCG_tree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/global_functions.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/keep_highest_rrtc.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/label_tree.R +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/label_tree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/mad.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/mcmc2tree.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/mcmcTC.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/merge_pdf.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/pRTC.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/plot_distruibution_th.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/print_leaves.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/pruneMSA.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/recode.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/replace_clade.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/root_with_out_group.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/subsample_drep_gnms.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/subset.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK/weighted_rand.rb +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/setup.cfg +0 -0
- {TreeSAK-1.43.3 → TreeSAK-1.45.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.45.0
|
|
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.
|
|
27
|
+
TreeSAK v1.45.0
|
|
@@ -20,10 +20,10 @@ TreeSAK ALE7 -6 ALE6_op_dir -fun arCOG07811,K01995 -node 359,466,470 -o Fun_PA.t
|
|
|
20
20
|
|
|
21
21
|
def ALE7(args):
|
|
22
22
|
|
|
23
|
-
ale6_op_dir
|
|
24
|
-
interested_fun_txt
|
|
25
|
-
interested_gnm_txt
|
|
26
|
-
op_txt
|
|
23
|
+
ale6_op_dir = args['6']
|
|
24
|
+
interested_fun_txt = args['fun']
|
|
25
|
+
interested_gnm_txt = args['node']
|
|
26
|
+
op_txt = args['o']
|
|
27
27
|
|
|
28
28
|
if os.path.isdir(ale6_op_dir) is False:
|
|
29
29
|
print('%s not found, program exited!' % ale6_op_dir)
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import glob
|
|
3
|
+
import argparse
|
|
4
|
+
from Bio import SeqIO
|
|
5
|
+
import multiprocessing as mp
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
FunTree_usage = '''
|
|
9
|
+
================================ FunTree example commands ================================
|
|
10
|
+
|
|
11
|
+
TreeSAK FunTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun ko.txt
|
|
12
|
+
TreeSAK FunTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun K01995
|
|
13
|
+
TreeSAK FunTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun K01995,K01996
|
|
14
|
+
|
|
15
|
+
==========================================================================================
|
|
16
|
+
'''
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def select_seq(seq_file, seq_id_set, output_file):
|
|
20
|
+
output_file_handle = open(output_file, 'w')
|
|
21
|
+
for seq_record in SeqIO.parse(seq_file, 'fasta'):
|
|
22
|
+
seq_id = seq_record.id
|
|
23
|
+
if seq_id in seq_id_set:
|
|
24
|
+
SeqIO.write(seq_record, output_file_handle, 'fasta-2line')
|
|
25
|
+
output_file_handle.close()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def FunTree(args):
|
|
29
|
+
|
|
30
|
+
combined_faa = args['i']
|
|
31
|
+
cog_annotation_wd = args['cog']
|
|
32
|
+
kegg_annotation_wd = args['kegg']
|
|
33
|
+
interested_fun_txt = args['fun']
|
|
34
|
+
op_dir = args['o']
|
|
35
|
+
trim_with_bmge = args['bmge']
|
|
36
|
+
trim_model = args['bmge_m']
|
|
37
|
+
entropy_score_cutoff = args['bmge_esc']
|
|
38
|
+
iqtree_model = args['iqtree_m']
|
|
39
|
+
force_overwrite = args['f']
|
|
40
|
+
num_of_threads = args['t']
|
|
41
|
+
|
|
42
|
+
# specify path to BMGE.jar
|
|
43
|
+
current_file_path = '/'.join(os.path.realpath(__file__).split('/')[:-1])
|
|
44
|
+
pwd_bmge_jar = '%s/BMGE.jar' % current_file_path
|
|
45
|
+
|
|
46
|
+
interested_fun_set = set()
|
|
47
|
+
if os.path.isfile(interested_fun_txt) is False:
|
|
48
|
+
if ',' in interested_fun_txt:
|
|
49
|
+
interested_fun_set = interested_fun_txt.split(',')
|
|
50
|
+
else:
|
|
51
|
+
interested_fun_set.add(interested_fun_txt)
|
|
52
|
+
else:
|
|
53
|
+
for each_fun in open(interested_fun_txt):
|
|
54
|
+
interested_fun_set.add(each_fun.strip().split()[0])
|
|
55
|
+
|
|
56
|
+
################################################################################
|
|
57
|
+
|
|
58
|
+
faa_dir = '%s/dir_1_faa' % op_dir
|
|
59
|
+
aln_dir = '%s/dir_2_msa' % op_dir
|
|
60
|
+
trimmed_aln_dir = '%s/dir_3_trimmed_msa' % op_dir
|
|
61
|
+
tree_dir = '%s/dir_4_tree' % op_dir
|
|
62
|
+
cmd_1_mafft_txt = '%s/cmd_1_mafft.txt' % op_dir
|
|
63
|
+
cmd_2_trim_txt = '%s/cmd_2_trim.txt' % op_dir
|
|
64
|
+
cmd_3_tree_txt = '%s/cmd_3_tree.txt' % op_dir
|
|
65
|
+
|
|
66
|
+
################################################################################
|
|
67
|
+
|
|
68
|
+
# create output folder
|
|
69
|
+
if os.path.isdir(op_dir) is True:
|
|
70
|
+
if force_overwrite is True:
|
|
71
|
+
os.system('rm -r %s' % op_dir)
|
|
72
|
+
else:
|
|
73
|
+
print('%s exist, program exited!' % op_dir)
|
|
74
|
+
exit()
|
|
75
|
+
|
|
76
|
+
os.mkdir(op_dir)
|
|
77
|
+
os.mkdir(faa_dir)
|
|
78
|
+
os.mkdir(aln_dir)
|
|
79
|
+
os.mkdir(trimmed_aln_dir)
|
|
80
|
+
os.mkdir(tree_dir)
|
|
81
|
+
|
|
82
|
+
################################################################################
|
|
83
|
+
|
|
84
|
+
fun_to_gene_dict = dict()
|
|
85
|
+
if kegg_annotation_wd is not None:
|
|
86
|
+
|
|
87
|
+
print('Reading in KEGG annotation results')
|
|
88
|
+
file_re = '%s/*KEGG_wd/*_ko_assignment_ABCD.txt' % (kegg_annotation_wd)
|
|
89
|
+
file_list = glob.glob(file_re)
|
|
90
|
+
|
|
91
|
+
if len(file_list) == 0:
|
|
92
|
+
print('KEGG annotation file not detected, program exited!')
|
|
93
|
+
exit()
|
|
94
|
+
|
|
95
|
+
for each_file in file_list:
|
|
96
|
+
line_index = 0
|
|
97
|
+
for each_line in open(each_file):
|
|
98
|
+
if line_index > 0:
|
|
99
|
+
each_line_split = each_line.strip().split('\t')
|
|
100
|
+
if len(each_line_split) == 9:
|
|
101
|
+
gene_id = each_line_split[0]
|
|
102
|
+
ko_d_id = each_line_split[4][2:]
|
|
103
|
+
if ko_d_id in interested_fun_set:
|
|
104
|
+
if ko_d_id not in fun_to_gene_dict:
|
|
105
|
+
fun_to_gene_dict[ko_d_id] = set()
|
|
106
|
+
fun_to_gene_dict[ko_d_id].add(gene_id)
|
|
107
|
+
line_index += 1
|
|
108
|
+
|
|
109
|
+
cmd_list_mafft = []
|
|
110
|
+
cmd_list_trim = []
|
|
111
|
+
cmd_list_tree = []
|
|
112
|
+
cmd_1_mafft_txt_handle = open(cmd_1_mafft_txt, 'w')
|
|
113
|
+
cmd_2_trim_txt_handle = open(cmd_2_trim_txt, 'w')
|
|
114
|
+
cmd_3_tree_txt_handle = open(cmd_3_tree_txt, 'w')
|
|
115
|
+
for each_fun in sorted(fun_to_gene_dict):
|
|
116
|
+
|
|
117
|
+
# define file name
|
|
118
|
+
fun_faa = '%s/%s.faa' % (faa_dir, each_fun)
|
|
119
|
+
current_gene_tree_dir = '%s/%s' % (tree_dir, each_fun)
|
|
120
|
+
fun_aln = '%s/%s.aln' % (aln_dir, each_fun)
|
|
121
|
+
fun_aln_trimmed = '%s/%s_trimal.aln' % (trimmed_aln_dir, each_fun)
|
|
122
|
+
if trim_with_bmge is True:
|
|
123
|
+
fun_aln_trimmed = '%s/%s_bmge.aln' % (trimmed_aln_dir, each_fun)
|
|
124
|
+
|
|
125
|
+
# extract sequences
|
|
126
|
+
current_fun_gene_set = fun_to_gene_dict[each_fun]
|
|
127
|
+
select_seq(combined_faa, current_fun_gene_set, fun_faa)
|
|
128
|
+
|
|
129
|
+
os.system('mkdir %s' % current_gene_tree_dir)
|
|
130
|
+
|
|
131
|
+
# prepare commands
|
|
132
|
+
mafft_cmd = 'mafft-einsi --thread %s --quiet %s > %s' % (1, fun_faa, fun_aln)
|
|
133
|
+
trim_cmd = 'trimal -in %s -out %s -automated1' % (fun_aln, fun_aln_trimmed)
|
|
134
|
+
if trim_with_bmge is True:
|
|
135
|
+
trim_cmd = 'java -jar %s -i %s -m %s -t AA -h %s -of %s' % (pwd_bmge_jar, fun_aln, trim_model, entropy_score_cutoff, fun_aln_trimmed)
|
|
136
|
+
infer_tree_cmd = 'iqtree2 -s %s --seqtype AA -m %s -B 1000 --wbtl --bnni --prefix %s/%s -T %s --quiet' % (fun_aln_trimmed, iqtree_model, current_gene_tree_dir, each_fun, num_of_threads)
|
|
137
|
+
|
|
138
|
+
# add commands to list
|
|
139
|
+
cmd_list_mafft.append(mafft_cmd)
|
|
140
|
+
cmd_list_trim.append(trim_cmd)
|
|
141
|
+
cmd_list_tree.append(infer_tree_cmd)
|
|
142
|
+
|
|
143
|
+
# write out commands
|
|
144
|
+
cmd_1_mafft_txt_handle.write(mafft_cmd + '\n')
|
|
145
|
+
cmd_2_trim_txt_handle.write(trim_cmd + '\n')
|
|
146
|
+
cmd_3_tree_txt_handle.write(infer_tree_cmd + '\n')
|
|
147
|
+
|
|
148
|
+
cmd_1_mafft_txt_handle.close()
|
|
149
|
+
cmd_2_trim_txt_handle.close()
|
|
150
|
+
cmd_3_tree_txt_handle.close()
|
|
151
|
+
|
|
152
|
+
# run mafft commands
|
|
153
|
+
print('Running mafft with %s cores for %s commands' % (num_of_threads, len(cmd_list_mafft)))
|
|
154
|
+
pool = mp.Pool(processes=num_of_threads)
|
|
155
|
+
pool.map(os.system, cmd_list_mafft)
|
|
156
|
+
pool.close()
|
|
157
|
+
pool.join()
|
|
158
|
+
|
|
159
|
+
# run trim commands
|
|
160
|
+
print('Trimming with %s cores for %s commands' % (num_of_threads, len(cmd_list_trim)))
|
|
161
|
+
pool = mp.Pool(processes=num_of_threads)
|
|
162
|
+
pool.map(os.system, cmd_list_trim)
|
|
163
|
+
pool.close()
|
|
164
|
+
pool.join()
|
|
165
|
+
|
|
166
|
+
# run iqtree commands
|
|
167
|
+
print('Running iqtree with %s cores' % num_of_threads)
|
|
168
|
+
for each_iqtree_cmd in sorted(cmd_list_tree):
|
|
169
|
+
print(each_iqtree_cmd)
|
|
170
|
+
os.system(each_iqtree_cmd)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
if __name__ == '__main__':
|
|
174
|
+
|
|
175
|
+
FunTree_parser = argparse.ArgumentParser()
|
|
176
|
+
FunTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
|
|
177
|
+
FunTree_parser.add_argument('-fun', required=True, help='interested functions')
|
|
178
|
+
FunTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
|
|
179
|
+
FunTree_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation results')
|
|
180
|
+
FunTree_parser.add_argument('-o', required=True, help='output directory')
|
|
181
|
+
FunTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
|
|
182
|
+
FunTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
|
|
183
|
+
FunTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
|
|
184
|
+
FunTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
|
|
185
|
+
FunTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
186
|
+
FunTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
|
|
187
|
+
args = vars(FunTree_parser.parse_args())
|
|
188
|
+
FunTree(args)
|
|
189
|
+
|
|
190
|
+
'''
|
|
191
|
+
|
|
192
|
+
cd /scratch/PI/ocessongwz/Sponge_r220/4_OMA_wd/OMA_wd/Output
|
|
193
|
+
TreeSAK FunTree -i /scratch/PI/ocessongwz/Sponge_r220/3_combined_genomes_50_5_dRep97_291.faa -fun K01995,K01996,K01997,K01998,K01999 -kegg /scratch/PI/ocessongwz/Sponge_r220/3_combined_genomes_50_5_dRep97_291_KEGG_wd -o interested_fun_tree_branched_chain_aa_transport_system -bmge -t 12 -f
|
|
194
|
+
|
|
195
|
+
/scratch/PI/ocessongwz/Sponge_r220/3_combined_genomes_50_5_dRep97_291_arCOG_wd
|
|
196
|
+
|
|
197
|
+
'''
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
from ete3 import Tree
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
gnm_leaves_usage = '''
|
|
7
|
+
========== gnm_leaves example commands ==========
|
|
8
|
+
|
|
9
|
+
TreeSAK gnm_leaves -i input.tree -o output.tree
|
|
10
|
+
|
|
11
|
+
=================================================
|
|
12
|
+
'''
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def gnm_leaves(args):
|
|
16
|
+
|
|
17
|
+
tree_file_in = args['i']
|
|
18
|
+
tree_file_out = args['o']
|
|
19
|
+
tree_format = args['fmt']
|
|
20
|
+
|
|
21
|
+
if os.path.isfile(tree_file_in) is False:
|
|
22
|
+
print('Tree file not found, program exited!')
|
|
23
|
+
exit()
|
|
24
|
+
|
|
25
|
+
t = Tree(tree_file_in, format=tree_format)
|
|
26
|
+
|
|
27
|
+
for leaf in t:
|
|
28
|
+
leaf_name = leaf.name
|
|
29
|
+
leaf_name_new = '_'.join(leaf_name.split('_')[:-1])
|
|
30
|
+
leaf.name = leaf_name_new
|
|
31
|
+
t.write(format=tree_format, outfile=tree_file_out)
|
|
32
|
+
|
|
33
|
+
print('Done!')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if __name__ == '__main__':
|
|
37
|
+
|
|
38
|
+
gnm_leaves_parser = argparse.ArgumentParser()
|
|
39
|
+
gnm_leaves_parser.add_argument('-i', required=True, help='input tree')
|
|
40
|
+
gnm_leaves_parser.add_argument('-o', required=True, help='output tree')
|
|
41
|
+
gnm_leaves_parser.add_argument('-fmt', required=False, default=1, type=int, help='tree format, default: 1')
|
|
42
|
+
args = vars(gnm_leaves_parser.parse_args())
|
|
43
|
+
gnm_leaves(args)
|
|
@@ -620,6 +620,7 @@ if __name__ == '__main__':
|
|
|
620
620
|
iTOL_parser.add_argument('-dr', required=False, default=None, help='Donor to Recipient')
|
|
621
621
|
iTOL_parser.add_argument('-scale', required=False, default=None, help='Scale Values, in format 0-3-6-9')
|
|
622
622
|
iTOL_parser.add_argument('-lt', required=False, default=None, help='Legend Title')
|
|
623
|
+
iTOL_parser.add_argument('-gene', required=False, action='store_true', help='In case leaves are genes')
|
|
623
624
|
iTOL_parser.add_argument('-o', required=True, help='Output filename')
|
|
624
625
|
args = vars(iTOL_parser.parse_args())
|
|
625
626
|
iTOL(args)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
from ete3 import Tree
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
iTOL_gene_tree_usage = '''
|
|
7
|
+
================== iTOL_gene_tree example commands ==================
|
|
8
|
+
|
|
9
|
+
TreeSAK -g gene.tree -i genome_taxon.txt -o gene_taxon.txt
|
|
10
|
+
TreeSAK -g gene.tree -i genome_habitat.txt -o gene_habitat.txt
|
|
11
|
+
TreeSAK -g gene.tree -i genome_abundance.txt -o gene_abundance.txt
|
|
12
|
+
|
|
13
|
+
=====================================================================
|
|
14
|
+
'''
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def iTOL_gene_tree(args):
|
|
18
|
+
|
|
19
|
+
tree_file = args['g']
|
|
20
|
+
meta_txt = args['i']
|
|
21
|
+
op_txt = args['o']
|
|
22
|
+
|
|
23
|
+
if os.path.isfile(tree_file) is False:
|
|
24
|
+
print('Tree file not found, program exited!')
|
|
25
|
+
exit()
|
|
26
|
+
|
|
27
|
+
if os.path.isfile(meta_txt) is False:
|
|
28
|
+
print('Metadata file not found, program exited!')
|
|
29
|
+
exit()
|
|
30
|
+
|
|
31
|
+
metadata_dict = dict()
|
|
32
|
+
for each_gnm in open(meta_txt):
|
|
33
|
+
each_gnm_split = each_gnm.strip().split('\t')
|
|
34
|
+
if len(each_gnm_split) == 2:
|
|
35
|
+
gnm_id = each_gnm_split[0]
|
|
36
|
+
meta_value = each_gnm_split[1]
|
|
37
|
+
metadata_dict[gnm_id] = meta_value
|
|
38
|
+
|
|
39
|
+
op_txt_handle = open(op_txt, 'w')
|
|
40
|
+
for leaf in Tree(tree_file, format=1):
|
|
41
|
+
leaf_name = leaf.name
|
|
42
|
+
gnm_name = '_'.join(leaf_name.split('_')[:-1])
|
|
43
|
+
gnm_meta = metadata_dict.get(gnm_name, 'na')
|
|
44
|
+
op_txt_handle.write('%s\t%s\n' % (leaf_name, gnm_meta))
|
|
45
|
+
op_txt_handle.close()
|
|
46
|
+
|
|
47
|
+
print('Done!')
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == '__main__':
|
|
51
|
+
|
|
52
|
+
iTOL_gene_tree_parser = argparse.ArgumentParser(usage=iTOL_gene_tree_usage)
|
|
53
|
+
iTOL_gene_tree_parser.add_argument('-i', required=True, help='input metadata')
|
|
54
|
+
iTOL_gene_tree_parser.add_argument('-g', required=True, help='gene tree file')
|
|
55
|
+
iTOL_gene_tree_parser.add_argument('-o', required=True, help='output metadata')
|
|
56
|
+
args = vars(iTOL_gene_tree_parser.parse_args())
|
|
57
|
+
iTOL_gene_tree(args)
|
|
@@ -160,7 +160,7 @@ def supertree(args):
|
|
|
160
160
|
fa_file_list = ['.'.join(os.path.basename(i).split('.')[:-1]) for i in glob.glob(fa_file_re)]
|
|
161
161
|
|
|
162
162
|
if len(fa_file_list) == 0:
|
|
163
|
-
print('No file found in %s,
|
|
163
|
+
print('No file found in %s, program exited!' % oma_op_fasta)
|
|
164
164
|
exit()
|
|
165
165
|
|
|
166
166
|
################################################################################
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.45.0
|
|
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.
|
|
27
|
+
TreeSAK v1.45.0
|
|
@@ -26,6 +26,7 @@ TreeSAK/Dir.rb
|
|
|
26
26
|
TreeSAK/ExtractMarkerSeq.py
|
|
27
27
|
TreeSAK/FastRoot.py
|
|
28
28
|
TreeSAK/FastRoot_backup.py
|
|
29
|
+
TreeSAK/FunTree.py
|
|
29
30
|
TreeSAK/GTDB_tree.py
|
|
30
31
|
TreeSAK/KEGG_Luo17.py
|
|
31
32
|
TreeSAK/LcaToLeaves.py
|
|
@@ -77,7 +78,9 @@ TreeSAK/gap_stats.py
|
|
|
77
78
|
TreeSAK/get_SCG_tree.py
|
|
78
79
|
TreeSAK/get_arCOG_seq.py
|
|
79
80
|
TreeSAK/global_functions.py
|
|
81
|
+
TreeSAK/gnm_leaves.py
|
|
80
82
|
TreeSAK/iTOL.py
|
|
83
|
+
TreeSAK/iTOL_gene_tree.py
|
|
81
84
|
TreeSAK/keep_highest_rrtc.py
|
|
82
85
|
TreeSAK/label_tree.R
|
|
83
86
|
TreeSAK/label_tree.py
|
|
@@ -57,6 +57,7 @@ def print_main_help():
|
|
|
57
57
|
|
|
58
58
|
Tree-related
|
|
59
59
|
iTOL -> Prepare iTOL files
|
|
60
|
+
iTOL_gene_tree -> Genome metadata to gene metadata
|
|
60
61
|
PB -> Infer tree with PhyloBayes-MPI
|
|
61
62
|
supertree -> Infer species tree from gene trees
|
|
62
63
|
AssessPB -> Compare PhyloBayes chains
|
|
@@ -72,6 +73,7 @@ def print_main_help():
|
|
|
72
73
|
ModifyTopo -> Modify tree topology
|
|
73
74
|
GeneRax -> (to be added) Run GeneRax
|
|
74
75
|
ALE -> Modules for running ALE
|
|
76
|
+
FunTree -> Infer tree for individual COG/KEGG function
|
|
75
77
|
RootTree -> Root tree with outgroup leaves
|
|
76
78
|
RootTreeGTDB214 -> Root tree by GTDB taxonomy (r214)
|
|
77
79
|
RootTreeGTDB220 -> Root tree by GTDB taxonomy (r220)
|
|
@@ -824,6 +826,32 @@ if __name__ == '__main__':
|
|
|
824
826
|
args = vars(parser.parse_args())
|
|
825
827
|
mcmc2tree.mcmc2tree(args)
|
|
826
828
|
|
|
829
|
+
elif sys.argv[1] == 'FunTree':
|
|
830
|
+
from TreeSAK import FunTree
|
|
831
|
+
FunTree_parser = subparsers.add_parser('FunTree', usage=FunTree.FunTree_usage)
|
|
832
|
+
FunTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
|
|
833
|
+
FunTree_parser.add_argument('-fun', required=True, help='interested functions')
|
|
834
|
+
FunTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
|
|
835
|
+
FunTree_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation results')
|
|
836
|
+
FunTree_parser.add_argument('-o', required=True, help='output directory')
|
|
837
|
+
FunTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
|
|
838
|
+
FunTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
|
|
839
|
+
FunTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
|
|
840
|
+
FunTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
|
|
841
|
+
FunTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
842
|
+
FunTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
|
|
843
|
+
args = vars(parser.parse_args())
|
|
844
|
+
FunTree.FunTree(args)
|
|
845
|
+
|
|
846
|
+
elif sys.argv[1] == 'iTOL_gene_tree':
|
|
847
|
+
from TreeSAK import iTOL_gene_tree
|
|
848
|
+
iTOL_gene_tree_parser = subparsers.add_parser('iTOL_gene_tree', usage=iTOL_gene_tree.iTOL_gene_tree_usage)
|
|
849
|
+
iTOL_gene_tree_parser.add_argument('-i', required=True, help='input metadata')
|
|
850
|
+
iTOL_gene_tree_parser.add_argument('-g', required=True, help='gene tree file')
|
|
851
|
+
iTOL_gene_tree_parser.add_argument('-o', required=True, help='output metadata')
|
|
852
|
+
args = vars(parser.parse_args())
|
|
853
|
+
iTOL_gene_tree.iTOL_gene_tree(args)
|
|
854
|
+
|
|
827
855
|
else:
|
|
828
856
|
print('Unrecognized module: %s, program exited' % sys.argv[1])
|
|
829
857
|
exit()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|