TreeSAK 1.46.28__tar.gz → 1.46.30__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.46.28/TreeSAK.egg-info → TreeSAK-1.46.30}/PKG-INFO +2 -2
- TreeSAK-1.46.30/TreeSAK/RootTree.py +101 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/VERSION +1 -1
- {TreeSAK-1.46.28 → TreeSAK-1.46.30/TreeSAK.egg-info}/PKG-INFO +2 -2
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/bin/TreeSAK +2 -0
- TreeSAK-1.46.28/TreeSAK/RootTree.py +0 -38
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/LICENSE +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/MANIFEST.in +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/README.md +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE1.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE2.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE2RTC.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE3.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE4.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE5.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE6.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE7.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ALE_backup.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/AssessMarker.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/AssessMarkerPA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/AssessPB.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/BMGE.jar +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/BMGE.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/CompareMCMC.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ConcateMSA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/Dir.rb +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/FastRoot.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/FastRoot_backup.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/FigTree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/GTDB_tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/KEGG_Luo17.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/LcaToLeaves.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/MarkerRef2Tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/MarkerSeq2Tree_backup.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ModifyTopo.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/Newick_tree_plotter.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/OMA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/OMA2.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PB.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PMSF.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PhyloBiAssoc.R +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PhyloBiAssoc.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PlotMCMC.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PlotMcmcNode.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/PlotMcmcNode_old.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/RootTreeGTDB214.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/RootTreeGTDB220.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SequentialDating.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SingleAleHGT.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SingleLinePhy.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SplitScore.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SplitScore1.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SplitScore1OMA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/SplitScore2.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/TaxaCountStats.R +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/TaxonTree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/VisHPD95.R +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/VisHPD95.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ale_parser.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/ale_splitter.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/alignment_pruner.pl +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/assessOG.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/catfasta2phy.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/cogTree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/dating.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/dating_ss.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/deltall.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/do_rrtc.rb +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/fa2phy.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/gap_stats.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/get_SCG_tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/global_functions.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/gnm_leaves.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/iTOL.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/iTOL_gene_tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/keep_highest_rrtc.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/koTree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/label_tree.R +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/label_tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/mad.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/mcmc2tree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/mcmcTC.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/merge_pdf.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/pRTC.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/plot_distruibution_th.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/print_leaves.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/pruneMSA.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/recode.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/remove_bias.R +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/replace_clade.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/root_with_out_group.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/subsample_drep_gnms.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/subset.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/supertree.py +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK/weighted_rand.rb +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK.egg-info/SOURCES.txt +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/setup.cfg +0 -0
- {TreeSAK-1.46.28 → TreeSAK-1.46.30}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.46.
|
|
3
|
+
Version: 1.46.30
|
|
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.
|
|
27
|
+
TreeSAK v1.46.30
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import dendropy
|
|
3
|
+
import argparse
|
|
4
|
+
from ete3 import Tree
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
RootTree_usage = '''
|
|
8
|
+
====================== RootTree example commands ======================
|
|
9
|
+
|
|
10
|
+
TreeSAK RootTree -i input.tree -og outgroup_genomes.txt -o rooted.tree
|
|
11
|
+
|
|
12
|
+
=======================================================================
|
|
13
|
+
'''
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def root_with_outgroup(input_tree, out_group_list, add_root_branch, tree_file_rooted):
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
Reroot the tree using the given outgroup.
|
|
20
|
+
modified based on: https://github.com/Ecogenomics/GTDBTk/blob/master/gtdbtk/reroot_tree.py
|
|
21
|
+
|
|
22
|
+
input_tree: File containing Newick tree to rerooted.
|
|
23
|
+
output_tree: Name of file for rerooted tree.
|
|
24
|
+
outgroup: Labels of taxa in outgroup.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
tree = dendropy.Tree.get_from_path(input_tree, schema='newick', rooting='force-rooted', preserve_underscores=True)
|
|
28
|
+
|
|
29
|
+
outgroup_in_tree = set()
|
|
30
|
+
ingroup_leaves = set()
|
|
31
|
+
for n in tree.leaf_node_iter():
|
|
32
|
+
if n.taxon.label in out_group_list:
|
|
33
|
+
outgroup_in_tree.add(n.taxon)
|
|
34
|
+
else:
|
|
35
|
+
ingroup_leaves.add(n)
|
|
36
|
+
|
|
37
|
+
# Since finding the MRCA is a rooted tree operation, the tree is first rerooted on an ingroup taxa. This
|
|
38
|
+
# ensures the MRCA of the outgroup can be identified so long as the outgroup is monophyletic. If the
|
|
39
|
+
# outgroup is polyphyletic trying to root on it is ill-defined. To try and pick a "good" root for
|
|
40
|
+
# polyphyletic outgroups, random ingroup taxa are selected until two of them give the same size
|
|
41
|
+
# lineage. This will, likely, be the smallest bipartition possible for the given outgroup though
|
|
42
|
+
# this is not guaranteed.
|
|
43
|
+
|
|
44
|
+
mrca = tree.mrca(taxa=outgroup_in_tree)
|
|
45
|
+
mrca_leaves = len(mrca.leaf_nodes())
|
|
46
|
+
while True:
|
|
47
|
+
rnd_ingroup = random.sample(list(ingroup_leaves), 1)[0]
|
|
48
|
+
tree.reroot_at_edge(rnd_ingroup.edge, length1=0.5 * rnd_ingroup.edge_length, length2=0.5 * rnd_ingroup.edge_length)
|
|
49
|
+
mrca = tree.mrca(taxa=outgroup_in_tree)
|
|
50
|
+
if len(mrca.leaf_nodes()) == mrca_leaves:
|
|
51
|
+
break
|
|
52
|
+
mrca_leaves = len(mrca.leaf_nodes())
|
|
53
|
+
|
|
54
|
+
if mrca.edge_length is not None:
|
|
55
|
+
tree.reroot_at_edge(mrca.edge, length1=0.5 * mrca.edge_length, length2=0.5 * mrca.edge_length)
|
|
56
|
+
|
|
57
|
+
# tree.write_to_path(tree_file_rooted, schema='newick', suppress_rooting=True, unquoted_underscores=True)
|
|
58
|
+
tree_out_string = tree.as_string(schema='newick', suppress_rooting=True, unquoted_underscores=True)
|
|
59
|
+
tree_out_string = tree_out_string.replace("'", "")
|
|
60
|
+
|
|
61
|
+
# add the root bar
|
|
62
|
+
if add_root_branch is True:
|
|
63
|
+
tree_out_string = '(' + tree_out_string
|
|
64
|
+
tree_out_string = tree_out_string.replace(');', '):0.02);')
|
|
65
|
+
|
|
66
|
+
# write out tree string
|
|
67
|
+
tree_file_rooted_handle = open(tree_file_rooted, 'w')
|
|
68
|
+
tree_file_rooted_handle.write(tree_out_string)
|
|
69
|
+
tree_file_rooted_handle.close()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def RootTree(args):
|
|
73
|
+
|
|
74
|
+
tree_file = args['i']
|
|
75
|
+
out_group_txt = args['og']
|
|
76
|
+
tree_file_rooted = args['o']
|
|
77
|
+
tree_fmt = args['fmt']
|
|
78
|
+
add_root_branch = args['add_root']
|
|
79
|
+
|
|
80
|
+
out_group_set = set()
|
|
81
|
+
for each_og in open(out_group_txt):
|
|
82
|
+
out_group_set.add(each_og.strip())
|
|
83
|
+
|
|
84
|
+
# tre = Tree(tree_file, format=tree_fmt)
|
|
85
|
+
# out_group_lca = tre.get_common_ancestor(out_group_set)
|
|
86
|
+
# tre.set_outgroup(out_group_lca)
|
|
87
|
+
# tre.write(outfile=tree_file_rooted, format=tree_fmt)
|
|
88
|
+
|
|
89
|
+
root_with_outgroup(tree_file, out_group_set, add_root_branch, tree_file_rooted)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == '__main__':
|
|
93
|
+
|
|
94
|
+
RootTree_parser = argparse.ArgumentParser()
|
|
95
|
+
RootTree_parser.add_argument('-i', required=True, help='input tree')
|
|
96
|
+
RootTree_parser.add_argument('-og', required=True, help='out group leaves')
|
|
97
|
+
RootTree_parser.add_argument('-o', required=True, help='output tree')
|
|
98
|
+
RootTree_parser.add_argument('-add_root', required=False, action='store_true', help='add the root branch')
|
|
99
|
+
RootTree_parser.add_argument('-fmt', required=False, default=1, type=int, help='tree format, default: 1')
|
|
100
|
+
args = vars(RootTree_parser.parse_args())
|
|
101
|
+
RootTree(args)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.46.
|
|
3
|
+
Version: 1.46.30
|
|
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.
|
|
27
|
+
TreeSAK v1.46.30
|
|
@@ -598,6 +598,7 @@ if __name__ == '__main__':
|
|
|
598
598
|
RootTree_parser.add_argument('-i', required=True, help='input tree')
|
|
599
599
|
RootTree_parser.add_argument('-og', required=True, help='out group leaves')
|
|
600
600
|
RootTree_parser.add_argument('-o', required=True, help='output tree')
|
|
601
|
+
RootTree_parser.add_argument('-add_root', required=False, action='store_true', help='add the root branch')
|
|
601
602
|
RootTree_parser.add_argument('-fmt', required=False, default=1, type=int, help='tree format, default: 1')
|
|
602
603
|
args = vars(parser.parse_args())
|
|
603
604
|
RootTree.RootTree(args)
|
|
@@ -763,6 +764,7 @@ if __name__ == '__main__':
|
|
|
763
764
|
from TreeSAK import iTOL
|
|
764
765
|
iTOL_parser = subparsers.add_parser('iTOL', description='Decorate tree with iTOL', usage=iTOL.iTOL_usage)
|
|
765
766
|
iTOL_parser.add_argument('-Labels', required=False, action='store_true', help='Labels')
|
|
767
|
+
iTOL_parser.add_argument('-MultiStyleLabel', required=False, action='store_true', help='MultiStyleLabel')
|
|
766
768
|
iTOL_parser.add_argument('-ColorStrip', required=False, action='store_true', help='ColorStrip')
|
|
767
769
|
iTOL_parser.add_argument('-ColorRange', required=False, action='store_true', help='ColorRange')
|
|
768
770
|
iTOL_parser.add_argument('-ColorClade', required=False, action='store_true', help='ColorClade')
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from ete3 import Tree
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
RootTree_usage = '''
|
|
6
|
-
====================== RootTree example commands ======================
|
|
7
|
-
|
|
8
|
-
TreeSAK RootTree -i input.tree -og outgroup_genomes.txt -o rooted.tree
|
|
9
|
-
|
|
10
|
-
=======================================================================
|
|
11
|
-
'''
|
|
12
|
-
|
|
13
|
-
def RootTree(args):
|
|
14
|
-
|
|
15
|
-
tree_file = args['i']
|
|
16
|
-
out_group_txt = args['og']
|
|
17
|
-
tree_file_rooted = args['o']
|
|
18
|
-
tree_fmt = args['fmt']
|
|
19
|
-
|
|
20
|
-
out_group_set = set()
|
|
21
|
-
for each_og in open(out_group_txt):
|
|
22
|
-
out_group_set.add(each_og.strip())
|
|
23
|
-
|
|
24
|
-
tre = Tree(tree_file, format=tree_fmt)
|
|
25
|
-
out_group_lca = tre.get_common_ancestor(out_group_set)
|
|
26
|
-
tre.set_outgroup(out_group_lca)
|
|
27
|
-
tre.write(outfile=tree_file_rooted, format=tree_fmt)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if __name__ == '__main__':
|
|
31
|
-
|
|
32
|
-
RootTree_parser = argparse.ArgumentParser()
|
|
33
|
-
RootTree_parser.add_argument('-i', required=True, help='input tree')
|
|
34
|
-
RootTree_parser.add_argument('-og', required=True, help='out group leaves')
|
|
35
|
-
RootTree_parser.add_argument('-o', required=True, help='output tree')
|
|
36
|
-
RootTree_parser.add_argument('-fmt', required=False, default=1, type=int, help='tree format, default: 1')
|
|
37
|
-
args = vars(RootTree_parser.parse_args())
|
|
38
|
-
RootTree(args)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|