Created
June 3, 2011 22:28
-
-
Save sckott/1007288 to your computer and use it in GitHub Desktop.
Example of use of package-in-development taxize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment