diff options
Diffstat (limited to 'examples/general/nhx_format.py')
-rw-r--r-- | examples/general/nhx_format.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/general/nhx_format.py b/examples/general/nhx_format.py index 059e7eb..e989c1b 100644 --- a/examples/general/nhx_format.py +++ b/examples/general/nhx_format.py @@ -2,7 +2,7 @@ import random from ete3 import Tree # Creates a normal tree t = Tree('((H:0.3,I:0.1):0.5, A:1,(B:0.4,(C:0.5,(J:1.3,(F:1.2, D:0.1):0.5):0.5):0.5):0.5);') -print t +print(t) # Let's locate some nodes using the get common ancestor method ancestor=t.get_common_ancestor("J", "F", "C") # Let's label leaf nodes @@ -16,21 +16,21 @@ for leaf in t.traverse(): matches = [leaf for leaf in ancestor.traverse() if leaf.dist>1.0] # And save this pre-computed information into the ancestor node ancestor.add_feature("long_branch_nodes", matches) -print -print "NHX notation including vowel and confidence attributes" -print -print t.write(features=["vowel", "confidence"]) -print -print "NHX notation including all node's data" -print +print() +print("NHX notation including vowel and confidence attributes") +print() +print(t.write(features=["vowel", "confidence"])) +print() +print("NHX notation including all node's data") +print() # Note that when all features are requested, only those with values # equal to text-strings or numbers are considered. "long_branch_nodes" # is not included into the newick string. -print t.write(features=[]) -print -print "basic newick formats are still available" -print -print t.write(format=9, features=["vowel"]) +print(t.write(features=[])) +print() +print("basic newick formats are still available") +print() +print(t.write(format=9, features=["vowel"])) # You don't need to do anything speciall to read NHX notation. Just # specify the newick format and the NHX tags will be automatically # detected. @@ -46,4 +46,4 @@ t = Tree(nw) # And access node's attributes. for n in t.traverse(): if hasattr(n,"S"): - print n.name, n.S + print(n.name, n.S) |