diff options
Diffstat (limited to 'examples/phylogenies/link_sequences_to_phylogenies.py')
-rw-r--r-- | examples/phylogenies/link_sequences_to_phylogenies.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/phylogenies/link_sequences_to_phylogenies.py b/examples/phylogenies/link_sequences_to_phylogenies.py index 40220f0..b2f007c 100644 --- a/examples/phylogenies/link_sequences_to_phylogenies.py +++ b/examples/phylogenies/link_sequences_to_phylogenies.py @@ -25,9 +25,9 @@ iphylip_txt = """ t = PhyloTree("(((seqA,seqB),seqC),seqD);", alignment=fasta_txt, alg_format="fasta") #We can now access the sequence of every leaf node -print "These are the nodes and its sequences:" +print("These are the nodes and its sequences:") for leaf in t.iter_leaves(): - print leaf.name, leaf.sequence + print(leaf.name, leaf.sequence) #seqD MAEAPDETIQQFMALTNVSHNIAVQYLSEFGDLNEAL--------------REEAH #seqC MAEIPDATIQ---ALTNVSHNIAVQYLSEFGDLNEALNSYYASQTDDQPDRREEAH #seqA MAEIPDETIQQFMALT---HNIAVQYLSEFGDLNEALNSYYASQTDDIKDRREEAH @@ -36,9 +36,9 @@ for leaf in t.iter_leaves(): # The associated alignment can be changed at any time t.link_to_alignment(alignment=iphylip_txt, alg_format="iphylip") # Let's check that sequences have changed -print "These are the nodes and its re-linked sequences:" +print("These are the nodes and its re-linked sequences:") for leaf in t.iter_leaves(): - print leaf.name, leaf.sequence + print(leaf.name, leaf.sequence) #seqD MAEAPDETIQQFMALTNVSHNIAVQYLSEFGDLNEAL--------------REEAHQ----------FMALTNVSH #seqC MAEIPDATIQ---ALTNVSHNIAVQYLSEFGDLNEALNSYYASQTDDQPDRREEAHQFMALTNVSH---------- #seqA MAEIPDETIQQFMALT---HNIAVQYLSEFGDLNEALNSYYASQTDDIKDRREEAHQFMALTNVSHQFMALTNVSH @@ -46,7 +46,7 @@ for leaf in t.iter_leaves(): # # The sequence attribute is considered as node feature, so you can # even include sequences in your extended newick format! -print t.write(features=["sequence"], format=9) +print(t.write(features=["sequence"], format=9)) # # # (((seqA[&&NHX:sequence=MAEIPDETIQQFMALT---HNIAVQYLSEFGDLNEALNSYYASQTDDIKDRREEAHQF @@ -57,8 +57,8 @@ print t.write(features=["sequence"], format=9) # # And yes, you can save this newick text and reload it into a PhyloTree instance. sametree = PhyloTree(t.write(features=["sequence"])) -print "Recovered tree with sequence features:" -print sametree +print("Recovered tree with sequence features:") +print(sametree) # # /-seqA # /--------| @@ -68,5 +68,5 @@ print sametree # | # \-seqD # -print "seqA sequence:", (t&"seqA").sequence +print("seqA sequence:", (t&"seqA").sequence) # MAEIPDETIQQFMALT---HNIAVQYLSEFGDLNEALNSYYASQTDDIKDRREEAHQFMALTNVSHQFMALTNVSH |