mirror of
http://43.156.76.180:8026/YuuMJ/EukPhylo.git
synced 2025-12-27 10:10:25 +08:00
Cannot set myself as outgroup catch
This commit is contained in:
parent
21e54ab7e4
commit
81a46d2714
@ -214,18 +214,20 @@ def write_nexus(newick, leaf_colors, params):
|
|||||||
|
|
||||||
|
|
||||||
def tree_formatting_wrapper(file):
|
def tree_formatting_wrapper(file):
|
||||||
|
try:
|
||||||
|
newick = get_newick(file)
|
||||||
|
tree = ete3.Tree(newick)
|
||||||
|
|
||||||
newick = get_newick(file)
|
majs = list(dict.fromkeys([leaf.name[:2] for leaf in tree]))
|
||||||
tree = ete3.Tree(newick)
|
#Only try to reroot trees with more than 2 major clades. This was added to fix the ETE3 "Cannot set myself as outgroup" error
|
||||||
|
|
||||||
majs = list(dict.fromkeys([leaf.name[:2] for leaf in tree]))
|
if len(majs) > 2:
|
||||||
|
tree = reroot(tree)
|
||||||
|
tree.ladderize(direction = 1)
|
||||||
|
tree.write(outfile = 'ColoredTrees/' + file.split('/')[-1].split('.tree')[0] + '_Colored.tree')
|
||||||
|
except Exception as e:
|
||||||
|
print(f" {file.split('/')[-1]} has {e} error ")
|
||||||
|
|
||||||
#Only try to reroot trees with more than 2 major clades. This was added to fix the ETE3 "Cannot set myself as outgroup" error
|
|
||||||
if len(majs) > 2:
|
|
||||||
tree = reroot(tree)
|
|
||||||
|
|
||||||
tree.ladderize(direction = 1)
|
|
||||||
tree.write(outfile = 'ColoredTrees/' + file.split('/')[-1].split('.tree')[0] + '_Colored.tree')
|
|
||||||
|
|
||||||
|
|
||||||
def color(file, args):
|
def color(file, args):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user