searching ITIS and fetching Phylomatic trees

[This article was first published on Recology, 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 am writing a set of functions to search ITIS for taxonomic information (more databases to come) and functions to fetch plant phylogenetic trees from Phylomatic. Code at github.

Also, see the examples in the demos folder on the Github site above.



# A species list, which ecologies often have, but may not know the family names, or if they do,
# they (meaning me) may spell the names wrong from time to time
> splist <- c("annona_cherimola", 'annona_muricata', "quercus_robur",
"shorea_robusta", "pandanus_patina", "oryza_sativa", "durio_zibethinus",
"rubus_ulmifolius", "asclepias_curassavica", "pistacia_lentiscus")
# Get the Taxonomic Serial Number for each species, which are unique (note that there could be many TSN's within a species
# for each subspecies for example. So you may want to query for you species using get_itis_xml in the demos on the github
# site and then make sure you get the TSN for the right subspecies or species
> tsns <- laply(splist, get_tsn, searchtype = "sciname", by_ = "name",
.progress = "text")
|===========================================================================================| 100%
# Get Phylomatic formatted strings for each species (e.g., family/genus/genus_epithet)
> dat_ <- laply(tsns, get_phymat_format, format='rsubmit', .progress="text")
|===========================================================================================| 100%
# Send the strings to Phylomatic website via an API, and retrieve the newick tree (alternatively, get xml output)
> tree <- get_phylomatic_tree(dat_, 'TRUE', 'GET', 'new', 'TRUE')
Loading required package: ape
# Plot the tree, or do anything else you want to do!
> plot(tree)






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

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)