In [1]:
import toytree
We learned in notebook 3.2 that the file format to store phylogenetic trees is simply a text file containing a string of names within nested parentheses. When researchers publish phylogenetic results these are the types of tree files that they produce and publish. The files are sometimes saved as something like "treefile.newick" or "trees.nwk" or "birds.tree", etc. There are databases online where such files are saved including those that are specialized for tree data (like TreeBase) or general data repositories like Data Dryad.
In [16]:
newick = "((a,b),(c, d));"
In [42]:
tre = toytree.tree(newick)
In [43]:
tre.draw();
In [44]:
URL = "https://treebase.org/treebase-web/search/downloadATree.html?id=11298&treeid=31264"
In [45]:
tre = toytree.tree(URL)
In [47]:
tre.draw(tip_labels_align=True, height=800, width=600);
The file above that we accessed from treebase is actually a slightly different format called NEXUS. This is simply a file that contains within it a newick tree structure as well as sometimes additional information such as the sequence data that was used to infer the tree. Toytree will parse this file format the same as newick, and simply discard the extra information.
In [ ]: