mirror of
http://43.156.76.180:8026/YuuMJ/EukPhylo.git
synced 2025-12-27 06:00:26 +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):
|
||||
|
||||
try:
|
||||
newick = get_newick(file)
|
||||
tree = ete3.Tree(newick)
|
||||
|
||||
majs = list(dict.fromkeys([leaf.name[:2] for leaf in tree]))
|
||||
|
||||
#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')
|
||||
except Exception as e:
|
||||
print(f" {file.split('/')[-1]} has {e} error ")
|
||||
|
||||
|
||||
|
||||
def color(file, args):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user