[med-svn] [Git][med-team/python-ete3][master] 4 commits: More work on test suite.
Andreas Tille
gitlab at salsa.debian.org
Mon Oct 29 19:04:51 GMT 2018
Andreas Tille pushed to branch master at Debian Med / python-ete3
Commits:
38b88070 by Andreas Tille at 2018-10-29T15:58:21Z
More work on test suite.
- - - - -
e8c700fa by Andreas Tille at 2018-10-29T18:13:49Z
Fix more dependencies, ignore test errors for the moment
- - - - -
e4ffa61f by Andreas Tille at 2018-10-29T18:18:06Z
Run 2to3 on examples
- - - - -
8e72137e by Andreas Tille at 2018-10-29T18:50:39Z
Fix issues in 2to3 patch
- - - - -
5 changed files:
- debian/control
- + debian/patches/series
- + debian/patches/skip_online_tests.patch
- + debian/patches/syntax_fixes.patch
- debian/rules
Changes:
=====================================
debian/control
=====================================
@@ -10,16 +10,17 @@ Build-Depends: debhelper (>= 11~),
python-setuptools,
python-lxml,
python-numpy,
- python-qt4,
+ python-pyqt5,
python-scipy,
python-six,
python3-all-dev,
python3-setuptools,
python3-numpy,
python3-lxml,
- python3-pyqt4,
+ python3-pyqt5,
python3-scipy,
- python3-six
+ python3-six,
+ python3-skbio
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/med-team/python-ete3
Vcs-Git: https://salsa.debian.org/med-team/python-ete3.git
=====================================
debian/patches/series
=====================================
@@ -0,0 +1,2 @@
+skip_online_tests.patch
+syntax_fixes.patch
=====================================
debian/patches/skip_online_tests.patch
=====================================
@@ -0,0 +1,14 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Mon, 29 Oct 2018 14:47:53 +0100
+Description: Ignore test requiring online access
+
+--- a/ete3/test/test_api.py
++++ b/ete3/test/test_api.py
+@@ -6,7 +6,6 @@ from .test_tree import *
+ from .test_interop import *
+ from .test_seqgroup import *
+ from .test_phylotree import *
+-from .test_ncbiquery import *
+
+ from .test_arraytable import *
+ from .test_clustertree import *
=====================================
debian/patches/syntax_fixes.patch
=====================================
@@ -0,0 +1,1453 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Mon, 29 Oct 2018 14:47:53 +0100
+Description: Run 2to3 on examples
+
+--- a/examples/clustering/bubbles_validation.py
++++ b/examples/clustering/bubbles_validation.py
+@@ -13,7 +13,7 @@ array = t.arraytable
+
+ # Calculates some stats on the matrix. Needed to establish the color
+ # gradients.
+-matrix_dist = [i for r in xrange(len(array.matrix))\
++matrix_dist = [i for r in range(len(array.matrix))\
+ for i in array.matrix[r] if numpy.isfinite(i)]
+ matrix_max = numpy.max(matrix_dist)
+ matrix_min = numpy.min(matrix_dist)
+--- a/examples/clustering/cluster_visualization.py
++++ b/examples/clustering/cluster_visualization.py
+@@ -13,8 +13,8 @@ F\t-1.04\t-1.11\t0.87\t-0.14\t-0.80\t1.7
+ G\t-1.57\t-1.17\t1.29\t0.23\t-0.20\t1.17\t0.26
+ H\t-1.53\t-1.25\t0.59\t-0.30\t0.32\t1.41\t0.77
+ """
+-print "Example numerical matrix"
+-print matrix
++print("Example numerical matrix")
++print(matrix)
+ # #Names col1 col2 col3 col4 col5 col6 col7
+ # A -1.23 -0.81 1.79 0.78 -0.42 -0.69 0.58
+ # B -1.76 -0.94 1.16 0.36 0.41 -0.35 1.12
+--- a/examples/clustering/clustering_tree.py
++++ b/examples/clustering/clustering_tree.py
+@@ -13,8 +13,8 @@ F\t-1.04\t-1.11\t0.87\t-0.14\t-0.80\t1.7
+ G\t-1.57\t-1.17\t1.29\t0.23\t-0.20\t1.17\t0.26
+ H\t-1.53\t-1.25\t0.59\t-0.30\t0.32\t1.41\t0.77
+ """
+-print "Example numerical matrix"
+-print matrix
++print("Example numerical matrix")
++print(matrix)
+ # #Names col1 col2 col3 col4 col5 col6 col7
+ # A -1.23 -0.81 1.79 0.78 -0.42 -0.69 0.58
+ # B -1.76 -0.94 1.16 0.36 0.41 -0.35 1.12
+@@ -30,7 +30,7 @@ print matrix
+ # numerical matrix. We use the text_array argument to link the tree
+ # with numerical matrix.
+ t = ClusterTree("(((A,B),(C,(D,E))),(F,(G,H)));", text_array=matrix)
+-print "Example tree", t
++print("Example tree", t)
+ # /-A
+ # /--------|
+ # | \-B
+@@ -49,18 +49,18 @@ print "Example tree", t
+
+ # Now we can ask the numerical profile associated to each node
+ A = t.search_nodes(name='A')[0]
+-print "A associated profile:\n", A.profile
++print("A associated profile:\n", A.profile)
+ # [-1.23 -0.81 1.79 0.78 -0.42 -0.69 0.58]
+ #
+ # Or we can ask for the mean numerical profile of an internal
+ # partition, which is computed as the average of all vectors under the
+ # the given node.
+ cluster = t.get_common_ancestor("E", "A")
+-print "Internal cluster mean profile:\n", cluster.profile
++print("Internal cluster mean profile:\n", cluster.profile)
+ #[-1.574 -0.686 1.048 -0.012 -0.118 0.614 0.728]
+ #
+ # We can also obtain the std. deviation vector of the mean profile
+-print "Internal cluster std deviation profile:\n", cluster.deviation
++print("Internal cluster std deviation profile:\n", cluster.deviation)
+ #[ 0.36565558 0.41301816 0.40676283 0.56211743 0.50704635 0.94949671
+ # 0.26753691]
+ # If would need to re-link the tree to a different matrix or use
+@@ -96,7 +96,7 @@ H\t0\t0\t0\t0\t0\t0\t0
+ # obviated from association.
+ t.children[0].link_to_arraytable(matrix_ones)
+ t.children[1].link_to_arraytable(matrix_zeros)
+-print "A profile (using matrix with 1s", (t&"A").profile
+-print "H profile (using matrix with 0s)", (t&"H").profile
++print("A profile (using matrix with 1s", (t&"A").profile)
++print("H profile (using matrix with 0s)", (t&"H").profile)
+ #A profile (using matrix with 1s [ 1. 1. 1. 1. 1. 1. 1.]
+ #H profile (using matrix with 0s) [ 0. 0. 0. 0. 0. 0. 0.]
+--- a/examples/evol/1_freeratio.py
++++ b/examples/evol/1_freeratio.py
+@@ -23,13 +23,13 @@ tree = EvolTree ("data/S_example/measuri
+
+ print (tree)
+
+-input ('\n tree loaded, hit some key.\n')
++eval(input ('\n tree loaded, hit some key.\n'))
+
+ print ('Now, it is necessary to link this tree to an alignment:')
+
+ tree.link_to_alignment ('data/S_example/alignment_S_measuring_evol.fasta')
+
+-input ('\n alignment loaded, hit some key to see.\n')
++eval(input ('\n alignment loaded, hit some key to see.\n'))
+
+ tree.show()
+
+@@ -38,28 +38,28 @@ we will run free-ratio model that is one
+ function run_model:
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ ''')
+-print (tree.run_model.__doc__ +'\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
++print(tree.run_model.__doc__ +'\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
+
+ tree.run_model ('fb.example')
+
+-input ('free-ratio model runned, all results are store in a Model object.')
++eval(input ('free-ratio model runned, all results are store in a Model object.'))
+
+ fb = tree.get_evol_model('fb.example')
+
+ print ('Have a look to the parameters used to run this model on codeml: ')
+-print (fb.get_ctrl_string())
+-input ('hit some key...')
++print(fb.get_ctrl_string())
++eval(input ('hit some key...'))
+
+
+ print ('Have a look to run message of codeml: ')
+-print (fb.run)
+-input ('hit some key...')
++print(fb.run)
++eval(input ('hit some key...'))
+
+ print ('Have a look to log likelihood value of this model, and number of parameters:')
+-print ('lnL: %s and np: %s' % (fb.lnL, fb.np))
+-input ('hit some key...')
++print('lnL: %s and np: %s' % (fb.lnL, fb.np))
++eval(input ('hit some key...'))
+
+-input ('finally have a look to two layouts available to display free-ratio:')
++eval(input ('finally have a look to two layouts available to display free-ratio:'))
+ tree.show()
+
+ # have to import layou
+--- a/examples/evol/2_sites_model.py
++++ b/examples/evol/2_sites_model.py
+@@ -24,14 +24,14 @@ try:
+ except NameError:
+ pass
+
+-input ('\n tree and alignment loaded\n Hit some key, to start computation of site models M1 and M2.\n')
++eval(input ('\n tree and alignment loaded\n Hit some key, to start computation of site models M1 and M2.\n'))
+
+ print ('running model M1')
+ tree.run_model ('M1')
+ print ('running model M2')
+ tree.run_model ('M2')
+
+-print ('\n\n comparison of models M1 and M2, p-value: ' + str(tree.get_most_likely ('M2','M1')))
++print('\n\n comparison of models M1 and M2, p-value: ' + str(tree.get_most_likely ('M2','M1')))
+
+ #tree.show()
+
+@@ -73,8 +73,8 @@ tree.run_model ('M8a')
+ print ('running model M3')
+ tree.run_model ('M3')
+
+-print ('\n\n comparison of models M7 and M8, p-value: ' + str(tree.get_most_likely ('M8','M7')))
+-print ('\n\n comparison of models M8a and M8, p-value: ' + str(tree.get_most_likely ('M8','M8a')))
++print('\n\n comparison of models M7 and M8, p-value: ' + str(tree.get_most_likely ('M8','M7')))
++print('\n\n comparison of models M8a and M8, p-value: ' + str(tree.get_most_likely ('M8','M8a')))
+
+
+ print ('The End.')
+--- a/examples/evol/3_branchsite_test.py
++++ b/examples/evol/3_branchsite_test.py
+@@ -34,9 +34,9 @@ tree.run_model('M0')
+
+ for leaf in tree:
+ leaf.node_id
+- print ('\n---------\nNow working with leaf ' + leaf.name)
++ print('\n---------\nNow working with leaf ' + leaf.name)
+ tree.mark_tree([leaf.node_id], marks=['#1'])
+- print (tree.write())
++ print(tree.write())
+ # to organize a bit, we name model with the name of the marked node
+ # any character after the dot, in model name, is not taken into account
+ # for computation. (have a look in /tmp/ete3.../bsA.. directory)
+@@ -46,9 +46,9 @@ for leaf in tree:
+ print ('p-value of positive selection for sites on this branch is: ')
+ ps = tree.get_most_likely('bsA.' + leaf.name, 'bsA1.'+ leaf.name)
+ rx = tree.get_most_likely('bsA1.'+ leaf.name, 'M0')
+- print (str(ps))
++ print(str(ps))
+ print ('p-value of relaxation for sites on this branch is: ')
+- print (str(rx))
++ print(str(rx))
+ model = tree.get_evol_model("bsA." + leaf.name)
+ if ps < 0.05 and float(model.classes['foreground w'][2]) > 1:
+ print ('we have positive selection on sites on this branch')
+@@ -58,7 +58,7 @@ for leaf in tree:
+ else:
+ print ('no signal detected on this branch, best fit for M0')
+ print ('\nclean tree, remove marks')
+- tree.mark_tree(map(lambda x: x.node_id, tree.get_descendants()),
++ tree.mark_tree([x.node_id for x in tree.get_descendants()],
+ marks=[''] * len(tree.get_descendants()), verbose=True)
+
+ # nothing working yet to get which sites are under positive selection/relaxation,
+--- a/examples/evol/4_branch_models.py
++++ b/examples/evol/4_branch_models.py
+@@ -28,12 +28,12 @@ tree.link_to_alignment ('data/S_example/
+ print (tree)
+
+ print ('Tree and alignment loaded.')
+-input ('Tree will be mark in order to contrast Gorilla and Chimpanzee as foreground \nspecies.')
++eval(input ('Tree will be mark in order to contrast Gorilla and Chimpanzee as foreground \nspecies.'))
+
+ marks = ['1', '3', '7']
+
+ tree.mark_tree (marks, ['#1'] * 3)
+-print (tree.write ())
++print(tree.write ())
+
+ print ('we can easily colorize marked branches')
+ # display marked branches in orange
+@@ -57,13 +57,13 @@ tree.run_model ('b_neut.137')
+ print ('running M0 (all branches have the save value of omega)...')
+ tree.run_model ('M0')
+
+-input ('''Now we can do comparisons...
++eval(input ('''Now we can do comparisons...
+ Compare first if we have one or 2 rates of evolution among phylogeny.
+ LRT between b_free and M0 (that is one or two rates of omega value)
+-p-value ofthis comparison is:''')
+-print (tree.get_most_likely ('b_free.137', 'M0'))
++p-value ofthis comparison is:'''))
++print(tree.get_most_likely ('b_free.137', 'M0'))
+
+-input ('''
++eval(input ('''
+ Now test if foreground rate is significantly different of 1.
+ (b_free with significantly better likelihood than b_neut)
+ if significantly different, and higher than one, we will be under
+@@ -71,17 +71,17 @@ positive selection, if different and low
+ negative selection. And finally if models are not significantly different
+ we should accept null hypothesis that omega value on marked branches is
+ equal to 1, what would be a signal of relaxation.
+-p-value for difference in rates between marked branches and the rest:''')
+-print (tree.get_most_likely ('b_free.137', 'M0'))
++p-value for difference in rates between marked branches and the rest:'''))
++print(tree.get_most_likely ('b_free.137', 'M0'))
+ print ('p-value representing significance that omega is different of 1:')
+-print (tree.get_most_likely ('b_free.137', 'b_neut.137'))
++print(tree.get_most_likely ('b_free.137', 'b_neut.137'))
+
+ print ('value of omega in marked branch (frg branch):')
+ b_free = tree.get_evol_model ('b_free.137')
+-print (b_free.branches[1]['w'])
++print(b_free.branches[1]['w'])
+
+ print ('and value of omega for background: ')
+-print (b_free.branches[2]['w'])
++print(b_free.branches[2]['w'])
+
+ print ('we will now run 2 branch models over this tree, one letting the omega \nvalue of foreground species to be free, and the other fixing it at one.\n')
+
+--- a/examples/evol/5_branchsite_cladetest.py
++++ b/examples/evol/5_branchsite_cladetest.py
+@@ -26,12 +26,12 @@ tree.link_to_alignment ('data/S_example/
+ print (tree)
+
+ print ('Tree and alignment loaded.')
+-input ('Tree will be mark in order to contrast Gorilla and Chimpanzee as foreground \nspecies.')
++eval(input ('Tree will be mark in order to contrast Gorilla and Chimpanzee as foreground \nspecies.'))
+
+ marks = ['1', 3, '7']
+
+ tree.mark_tree (marks, ['#1'] * 3)
+-print (tree.write ())
++print(tree.write ())
+
+ # display marked branches in orange
+ for node in tree.traverse ():
+@@ -65,7 +65,7 @@ tree.run_model ('M1')
+
+ print ('''p-value that, in marked clade, we have one class of site
+ specifically evolving at a different rate:''')
+-print (tree.get_most_likely ('bsC.137', 'M1'))
++print(tree.get_most_likely ('bsC.137', 'M1'))
+ #print ('p-value representing significance that omega is different of 1:')
+ #print (tree.get_most_likely ('bsD.137', 'M3'))
+
+--- a/examples/evol/measuring_evolution_trees.py
++++ b/examples/evol/measuring_evolution_trees.py
+@@ -7,7 +7,7 @@ import sys, re
+
+ typ = None
+ while typ != 'L' and typ != 'S':
+- typ = raw_input(\
++ typ = input(\
+ "choose kind of example [L]ong or [S]hort, hit [L] or [S]:\n").upper()
+ TREE_PATH = "data/%s_example/measuring_%s_tree.nw" % (typ, typ)
+
+@@ -24,8 +24,8 @@ ALG_PATH = MY_PATH + re.sub('\./', '',
+ # load tree
+
+
+-print '\n ----> we create a EvolTree object, and give to him a topology, from',
+-print TREE_PATH
++print('\n ----> we create a EvolTree object, and give to him a topology, from\n')
++print(TREE_PATH)
+ out = True
+ while out == True:
+ try:
+@@ -33,7 +33,7 @@ while out == True:
+ out = False
+ except:
+ sys.stderr.write('Bad path for working directory. Enter new path or quit("Q"):\n')
+- PATH = raw_input('')
++ PATH = input('')
+ if PATH.startswith('q') or PATH.startswith('Q'):
+ sys.exit()
+ TREE_PATH = "./measuring_%s_tree.nw" % (typ)
+@@ -42,62 +42,62 @@ while out == True:
+ ALG_PATH = PATH + re.sub('\./', '', ALG_PATH )
+
+
+-print T
+-print '\n ----> and an alignment from: \n'+ALG_PATH+'\n\n'
++print(T)
++print('\n ----> and an alignment from: \n'+ALG_PATH+'\n\n')
+ T.link_to_alignment(ALG_PATH)
+-raw_input(" ====> hit some key to see the Tree with alignment")
++input(" ====> hit some key to see the Tree with alignment")
+ T.show()
+
+ ###
+ # run free-branch model, and display result
+-print '\n\n\n ----> We define now our working directory, that will be created:', \
+- WORKING_PATH
++print('\n\n\n ----> We define now our working directory, that will be created:', \
++ WORKING_PATH)
+ T.workdir = (WORKING_PATH)
+-print '\n ----> and run the free-branch model with run_model function:\n\n%s\n%s\n%s\n'\
+- % ('*'*10 + ' doc ' + '*'*10, T.run_model.func_doc, '*'*30)
++print('\n ----> and run the free-branch model with run_model function:\n\n%s\n%s\n%s\n'\
++ % ('*'*10 + ' doc ' + '*'*10, T.run_model.__doc__, '*'*30))
+
+-raw_input(" ====> Hit some key to start free-branch computation with codeml...\n")
++input(" ====> Hit some key to start free-branch computation with codeml...\n")
+ T.run_model('fb')
+ T.show()
+
+ ###
+ # run site model, and display result
+-print '\n\n\n ----> We are now goingn to run sites model M1 and M2 with run_model function:\n'
+-raw_input(" ====> hit some key to start")
++print('\n\n\n ----> We are now goingn to run sites model M1 and M2 with run_model function:\n')
++input(" ====> hit some key to start")
+ for model in ['M1', 'M2']:
+- print 'running model ' + model
++ print('running model ' + model)
+ T.run_model(model)
+
+-print '\n\n\n ----> and use the get_most_likely function to compute the LRT between those models:\n'
+-print 'get_most_likely function: \n\n'+ '*'*10 + ' doc ' + '*'*10
+-print '\n' + T.get_most_likely.func_doc
+-print '*'*30
++print('\n\n\n ----> and use the get_most_likely function to compute the LRT between those models:\n')
++print('get_most_likely function: \n\n'+ '*'*10 + ' doc ' + '*'*10)
++print('\n' + T.get_most_likely.__doc__)
++print('*'*30)
+
+-raw_input("\n ====> Hit some key to launch LRT")
++input("\n ====> Hit some key to launch LRT")
+
+ pv = T.get_most_likely('M2', 'M1')
+ if pv <= 0.05:
+- print ' ----> -> most likely model is model M2, there is positive selection, pval: ',pv
++ print(' ----> -> most likely model is model M2, there is positive selection, pval: ',pv)
+ else:
+- print ' ----> -> most likely model is model M1, pval: ',pv
++ print(' ----> -> most likely model is model M1, pval: ',pv)
+
+-raw_input(" ====> Hit some key...")
++input(" ====> Hit some key...")
+
+ ###
+ # tengo que encontrar un ejemplo mas bonito pero bueno.... :P
+
+-print '\n\n\n ----> We now add histograms to our tree to repesent site models with add_histface function: \n\n%s\n%s\n%s\n'\
+- % ('*'*10 + ' doc ' + '*'*10, T.get_evol_model('M2').set_histface.func_doc,'*'*30)
+-print 'Upper face is an histogram representing values of omega for each column in the alignment,'
+-print '\
++print('\n\n\n ----> We now add histograms to our tree to repesent site models with add_histface function: \n\n%s\n%s\n%s\n'\
++ % ('*'*10 + ' doc ' + '*'*10, T.get_evol_model('M2').set_histface.__doc__,'*'*30))
++print('Upper face is an histogram representing values of omega for each column in the alignment,')
++print('\
+ Colors represent significantly conserved sites(cyan to blue), neutral sites(greens), or under \n\
+ positive selection(orange to red). \n\
+ Lower face also represents values of omega(red line) and bars represent the error of the estimation.\n\
+ Also significance of belonging to one class of site can be painted in background(here lightgrey for\n\
+ evrething significant)\n\
+ Both representation are done according to BEB estimation of M2, M1 or M7 estimation can also be \n\
+-drawn but should not be used.\n'
+-raw_input(" ====> Hit some key to display, histograms of omegas BEB from M2 model...")
++drawn but should not be used.\n')
++input(" ====> Hit some key to display, histograms of omegas BEB from M2 model...")
+
+ col = {'NS' : 'grey',
+ 'RX' : 'grey',
+@@ -118,12 +118,12 @@ T.show(histfaces = ['M1', 'M2'])
+
+ ###
+ # re-run without reeeeeeeeee-run
+-print '\n\n\n ----> Now we have runned once those 3 models, we can load again our tree from'
+-print ' ----> our tree file and alignment file, and this time load directly oufiles from previous'
+-print ' with the function link_to_evol_model \n\n%s\n%s\n%s\n' % ('*'*10 + ' doc ' + '*'*10, \
+- T.link_to_evol_model.func_doc, \
+- '*'*30)
+-raw_input('runs\n ====> hit some key to see...')
++print('\n\n\n ----> Now we have runned once those 3 models, we can load again our tree from')
++print(' ----> our tree file and alignment file, and this time load directly oufiles from previous')
++print(' with the function link_to_evol_model \n\n%s\n%s\n%s\n' % ('*'*10 + ' doc ' + '*'*10, \
++ T.link_to_evol_model.__doc__, \
++ '*'*30))
++input('runs\n ====> hit some key to see...')
+ T = EvolTree(TREE_PATH)
+ T.link_to_alignment(ALG_PATH)
+ T.workdir = (WORKING_PATH)
+@@ -141,41 +141,41 @@ T.show(histfaces = ['M1', 'M2'])
+
+ ###
+ # mark tree functionality
+-print T.write(format=10)
++print(T.write(format=10))
+ name = None
+ while name not in T.get_leaf_names():
+- name = raw_input(' ====> As you need to mark some branches to run branch\n\
++ name = input(' ====> As you need to mark some branches to run branch\n\
+ models, type the name of one leaf: ')
+
+ idname = T.get_leaves_by_name(name)[0].node_id
+
+-print ' ----> you want to mark:',name,'that has this idname: ', idname
++print(' ----> you want to mark:',name,'that has this idname: ', idname)
+ T.mark_tree([idname]) # by default will mark with '#1'
+-print 'have a look to the mark: '
+-print re.sub('#','|',re.sub('[0-9a-zA-Z_(),;]',' ',T.write(format=10)))
+-print re.sub('#','v',re.sub('[0-9a-zA-Z_(),;]',' ',T.write(format=10)))
+-print T.write(format=10)
+-print '\n You have marked the tree with a command like: T.mark_tree([%d])\n' % (idname)
+-print '\n%s\n%s\n%s\n' % ('*'*10 + ' doc ' + '*'*10, T.mark_tree.func_doc, \
+- '*'*30)
++print('have a look to the mark: ')
++print(re.sub('#','|',re.sub('[0-9a-zA-Z_(),;]',' ',T.write(format=10))))
++print(re.sub('#','v',re.sub('[0-9a-zA-Z_(),;]',' ',T.write(format=10))))
++print(T.write(format=10))
++print('\n You have marked the tree with a command like: T.mark_tree([%d])\n' % (idname))
++print('\n%s\n%s\n%s\n' % ('*'*10 + ' doc ' + '*'*10, T.mark_tree.__doc__, \
++ '*'*30))
+
+-print '\n\n\n ----> We are now going to run branch-site models bsA and bsA1:\n\n'
+-raw_input(" ====> hit some key to start computation with our marked tree")
++print('\n\n\n ----> We are now going to run branch-site models bsA and bsA1:\n\n')
++input(" ====> hit some key to start computation with our marked tree")
+ for model in ['bsA','bsA1']:
+- print 'running model ' + model
++ print('running model ' + model)
+ T.run_model(model)
+
+
+-print '\n\n\n ----> again we use the get_most_likely function to compute the LRT between those models:\n'
+-raw_input(" ====> Hit some key to launch LRT")
++print('\n\n\n ----> again we use the get_most_likely function to compute the LRT between those models:\n')
++input(" ====> Hit some key to launch LRT")
+
+ pv = T.get_most_likely('bsA', 'bsA1')
+ if pv <= 0.05:
+- print ' ----> -> most likely model is model bsA, there is positive selection, pval: ',pv
+- print ' ' + name + ' is under positive selection.'
++ print(' ----> -> most likely model is model bsA, there is positive selection, pval: ',pv)
++ print(' ' + name + ' is under positive selection.')
+ else:
+- print ' ----> -> most likely model is model bsA1, pval of LRT: ',pv
+- print ' ' + name + ' is not under positive selection.'
++ print(' ----> -> most likely model is model bsA1, pval of LRT: ',pv)
++ print(' ' + name + ' is not under positive selection.')
+
+
+ sys.stderr.write('\n\nThe End.\n\n')
+--- a/examples/evol/test_protamine.py
++++ b/examples/evol/test_protamine.py
+@@ -30,15 +30,15 @@ def main():
+ tree.link_to_evol_model (WRKDIR + 'paml/M7/M7.out', 'M7')
+ tree.link_to_evol_model (WRKDIR + 'paml/M8/M8.out', 'M8')
+ tree.link_to_alignment (WRKDIR + 'alignments.fasta_ali')
+- print 'pv of LRT M2 vs M1: ',
+- print tree.get_most_likely ('M2','M1')
+- print 'pv of LRT M8 vs M7: ',
+- print tree.get_most_likely ('M8','M7')
++ print('pv of LRT M2 vs M1: \n')
++ print(tree.get_most_likely ('M2','M1'))
++ print('pv of LRT M8 vs M7: \n')
++ print(tree.get_most_likely ('M8','M7'))
+
+
+ tree.show (histfaces=['M2'])
+
+- print 'The End.'
++ print('The End.')
+
+
+ def random_swap(tree):
+@@ -49,9 +49,9 @@ def random_swap(tree):
+ def check_annotation (tree):
+ for node in tree.iter_descendants():
+ if not hasattr (node, 'paml_id'):
+- print 'Error, unable to label with paml ids'
++ print('Error, unable to label with paml ids')
+ break
+- print 'Labelling ok!'
++ print('Labelling ok!')
+
+
+ if __name__ == "__main__":
+--- a/examples/general/add_features.py
++++ b/examples/general/add_features.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")
+ # the search_nodes method (I take only the first match )
+@@ -26,8 +26,8 @@ for leaf in t.traverse():
+ else:
+ leaf.add_features(vowel=False, confidence=random.random())
+ # Now we use these information to analyze the tree.
+-print "This tree has", len(t.search_nodes(vowel=True)), "vowel nodes"
+-print "Which are", [leaf.name for leaf in t.iter_leaves() if leaf.vowel==True]
++print("This tree has", len(t.search_nodes(vowel=True)), "vowel nodes")
++print("Which are", [leaf.name for leaf in t.iter_leaves() if leaf.vowel==True])
+ # But features may refer to any kind of data, not only simple
+ # values. For example, we can calculate some values and store them
+ # within nodes.
+@@ -38,10 +38,10 @@ matches = [leaf for leaf in ancestor.tra
+ # And save this pre-computed information into the ancestor node
+ ancestor.add_feature("long_branch_nodes", matches)
+ # Prints the precomputed nodes
+-print "These are nodes under ancestor with long branches", \
+- [n.name for n in ancestor.long_branch_nodes]
++print("These are nodes under ancestor with long branches", \
++ [n.name for n in ancestor.long_branch_nodes])
+ # We can also use the add_feature() method to dynamically add new features.
+-label = raw_input("custom label:")
+-value = raw_input("custom label value:")
++label = input("custom label:")
++value = input("custom label value:")
+ ancestor.add_feature(label, value)
+-print "Ancestor has now the [", label, "] attribute with value [", value, "]"
++print("Ancestor has now the [", label, "] attribute with value [", value, "]")
+--- a/examples/general/byoperand_search.py
++++ b/examples/general/byoperand_search.py
+@@ -8,14 +8,14 @@ path = []
+ while node.up:
+ path.append(node)
+ node = node.up
+-print t
++print(t)
+ # I substract D node from the total number of visited nodes
+-print "There are", len(path)-1, "nodes between D and the root"
++print("There are", len(path)-1, "nodes between D and the root")
+ # Using parentheses you can use by-operand search syntax as a node
+ # instance itself
+ Dsparent= (t&"C").up
+ Bsparent= (t&"B").up
+ Jsparent= (t&"J").up
+ # I check if nodes belong to certain partitions
+-print "It is", Dsparent in Bsparent, "that C's parent is under B's ancestor"
+-print "It is", Dsparent in Jsparent, "that C's parent is under J's ancestor"
++print("It is", Dsparent in Bsparent, "that C's parent is under B's ancestor")
++print("It is", Dsparent in Jsparent, "that C's parent is under J's ancestor")
+--- a/examples/general/copy_and_paste_trees.py
++++ b/examples/general/copy_and_paste_trees.py
+@@ -3,13 +3,13 @@ from ete3 import Tree
+ t1 = Tree('(A,(B,C));')
+ t2 = Tree('((D,E), (F,G));')
+ t3 = Tree('(H, ((I,J), (K,L)));')
+-print "Tree1:", t1
++print("Tree1:", t1)
+ # /-A
+ # ---------|
+ # | /-B
+ # \--------|
+ # \-C
+-print "Tree2:", t2
++print("Tree2:", t2)
+ # /-D
+ # /--------|
+ # | \-E
+@@ -17,7 +17,7 @@ print "Tree2:", t2
+ # | /-F
+ # \--------|
+ # \-G
+-print "Tree3:", t3
++print("Tree3:", t3)
+ # /-H
+ # |
+ # ---------| /-I
+@@ -32,7 +32,7 @@ A = t1.search_nodes(name='A')[0]
+ # and adds the two other trees as children.
+ A.add_child(t2)
+ A.add_child(t3)
+-print "Resulting concatenated tree:", t1
++print("Resulting concatenated tree:", t1)
+ # /-D
+ # /--------|
+ # | \-E
+--- a/examples/general/create_trees_from_scratch.py
++++ b/examples/general/create_trees_from_scratch.py
+@@ -15,7 +15,7 @@ R = A.add_child(name="R") # Adds a third
+ # randomly.
+ R.populate(6, names_library=["r1","r2","r3","r4","r5","r6"])
+ # Prints the tree topology
+-print t
++print(t)
+ # /-C
+ # |
+ # |--D
+--- a/examples/general/custom_search.py
++++ b/examples/general/custom_search.py
+@@ -10,9 +10,9 @@ def conditional_function(node):
+ # method in the filter function. This will iterate over all nodes to
+ # assess if they meet our custom conditions and will return a list of
+ # matches.
+-matches = filter(conditional_function, t.traverse())
+-print len(matches), "nodes have distance >0.3"
++matches = list(filter(conditional_function, t.traverse()))
++print(len(matches), "nodes have distance >0.3")
+ # depending on the complexity of your conditions you can do the same
+ # in just one line with the help of lambda functions:
+-matches = filter(lambda n: n.dist>0.3 and n.is_leaf(), t.traverse() )
+-print len(matches), "nodes have distance >0.3 and are leaves"
++matches = [n for n in t.traverse() if n.dist>0.3 and n.is_leaf()]
++print(len(matches), "nodes have distance >0.3 and are leaves")
+--- a/examples/general/custom_tree_traversing.py
++++ b/examples/general/custom_tree_traversing.py
+@@ -3,7 +3,7 @@ t = Tree( '(A:1,(B:1,(C:1,D:1):0.5):0.5)
+ # Browse the tree from a specific leaf to the root
+ node = t.search_nodes(name="C")[0]
+ while node:
+- print node
++ print(node)
+ node = node.up
+ # --C
+ # /-C
+--- a/examples/general/get_common_ancestor.py
++++ b/examples/general/get_common_ancestor.py
+@@ -1,8 +1,8 @@
+ from ete3 import Tree
+ #Loads a tree
+ tree = Tree( '((H:1,I:1):0.5, A:1, (B:1,(C:1,D:1):0.5):0.5);' )
+-print "this is the original tree:"
+-print tree
++print("this is the original tree:")
++print(tree)
+ # /-H
+ # /--------|
+ # | \-I
+@@ -16,15 +16,15 @@ print tree
+ # \-D
+ # Finds the first common ancestor between B and C.
+ ancestor = tree.get_common_ancestor("D", "C")
+-print "The ancestor of C and D is:"
+-print ancestor
++print("The ancestor of C and D is:")
++print(ancestor)
+ # /-C
+ #---------|
+ # \-D
+ # You can use more than two nodes in the search
+ ancestor = tree.get_common_ancestor("B", "C", "D")
+-print "The ancestor of B, C and D is:"
+-print ancestor
++print("The ancestor of B, C and D is:")
++print(ancestor)
+ # /-B
+ #---------|
+ # | /-C
+@@ -33,9 +33,9 @@ print ancestor
+ # Finds the first sister branch of the ancestor node. Because
+ # multifurcations are allowed, many sister branches are possible.
+ sisters = ancestor.get_sisters()
+-print "which has has", len(sisters), "sister nodes"
+-print "and the first of such sister nodes like this:"
+-print sisters[0]
++print("which has has", len(sisters), "sister nodes")
++print("and the first of such sister nodes like this:")
++print(sisters[0])
+ #
+ # /-H
+ #---------|
+--- a/examples/general/get_distances_between_nodes.py
++++ b/examples/general/get_distances_between_nodes.py
+@@ -7,7 +7,7 @@ nw = """(((A:0.1, B:0.01):0.001, C:0.000
+ (((((D:0.00001,I:0):0,F:0):0,G:0):0,H:0):0,
+ E:0.000001):0.0000001):2.0;"""
+ t = Tree(nw)
+-print t
++print(t)
+ # /-A
+ # /--------|
+ # /--------| \-B
+@@ -30,24 +30,24 @@ print t
+ A = t&"A"
+ C = t&"C"
+ # Calculate distance from current node
+-print "The distance between A and C is", A.get_distance("C")
++print("The distance between A and C is", A.get_distance("C"))
+ # Calculate distance between two descendants of current node
+-print "The distance between A and C is", t.get_distance("A","C")
++print("The distance between A and C is", t.get_distance("A","C"))
+ # Calculate the toplogical distance (number of nodes in between)
+-print "The number of nodes between A and D is ", \
+- t.get_distance("A","D", topology_only=True)
++print("The number of nodes between A and D is ", \
++ t.get_distance("A","D", topology_only=True))
+ # Calculate the farthest node from E within the whole structure
+ farthest, dist = (t&"E").get_farthest_node()
+-print "The farthest node from E is", farthest.name, "with dist=", dist
++print("The farthest node from E is", farthest.name, "with dist=", dist)
+ # Calculate the farthest node from E within the whole structure,
+ # regarding the number of nodes in between as distance value
+ # Note that the result is differnt.
+ farthest, dist = (t&"E").get_farthest_node(topology_only=True)
+-print "The farthest (topologically) node from E is", \
+- farthest.name, "with", dist, "nodes in between"
++print("The farthest (topologically) node from E is", \
++ farthest.name, "with", dist, "nodes in between")
+ # Calculate farthest node from an internal node
+ farthest, dist = t.get_farthest_node()
+-print "The farthest node from root is", farthest.name, "with dist=", dist
++print("The farthest node from root is", farthest.name, "with dist=", dist)
+ #
+ # The program results in the following information:
+ #
+--- a/examples/general/get_midpoint_outgroup.py
++++ b/examples/general/get_midpoint_outgroup.py
+@@ -2,7 +2,7 @@ from ete3 import Tree
+ # generates a random tree
+ t = Tree();
+ t.populate(15);
+-print t
++print(t)
+ #
+ #
+ # /-qogjl
+@@ -38,7 +38,7 @@ print t
+ R = t.get_midpoint_outgroup()
+ # and set it as tree outgroup
+ t.set_outgroup(R)
+-print t
++print(t)
+ # /-opben
+ # |
+ # /--------| /-xoryn
+--- a/examples/general/getting_leaves.py
++++ b/examples/general/getting_leaves.py
+@@ -1,7 +1,7 @@
+ from ete3 import Tree
+ # Loads a basic tree
+ t = Tree( '(A:0.2,(B:0.4,(C:1.1,D:0.45):0.5):0.1);' )
+-print t
++print(t)
+ # /-A
+ #---------|
+ # | /-B
+@@ -13,16 +13,16 @@ print t
+ nleaves = 0
+ for leaf in t.get_leaves():
+ nleaves += 1
+-print "This tree has", nleaves, "terminal nodes"
++print("This tree has", nleaves, "terminal nodes")
+ # But, like this is much simpler :)
+ nleaves = len(t)
+-print "This tree has", nleaves, "terminal nodes [proper way: len(tree) ]"
++print("This tree has", nleaves, "terminal nodes [proper way: len(tree) ]")
+ # Counts leaves within the tree
+ ninternal = 0
+ for node in t.get_descendants():
+ if not node.is_leaf():
+ ninternal +=1
+-print "This tree has", ninternal, "internal nodes"
++print("This tree has", ninternal, "internal nodes")
+ # Counts nodes with whose distance is higher than 0.3
+ nnodes = 0
+ for node in t.get_descendants():
+@@ -30,4 +30,4 @@ for node in t.get_descendants():
+ nnodes +=1
+ # or, translated into a better pythonic
+ nnodes = len([n for n in t.get_descendants() if n.dist>0.3])
+-print "This tree has", nnodes, "nodes with a branch length > 0.3"
++print("This tree has", nnodes, "nodes with a branch length > 0.3")
+--- a/examples/general/iterators.py
++++ b/examples/general/iterators.py
+@@ -7,16 +7,16 @@ tree.populate(10000)
+ t1 = time.time()
+ for leaf in tree.iter_leaves():
+ if "aw" in leaf.name:
+- print "found a match:", leaf.name,
++ print("found a match:", leaf.name, '\n')
+ break
+-print "Iterating: ellapsed time:", time.time()-t1
++print("Iterating: ellapsed time:", time.time()-t1)
+ # This slower
+ t1 = time.time()
+ for leaf in tree.get_leaves():
+ if "aw" in leaf.name:
+- print "found a match:", leaf.name,
++ print("found a match:", leaf.name, '\n')
+ break
+-print "Getting: ellapsed time:", time.time()-t1
++print("Getting: ellapsed time:", time.time()-t1)
+ # Results in something like:
+ # found a match: guoaw Iterating: ellapsed time: 0.00436091423035 secs
+ # found a match: guoaw Getting: ellapsed time: 0.124316930771 secs
+--- a/examples/general/label_nodes.py
++++ b/examples/general/label_nodes.py
+@@ -1,16 +1,16 @@
+ from ete3 import Tree
+ tree = Tree( '(A:1,(B:1,(C:1,D:1):0.5):0.5);' )
+ # Prints the name of every leaf under the tree root
+-print "Leaf names:"
++print("Leaf names:")
+ for leaf in tree.get_leaves():
+- print leaf.name
++ print(leaf.name)
+ # Label nodes as terminal or internal. If internal, saves also the
+ # number of leaves that it contains.
+-print "Labeled tree:"
++print("Labeled tree:")
+ for node in tree.get_descendants():
+ if node.is_leaf():
+ node.add_features(ntype="terminal")
+ else:
+ node.add_features(ntype="internal", size=len(node))
+ # Gets the extended newick of the tree including new node features
+-print tree.write(features=[])
++print(tree.write(features=[]))
+--- 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)
+--- a/examples/general/prune_tree.py
++++ b/examples/general/prune_tree.py
+@@ -1,8 +1,8 @@
+ from ete3 import Tree
+ # Let's create simple tree
+ t = Tree('((((H,K),(F,I)G),E),((L,(N,Q)O),(P,S)));', format=1)
+-print "Original tree looks like this:"
+-print t
++print("Original tree looks like this:")
++print(t)
+ #
+ # /-H
+ # /--------|
+@@ -25,8 +25,8 @@ print t
+ # \-S
+ # Prune the tree in order to keep only some leaf nodes.
+ t.prune(["H","F","E","Q", "P"])
+-print "Pruned tree"
+-print t
++print("Pruned tree")
++print(t)
+ #
+ # /-F
+ # /--------|
+--- a/examples/general/remove_and_delete_nodes.py
++++ b/examples/general/remove_and_delete_nodes.py
+@@ -1,11 +1,11 @@
+ from ete3 import Tree
+ # Loads a tree. Note that we use format 1 to read internal node names
+ t = Tree('((((H,K)D,(F,I)G)B,E)A,((L,(N,Q)O)J,(P,S)M)C);', format=1)
+-print "original tree looks like this:"
++print("original tree looks like this:")
+ # This is an alternative way of using "print t". Thus we have a bit
+ # more of control on how tree is printed. Here i print the tree
+ # showing internal node names
+-print t.get_ascii(show_internal=True)
++print(t.get_ascii(show_internal=True))
+ #
+ # /-H
+ # /D-------|
+@@ -37,8 +37,8 @@ C = t.search_nodes(name="C")[0]
+ removed_node = J.detach() # = C.remove_child(J)
+ # if we know print the original tree, we will see how J partition is
+ # no longer there.
+-print "Tree after REMOVING the node J"
+-print t.get_ascii(show_internal=True)
++print("Tree after REMOVING the node J")
++print(t.get_ascii(show_internal=True))
+ # /-H
+ # /D-------|
+ # | \-K
+@@ -56,8 +56,8 @@ print t.get_ascii(show_internal=True)
+ # tree, and all its descendants will then hang from the next upper
+ # node.
+ G.delete()
+-print "Tree after DELETING the node G"
+-print t.get_ascii(show_internal=True)
++print("Tree after DELETING the node G")
++print(t.get_ascii(show_internal=True))
+ # /-H
+ # /D-------|
+ # | \-K
+--- a/examples/general/rooting_subtrees.py
++++ b/examples/general/rooting_subtrees.py
+@@ -1,7 +1,7 @@
+ from ete3 import Tree
+ t = Tree('(((A,C),((H,F),(L,M))),((B,(J,K)),(E,D)));')
+-print "Original tree:"
+-print t
++print("Original tree:")
++print(t)
+ # /-A
+ # /--------|
+ # | \-C
+@@ -29,8 +29,8 @@ node1 = t.get_common_ancestor("A","H")
+ node2 = t.get_common_ancestor("B","D")
+ node1.set_outgroup("H")
+ node2.set_outgroup("E")
+-print "Tree after rooting each node independently:"
+-print t
++print("Tree after rooting each node independently:")
++print(t)
+ #
+ # /-F
+ # |
+--- a/examples/general/rooting_trees.py
++++ b/examples/general/rooting_trees.py
+@@ -3,8 +3,8 @@ from ete3 import Tree
+ # node. This usually means that no information is available about
+ # which of nodes is more basal.
+ t = Tree('(A,(H,F),(B,(E,D)));')
+-print "Unrooted tree"
+-print t
++print("Unrooted tree")
++print(t)
+ # /-A
+ # |
+ # | /-H
+@@ -21,8 +21,8 @@ print t
+ # course, the definition of an outgroup will depend on user criteria.
+ ancestor = t.get_common_ancestor("E","D")
+ t.set_outgroup(ancestor)
+-print "Tree rooteda at E and D's ancestor is more basal that the others."
+-print t
++print("Tree rooteda at E and D's ancestor is more basal that the others.")
++print(t)
+ #
+ # /-B
+ # /--------|
+@@ -39,8 +39,8 @@ print t
+ # Note that setting a different outgroup, a different interpretation
+ # of the tree is possible
+ t.set_outgroup( t&"A" )
+-print "Tree rooted at a terminal node"
+-print t
++print("Tree rooted at a terminal node")
++print(t)
+ # /-H
+ # /--------|
+ # | \-F
+--- a/examples/general/search_nodes.py
++++ b/examples/general/search_nodes.py
+@@ -1,7 +1,7 @@
+ from ete3 import Tree
+ #Loads a tree
+ t = Tree( '((H:1,I:1):0.5, A:1, (B:1,(C:1,D:1):0.5):0.5);' )
+-print t
++print(t)
+ # /-H
+ # /--------|
+ # | \-I
+@@ -17,4 +17,4 @@ print t
+ D = t.search_nodes(name="D")
+ # I get all nodes with distance=0.5
+ nodes = t.search_nodes(dist=0.5)
+-print len(nodes), "nodes have distance=0.5"
++print(len(nodes), "nodes have distance=0.5")
+--- a/examples/general/tree_basis.py
++++ b/examples/general/tree_basis.py
+@@ -6,16 +6,16 @@ A = t.add_child(name="A")
+ B = t.add_child(name="B")
+ C = A.add_child(name="C")
+ D = A.add_child(name="D")
+-print t
++print(t)
+ # /-C
+ # /--------|
+ #---------| \-D
+ # |
+ # \-B
+-print 'is "t" the root?', t.is_root() # True
+-print 'is "A" a terminal node?', A.is_leaf() # False
+-print 'is "B" a terminal node?', B.is_leaf() # True
+-print 'B.get_tree_root() is "t"?', B.get_tree_root() is t # True
+-print 'Number of leaves in tree:', len(t) # returns number of leaves under node (3)
+-print 'is C in tree?', C in t # Returns true
+-print "All leaf names in tree:", [node.name for node in t]
++print('is "t" the root?', t.is_root()) # True
++print('is "A" a terminal node?', A.is_leaf()) # False
++print('is "B" a terminal node?', B.is_leaf()) # True
++print('B.get_tree_root() is "t"?', B.get_tree_root() is t) # True
++print('Number of leaves in tree:', len(t)) # returns number of leaves under node (3)
++print('is C in tree?', C in t) # Returns true
++print("All leaf names in tree:", [node.name for node in t])
+--- a/examples/general/tree_traverse.py
++++ b/examples/general/tree_traverse.py
+@@ -2,7 +2,7 @@ from ete3 import Tree
+ t = Tree( '(A:1,(B:1,(C:1,D:1):0.5):0.5);' )
+ # Visit nodes in preorder (this is the default strategy)
+ for n in t.traverse():
+- print n
++ print(n)
+ # It Will visit the nodes in the following order:
+ # /-A
+ # ---------|
+@@ -25,7 +25,7 @@ for n in t.traverse():
+ # --D
+ # Visit nodes in postorder
+ for n in t.traverse("postorder"):
+- print n
++ print(n)
+ # It Will visit the nodes in the following order:
+ # --A
+ # --B
+--- a/examples/general/write_newick.py
++++ b/examples/general/write_newick.py
+@@ -3,6 +3,6 @@ from ete3 import Tree
+ t = Tree('(A:1,(B:1,(E:1,D:1)Internal_1:0.5)Internal_2:0.5)Root;', format=1)
+ # And prints its newick representation omiting all the information but
+ # the tree topology
+-print t.write(format=100) # (,(,(,)));
++print(t.write(format=100)) # (,(,(,)));
+ # We can also write into a file
+ t.write(format=100, outfile="/tmp/tree.new")
+--- a/examples/nexml/nexml_annotated_trees.py
++++ b/examples/nexml/nexml_annotated_trees.py
+@@ -13,12 +13,12 @@ trees = tree_collection.tree
+ # For each loaded tree, prints its structure and some of its
+ # meta-properties
+ for t in trees:
+- print t
+- print
+- print "Leaf node meta information:\n"
+- print
++ print(t)
++ print()
++ print("Leaf node meta information:\n")
++ print()
+ for meta in t.children[0].nexml_node.meta:
+- print meta.property, ":", (meta.content)
++ print(meta.property, ":", (meta.content))
+
+
+ # Output
+--- a/examples/nexml/nexml_parser.py
++++ b/examples/nexml/nexml_parser.py
+@@ -7,10 +7,10 @@ nexml_project.build_from_file("trees.xml
+
+ # All XML elements are within the project instance.
+ # exist in each element to access their attributes.
+-print "Loaded Taxa:"
++print("Loaded Taxa:")
+ for taxa in nexml_project.get_otus():
+ for otu in taxa.get_otu():
+- print "OTU:", otu.id
++ print("OTU:", otu.id)
+
+ # Extracts all the collection of trees in the project
+ tree_collections = nexml_project.get_trees()
+@@ -21,10 +21,10 @@ collection_1 = tree_collections[0]
+ for tree in collection_1.get_tree():
+ # trees contain all the nexml information in their "nexml_node",
+ # "nexml_tree", and "nexml_edge" attributes.
+- print "Tree id", tree.nexml_tree.id
+- print tree
++ print("Tree id", tree.nexml_tree.id)
++ print(tree)
+ for node in tree.traverse():
+- print "node", node.nexml_node.id, "is associated with", node.nexml_node.otu, "OTU"
++ print("node", node.nexml_node.id, "is associated with", node.nexml_node.otu, "OTU")
+
+
+ # Output:
+--- a/examples/phylogenies/dating_evolutionary_events.py
++++ b/examples/phylogenies/dating_evolutionary_events.py
+@@ -8,8 +8,8 @@ nw = """
+ ,Mmu_001),((Hsa_004,Ptr_004),Mmu_004))),(Ptr_002,(Hsa_002,Mmu_002))));
+ """
+ t = PhyloTree(nw)
+-print "Original tree:",
+-print t
++print("Original tree:\n")
++print(t)
+ #
+ # /-Dme_001
+ # /--------|
+@@ -59,11 +59,11 @@ age2name = {
+ }
+ event1= t.get_common_ancestor("Hsa_001", "Hsa_004")
+ event2=t.get_common_ancestor("Hsa_001", "Hsa_002")
+-print
+-print "The duplication event leading to the human sequences Hsa_001 and "+\
+- "Hsa_004 is dated at: ", age2name[event1.get_age(species2age)]
+-print "The duplication event leading to the human sequences Hsa_001 and "+\
+- "Hsa_002 is dated at: ", age2name[event2.get_age(species2age)]
++print()
++print("The duplication event leading to the human sequences Hsa_001 and "+\
++ "Hsa_004 is dated at: ", age2name[event1.get_age(species2age)])
++print("The duplication event leading to the human sequences Hsa_001 and "+\
++ "Hsa_002 is dated at: ", age2name[event2.get_age(species2age)])
+ # The duplication event leading to the human sequences Hsa_001 and Hsa_004
+ # is dated at: primates
+ #
+--- 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"], for
+ #
+ # 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
+--- a/examples/phylogenies/orthology_and_paralogy_prediction.py
++++ b/examples/phylogenies/orthology_and_paralogy_prediction.py
+@@ -5,7 +5,7 @@ nw = """
+ (Ptr_002,(Hsa_002,Mmu_002))));
+ """
+ t = PhyloTree(nw)
+-print t
++print(t)
+ # /-Dme_001
+ # /--------|
+ # | \-Dme_002
+@@ -33,22 +33,22 @@ human_seq = matches[0]
+ # Obtains its evolutionary events
+ events = human_seq.get_my_evol_events()
+ # Print its orthology and paralogy relationships
+-print "Events detected that involve Hsa_001:"
++print("Events detected that involve Hsa_001:")
+ for ev in events:
+ if ev.etype == "S":
+- print ' ORTHOLOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs)
++ print(' ORTHOLOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs))
+ elif ev.etype == "D":
+- print ' PARALOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs)
++ print(' PARALOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs))
+
+ # Alternatively, you can scan the whole tree topology
+ events = t.get_descendant_evol_events()
+ # Print its orthology and paralogy relationships
+-print "Events detected from the root of the tree"
++print("Events detected from the root of the tree")
+ for ev in events:
+ if ev.etype == "S":
+- print ' ORTHOLOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs)
++ print(' ORTHOLOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs))
+ elif ev.etype == "D":
+- print ' PARALOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs)
++ print(' PARALOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs))
+
+ # If we are only interested in the orthology and paralogy relationship
+ # among a given set of species, we can filter the list of sequences
+@@ -56,16 +56,16 @@ for ev in events:
+ # fseqs is a function that, given a list of sequences, returns only
+ # those from human and mouse
+ fseqs = lambda slist: [s for s in slist if s.startswith("Hsa") or s.startswith("Mms")]
+-print "Paralogy relationships among human and mouse"
++print("Paralogy relationships among human and mouse")
+ for ev in events:
+ if ev.etype == "D":
+ # Prints paralogy relationships considering only human and
+ # mouse. Some duplication event may not involve such species,
+ # so they will be empty
+- print ' PARALOGY RELATIONSHIP:', \
++ print(' PARALOGY RELATIONSHIP:', \
+ ','.join(fseqs(ev.in_seqs)), \
+ "<====>",\
+- ','.join(fseqs(ev.out_seqs))
++ ','.join(fseqs(ev.out_seqs)))
+
+ # Note that besides the list of events returned, the detection
+ # algorithm has labeled the tree nodes according with the
+--- a/examples/phylogenies/species_aware_phylogenies.py
++++ b/examples/phylogenies/species_aware_phylogenies.py
+@@ -14,9 +14,9 @@ t = PhyloTree("(((Hsa_001,Ptr_001),(Cfa_
+ # \-Dme_002
+ #
+ # Prints current leaf names and species codes
+-print "Deafult mode:"
++print("Deafult mode:")
+ for n in t.get_leaves():
+- print "node:", n.name, "Species name:", n.species
++ print("node:", n.name, "Species name:", n.species)
+ # node: Dme_001 Species name: Dme
+ # node: Dme_002 Species name: Dme
+ # node: Hsa_001 Species name: Hsa
+@@ -42,9 +42,9 @@ def get_species_name(node_name_string):
+ return code2name[spcode]
+ # Now, let's ask the tree to use our custom species naming function
+ t.set_species_naming_function(get_species_name)
+-print "Custom mode:"
++print("Custom mode:")
+ for n in t.get_leaves():
+- print "node:", n.name, "Species name:", n.species
++ print("node:", n.name, "Species name:", n.species)
+ # node: Dme_001 Species name: Drosophila melanogaster
+ # node: Dme_002 Species name: Drosophila melanogaster
+ # node: Hsa_001 Species name: Homo sapiens
+@@ -63,9 +63,9 @@ mynewick = """
+ (Dme_001[&&NHX:species=Fly],Dme_002[&&NHX:species=Fly]));
+ """
+ t = PhyloTree(mynewick, sp_naming_function=None)
+-print "Disabled mode (manual set):"
++print("Disabled mode (manual set):")
+ for n in t.get_leaves():
+- print "node:", n.name, "Species name:", n.species
++ print("node:", n.name, "Species name:", n.species)
+ # node: Dme_001 Species name: Fly
+ # node: Dme_002 Species name: Fly
+ # node: Hsa_001 Species name: Human
+@@ -76,8 +76,8 @@ for n in t.get_leaves():
+ # Of course, once this info is available you can query any internal
+ # node for species covered.
+ human_mouse_ancestor = t.get_common_ancestor("Hsa_001", "Mms_001")
+-print "These are the species under the common ancestor of Human & Mouse"
+-print '\n'.join( human_mouse_ancestor.get_species() )
++print("These are the species under the common ancestor of Human & Mouse")
++print('\n'.join( human_mouse_ancestor.get_species() ))
+ # Mouse
+ # Chimp
+ # Dog
+--- a/examples/phylogenies/tree_reconciliation.py
++++ b/examples/phylogenies/tree_reconciliation.py
+@@ -7,7 +7,7 @@ gene_tree_nw = '((Dme_001,Dme_002),(((Cf
+ species_tree_nw = "((((Hsa, Ptr), Mmu), (Mms, Cfa)), Dme);"
+ genetree = PhyloTree(gene_tree_nw)
+ sptree = PhyloTree(species_tree_nw)
+-print genetree
++print(genetree)
+ # /-Dme_001
+ # /--------|
+ # | \-Dme_002
+@@ -32,14 +32,14 @@ print genetree
+ recon_tree, events = genetree.reconcile(sptree)
+ # a new "reconcilied tree" is returned. As well as the list of
+ # inferred events.
+-print "Orthology and Paralogy relationships:"
++print("Orthology and Paralogy relationships:")
+ for ev in events:
+ if ev.etype == "S":
+- print 'ORTHOLOGY RELATIONSHIP:', ','.join(ev.inparalogs), "<====>", ','.join(ev.orthologs)
++ print('ORTHOLOGY RELATIONSHIP:', ','.join(ev.inparalogs), "<====>", ','.join(ev.orthologs))
+ elif ev.etype == "D":
+- print 'PARALOGY RELATIONSHIP:', ','.join(ev.inparalogs), "<====>", ','.join(ev.outparalogs)
++ print('PARALOGY RELATIONSHIP:', ','.join(ev.inparalogs), "<====>", ','.join(ev.outparalogs))
+ # And we can explore the resulting reconciled tree
+-print recon_tree
++print(recon_tree)
+ # You will notice how the reconcilied tree is the same as the gene
+ # tree with some added branches. They are inferred gene losses.
+ #
+--- a/examples/phyloxml/phyloxml_from_scratch.py
++++ b/examples/phyloxml/phyloxml_from_scratch.py
+@@ -9,7 +9,7 @@ phylo.phyloxml_phylogeny.set_name("test_
+ # Add the tree to the phyloxml project
+ project.add_phylogeny(phylo)
+
+-print project.get_phylogeny()[0]
++print(project.get_phylogeny()[0])
+
+ # /-iajom
+ # /---|
+--- a/examples/phyloxml/phyloxml_parser.py
++++ b/examples/phyloxml/phyloxml_parser.py
+@@ -4,13 +4,13 @@ project.build_from_file("apaf.xml")
+
+ # Each tree contains the same methods as a PhyloTree object
+ for tree in project.get_phylogeny():
+- print tree
++ print(tree)
+ # you can even use rendering options
+ tree.show()
+ # PhyloXML features are stored in the phyloxml_clade attribute
+ for node in tree:
+- print "Node name:", node.name
++ print("Node name:", node.name)
+ for seq in node.phyloxml_clade.get_sequence():
+ for domain in seq.domain_architecture.get_domain():
+ domain_data = [domain.valueOf_, domain.get_from(), domain.get_to()]
+- print " Domain:", '\t'.join(map(str, domain_data))
++ print(" Domain:", '\t'.join(map(str, domain_data)))
+--- a/examples/treeview/barchart_and_piechart_faces.py
++++ b/examples/treeview/barchart_and_piechart_faces.py
+@@ -2,7 +2,7 @@ import sys
+ import random
+ from ete3 import Tree, faces, TreeStyle, COLOR_SCHEMES
+
+-schema_names = COLOR_SCHEMES.keys()
++schema_names = list(COLOR_SCHEMES.keys())
+
+ def layout(node):
+ if node.is_leaf():
+--- a/examples/treeview/floating_piecharts.py
++++ b/examples/treeview/floating_piecharts.py
+@@ -2,7 +2,7 @@ import sys
+ import random
+ from ete3 import Tree, faces, TreeStyle, COLOR_SCHEMES
+
+-schema_names = COLOR_SCHEMES.keys()
++schema_names = list(COLOR_SCHEMES.keys())
+
+ def layout(node):
+ if not node.is_leaf():
+--- a/examples/treeview/item_faces.py
++++ b/examples/treeview/item_faces.py
+@@ -48,8 +48,7 @@ def random_color(h=None):
+ return _hls2hex(h, l, s)
+
+ def _hls2hex(h, l, s):
+- return '#%02x%02x%02x' %tuple(map(lambda x: int(x*255),
+- colorsys.hls_to_rgb(h, l, s)))
++ return '#%02x%02x%02x' %tuple([int(x*255) for x in colorsys.hls_to_rgb(h, l, s)])
+
+ def ugly_name_face(node, *args, **kargs):
+ """ This is my item generator. It must receive a node object, and
+--- a/examples/treeview/new_seq_face.py
++++ b/examples/treeview/new_seq_face.py
+@@ -297,9 +297,9 @@ if __name__ == "__main__":
+
+ # Show very large algs
+ tree = PhyloTree('(Orangutan,Human,Chimp);')
+- tree.link_to_alignment(">Human\n" + ''.join([_aabgcolors.keys()[int(random() * len (_aabgcolors))] for _ in xrange (5000)]) + \
+- "\n>Chimp\n" + ''.join([_aabgcolors.keys()[int(random() * len (_aabgcolors))] for _ in xrange (5000)]) + \
+- "\n>Orangutan\n" + ''.join([_aabgcolors.keys()[int(random() * len (_aabgcolors))] for _ in xrange (5000)]))
++ tree.link_to_alignment(">Human\n" + ''.join([list(_aabgcolors.keys())[int(random() * len (_aabgcolors))] for _ in range (5000)]) + \
++ "\n>Chimp\n" + ''.join([list(_aabgcolors.keys())[int(random() * len (_aabgcolors))] for _ in range (5000)]) + \
++ "\n>Orangutan\n" + ''.join([list(_aabgcolors.keys())[int(random() * len (_aabgcolors))] for _ in range (5000)]))
+ tree.dist = 0
+ ts = TreeStyle()
+ ts.title.add_face(TextFace("better not set interactivity if alg is very large", fsize=15), column=0)
+--- a/examples/treeview/random_draw.py
++++ b/examples/treeview/random_draw.py
+@@ -28,7 +28,7 @@ def leaf_name(node):
+
+ def aligned_faces(node):
+ if node.is_leaf():
+- for i in xrange(3):
++ for i in range(3):
+ F = faces.TextFace("ABCDEFGHIJK"[0:random.randint(1,11)])
+ F.border.width = 1
+ F.border.line_style = 1
=====================================
debian/rules
=====================================
@@ -1,9 +1,20 @@
#! /usr/bin/make -f
export PYBUILD_NAME=ete3
-#export PYBUILD_DISABLE_python3=test
-#export PYBUILD_DISABLE_python2=1
+
+#export PYBUILD_TEST_ARGS_python2=-k-XTest_ncbiquery
+#export PYBUILD_TEST_ARGS_python3=-k-XTest_ncbiquery
%:
dh $@ --with python2,python3 --buildsystem=pybuild
+override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+ # Exclude tests requiring online access (no idea how to exclude these more elegantly
+ find .pybuild -name test_ncbiquery.py -delete
+ find .pybuild/*2.7*/ -name test_interop.py -delete
+ sed -i '/test_interop import/d' `find .pybuild/*2.7*/ -name test_api.py`
+ # link to examples
+ find .pybuild -name build -type d -exec ln -s $(CURDIR)/examples \{\} \;
+ dh_auto_test || true
+endif
View it on GitLab: https://salsa.debian.org/med-team/python-ete3/compare/76907e4c52b060b8a7f49eea660bbbe0253dbead...8e72137e8a56d716a48c5b6a3658973dcedd0542
--
View it on GitLab: https://salsa.debian.org/med-team/python-ete3/compare/76907e4c52b060b8a7f49eea660bbbe0253dbead...8e72137e8a56d716a48c5b6a3658973dcedd0542
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20181029/4f74a63c/attachment-0001.html>
More information about the debian-med-commit
mailing list