Skip to content

Instantly share code, notes, and snippets.

@flashton2003
Created March 21, 2019 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flashton2003/a2633c40ab683c0a02191344652ba52e to your computer and use it in GitHub Desktop.
Save flashton2003/a2633c40ab683c0a02191344652ba52e to your computer and use it in GitHub Desktop.
midpoint roots a tree
from ete3 import Tree
import fileinput
lines = []
for line in fileinput.input():
lines.append(line.strip())
tree = Tree(lines[0])
R = tree.get_midpoint_outgroup()
tree.set_outgroup(R)
print tree.write()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment