Getting a simple tree via NCBI

[This article was first published on Recology - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I was just at the Phylotastic hackathon in Tucson, AZ at the iPlant facilities at the UofA.

A problem that needs to be solved is getting the incrasingly vast phylogenetic information to folks not comfortable building their own phylogenies. Phylomatic has made this super easy for people that want plant phylogenies (at least 250 or so papers have used and cited Phylomatic in their papers) – however, there are few options for those that want phylogenies for other taxonomic groups.

One cool tool that was brought up was the Common Tree service provided by NCBI. Here’s some help on the service. Unlike Phylomatic, Common Tree is purely based off of taxonomic relationships (A and B are both in the C family, so are sisters), not an actual phylogeny as Phylomatic is based on.

But how do you use Common Tree?


Get a species list

Grab the taxon list from my github account here

Go to the site

Go to the Common Tree site here

Choose file

Hit the “choose file” button, then select the species.txt file you downloaded in the first step.

Add the species list to make the tree

Then hit “add from file”, and you got a “tree”

image

Download

You can download the tree in a variety of formats, including a .phy file

image

Plot the tree on your machine

Make a tree, in R for me

<span class="c1"># install.packages('ape') # install if you don't have ape</span>
library<span class="p">(</span>ape<span class="p">)</span>

<span class="c1"># Read the tree in. YOu get the tree back with alot of newlines (\n) -</span>
<span class="c1"># can easily take these out with a good text editor.</span>
tree <span class="o"><-</span> read.tree<span class="p">(</span>text <span class="o">=</span> <span class="s">"(Lampetra:4,((((((Umbra:4,((Lota:4,Microgadus:4)Gadiformes:4,((Culaea:4,Apeltes:4,Pungitius:4,Gasterosteus:4)Gasterosteidae:4,(Morone:4,(Ambloplites:4,Micropterus:4,Lepomis:4)Centrarchidae:4,(Sander:4,Perca:4)Percidae:4)Percoidei:4,Cottus:4)Percomorpha:4)Holacanthopterygii:4)Neognathi:4,(((Prosopium:4,Coregonus:4)Coregoninae:4,(Salvelinus:4,Salmo:4,Oncorhynchus:4)Salmoninae:4)Salmonidae:4,Osmerus:4)Protacanthopterygii:4)Euteleostei:4,(Alosa:4,(Ameiurus:4,(Catostomus:4,(Semotilus:4,Rhinichthys:4,Margariscus:4,Couesius:4,Pimephales:4,Luxilus:4,Notemigonus:4,Notropis:4,Carassius:4)Cyprinidae:4)Cypriniformes:4)Otophysi:4)Otocephala:4)Clupeocephala:4,Anguilla:4)Elopocephala:4,Acipenser:4)Actinopteri:4,Scyliorhinus:4)Gnathostomata:4)Vertebrata:4;"</span><span class="p">)</span>

<span class="c1"># stretch the branches so tips line up</span>
tree2 <span class="o"><-</span> compute.brlen<span class="p">(</span>tree<span class="p">,</span> method <span class="o">=</span> <span class="s">"Grafen"</span><span class="p">)</span>

<span class="c1"># Plot the tree</span>
plot<span class="p">(</span>tree2<span class="p">,</span> no.margin <span class="o">=</span> <span class="kc">TRUE</span><span class="p">,</span> cex <span class="o">=</span> <span class="m">0.7</span><span class="p">)</span>

w00p, there it is…

image4


And the answer is NO to the question: Is there an API for Common Tree?


Get the .Rmd file used to create this post at my github account – or .md file.

Written in Markdown, with help from knitr.

To leave a comment for the author, please follow the link and comment on their blog: Recology - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)