get_consensus_tree()function is not very sophisticated yet. It only calculates a consensus of topologies and stores bootstrap support values, but it does not summarize branch lengths across trees. And so it just sets all of the branch lengths to 1 on the consensus tree. To get a consensus tree with mean branch lengths you may need to use some other software for now. I might recommend
import toyplot.pdf plot1 = fw85m4.plot(height=850, width=700, pct_tree_y=0.0005, pct_tree_x=0.5, alpha=4.0); plot1 (<toyplot.canvas.Canvas at 0x7f6bbe911bd0>, <toyplot.coordinates.Cartesian at 0x7f6bbe911ed0>, <ipyrad.plotting.baba_panel_plot.Panel at 0x7f6bbf0dcd90>) toyplot.pdf.render(plot1, "plot1.pdf") ValueError Traceback (most recent call last) <ipython-input-61-e11dc1c612b1> in <module>() ----> 1 toyplot.pdf.render(plot1, "plot1.pdf") /home/nathan/miniconda2/lib/python2.7/site-packages/toyplot/pdf.pyc in render(canvas, fobj, width, height, scale) 55 :func:`toyplot.reportlab.pdf.render()`. 56 """ ---> 57 canvas = toyplot.require.instance(canvas, toyplot.canvas.Canvas) 58 return implementation.render(canvas, fobj, width, height, scale) /home/nathan/miniconda2/lib/python2.7/site-packages/toyplot/require.pyc in instance(value, types) 100 """Verify the type of a value.""" 101 if not isinstance(value, types): --> 102 raise ValueError("Expected %s, received %s." % (types, type(value))) # pragma: no cover 103 return value 104 ValueError: Expected <class 'toyplot.canvas.Canvas'>, received <type 'tuple'>.
plot()function returns three objects, as you can see when you called the
plot1variable. The three objects are returned together as a
tupleobject, which is just a type of container. When you use the
toyplot.pdf.renderfunction you'll want to pass it just the first object in your tuple, which is the
toyplot.Canvasobject. Let me know if that works.
## example plot1 = bb.plot(...) toyplot.render.pdf(plot1, "plot1.pdf")
tree = toytree.rtree(6) ## set node labels to "" if you want to disappear nls = ["" if node not in tree.get_tip_labels() else node for node in tree.get_node_dict().values()] ## set color based on tip name ncs = [tree.colors if node in "t-1" else tree.colors for node in tree.get_node_dict().values()] ## draw tree tree.draw( use_edge_lengths=False, node_labels=nls, node_color=ncs, tip_labels=False, );
## make list of node colors (reversed b/c in order from bottom to top) cols= [tree.colors if tipname == "t-1" else tree.colors for tipname in tree.get_tip_labels()][::-1] ## draw tree and return canvas and cartesian axes c, a = tree.draw(use_edge_lengths=False) a.scatterplot(a=*6, b=range(6), size=12, color=cols);
@eaton-lab Hi I am having troubles with the generate_tests_from_tree
rtre.draw(); outputs a tree but
bb = ipa.baba(data=locifile, newick=rtre) followed by
/home/dumortier/miniconda2/lib/python2.7/site-packages/ipyrad/analysis/baba.pyc in __init__(self, data, tests, newick, nboots, mincov) 85 86 if isinstance(newick, toytree.tree): ---> 87 self.newick = newick.tree.write() 88 else: 89 self.newick = newick AttributeError: Toytree instance has no attribute 'tree'
with ipyrad 0.7.19 but the error is similar with 0.7.28 (AttributeError: Toytree instance has no attribute 'tree' with more verbose).
Any idea what could be the problem?
PS: I know the generate_tests_from_tree is within ipyrad so sorry if this is not the place...
0.1.6. I hope to have both running compatible versions within about 2 weeks.
@eaton-lab Thanks for the quick reply!
I tried to downgrade but I got an other error
NameError Traceback (most recent call last) <ipython-input-4-490fab463969> in <module>() 33 tre = toytree.tree(newick=newick) 34 myWildcardRoot = "Cal_1525" ---> 35 rtre=tre.root(wildcard=myWildcardRoot) 36 nwk=rtre.draw(); /home/dumortier/miniconda2/lib/python2.7/site-packages/toytree-0.1.6-py2.7.egg/toytree/tree.py in root(self, outgroup, wildcard, regex) 422 423 ## split root node if more than di- as this is the unrooted state --> 424 if not nself.is_bifurcating(): 425 nself.tree.resolve_polytomy() 426 /home/dumortier/miniconda2/lib/python2.7/site-packages/toytree-0.1.6-py2.7.egg/toytree/tree.py in is_bifurcating(self, include_root) 301 ctn2 = -2 + (2 * len(self)) 302 if self.is_rooted(): --> 303 if ctn == sum(1 for i in self.tree.traverse()): 304 return True 305 else: NameError: global name 'ctn' is not defined
ipyrad version: 0.7.28
toyplot version: 0.17.0
toytree version: 0.1.6
CPUs used: 20
What versions should I use?
.ladderize(direction=1)should do the trick; however, when I use it I get an unexpected keyword argument for 'direction'. Any suggestions? Thanks in advance for your help!
# ladderize treenode (ete) object tre.treenode.ladderize(direction=1) # update toytree drawing coordinates for new treenode tre._coords.update()
rxtremin50 = rxtre.collapse_nodes(min_support=50), but it is not working. I have also been trying to get ver. 0.1.22 to inport, but instead I am getting Toytree ver. 0.1.21, even though I have tried to uninstall the older version. In addition, when I look through my installed packages, the new version (0.1.22) is listed, but not the older version
.__requires__ = ["Toytree==0.1.22"] import pkg_resources import toytree pkg_resources.get_distribution("Toytree").version
we are having troubles with running tetrad. First it told us to install toytree which we did but to my surprise this had some dramatic impact on the rest of the conda environment (i.e. ipyrad-0.6.18-0):
conda install toytree -c eaton-lab Collecting package metadata: done Solving environment: done ## Package Plan ## environment location: /home/ghanavati/miniconda2 added / updated specs: - toytree The following packages will be UPDATED: cryptography 2.3.1-py27hc365091_0 --> 2.6.1-py27h1ba5d50_0 curl 7.61.0-h84994c4_0 --> 7.64.1-hbc83047_0 krb5 1.16.1-hc83ff2d_6 --> 1.16.1-h173b8e3_7 libcurl 7.61.0-h1ad7b7a_0 --> 7.64.1-h20c2e04_0 libssh2 1.8.0-h9cfc8f7_4 --> 1.8.2-h1ba5d50_0 openssl 1.0.2r-h7b6447c_0 --> 1.1.1b-h7b6447c_1 python 2.7.15-h77bded6_2 --> 2.7.16-h9bab390_0 qt 5.9.6-h8703b6f_2 --> 5.9.7-h5867ecd_1 The following packages will be SUPERSEDED by a higher-priority channel: ipyrad ipyrad::ipyrad-0.7.30-py27_7 --> eaton-lab::ipyrad-0.6.18-0 pysam ipyrad::pysam-0.10.0-py27_3 --> pkgs/free::pysam-0.6-py27_0
And yet, tetrad is still asking for toytree to be installed!
What to do?