File: read_newick.py

package info (click to toggle)
python-ete3 3.1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,152 kB
  • sloc: python: 52,375; javascript: 12,959; xml: 4,903; ansic: 69; sql: 65; makefile: 26; sh: 7
file content (9 lines) | stat: -rw-r--r-- 420 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
from ete3 import Tree
# Loads a tree structure from a newick string. The returned variable
# 't' is the root node for the tree.
t = Tree('(A:1,(B:1,(E:1,D:1):0.5):0.5);' )
# Load a tree structure from a newick file.
t = Tree('genes_tree.nh')
# You can also specify the newick format. For instance, for named
# internal nodes we will format 1.
t = Tree('(A:1,(B:1,(E:1,D:1)Internal_1:0.5)Internal_2:0.5)Root;', format=1)