/
taxize_staticdocs.Rmd
161 lines (105 loc) · 2.91 KB
/
taxize_staticdocs.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Install taxize
```{r}
install_github('taxize_', 'ropensci') # uncomment to run
library(taxize)
```
*********
# Phylomatic - get a phylogeny of plant species
```{r}
# input the taxonomic names
taxa <- c("Poa annua", "Abies procera", "Helianthus annuus")
# fetch the tree - the formatting of names and higher taxonmy is done within the function
tree <- phylomatic_tree(taxa=taxa, get = 'POST', informat='newick', method = "phylomatic",
storedtree = "R20120829", taxaformat = "slashpath", outformat = "newick", clean = "true")
# plot the tree
plot(tree)
```
![phylogeny](URL)
*********
# Integrated Taxonomic Informaiton Service (ITIS)
# Search by term and search type (Note: TSN stands for Taxonomic Serial Number)
```{r}
itis(203539, c("getsynonymnamesfromtsn","getacceptednamesfromtsn"))
```
## Show higher taxonomy for a given TSN
```{r}
classification(685566, ID = "tsn")
```
## Get a TSN from a species name
```{r}
tsn <- get_tsn(searchterm = "Quercus_douglasii", searchtype = "sciname")
# use classification with get_tsn together:
classification(tsn)
```
*********
# NCBI Taxonomy Browser
## Get Unique Identifier
```{r}
uids <- get_uid(c("Chironomus riparius", "Chaetopteryx"))
```
## And retrieve classification
```{r}
classification(uids)
```
*********
# Global Names Resolver (GNR)
## Get just id's and names of sources in a data.frame
```{r}
tail(gnr_datasources(todf = T))
```
*********
## Give me the id for EOL (Encyclopedia of Life)
```{r}
out <- gnr_datasources(todf = T)
out[out$title == "EOL", "id"]
```
*********
## Fuzzy search for sources with the word "zoo"
```{r}
out <- gnr_datasources(todf = T)
outdf <- out[agrep("zoo", out$title, ignore.case = T), ]
outdf[1:2, ]
```
*********
## Resolve some names
### Search for _Helianthus annuus_ and _Homo sapiens_, return a data.frame
```{r}
gnr_resolve(names = c("Helianthus annuus", "Homo sapiens"), returndf = TRUE)[1:2, ]
```
*********
### Search for the same species, with only using data source 12 (i.e., EOL)
```{r}
gnr_resolve(names = c("Helianthus annuus", "Homo sapiens"), data_source_ids = "12", returndf = TRUE)
```
*********
# Tropicos: all Tropicos functions start with "tp_"
```{r}
head(tp_acceptednames(id = 25503923))
```
```{r}
head(tp_synonyms(id = 25509881))
```
*********
# uBio
## Search uBio using the namebank_search API method.
```{r}
ubio_namebank(searchName = "elephant", sci = 1, vern = 0)
```
```{r}
head(ubio_namebank(searchName = "Helianthus annuus", sci = 1, vern = 0)[,-c(2, 3)])
```
```{r}
out <- lapply(list("Helianthus debilis", "Astragalus aduncus"), function(x) ubio_namebank(searchName = x, sci = 1, vern = 0))
head(out[[2]][, -c(2, 3)]) # just Astragalus aduncus output
```
*********
# IUCN Red List
## Query the Red List API
```{r}
ia <- iucn_summary(c("Panthera uncia", "Lynx lynx"))
```
### Extract Status
```{r}
library(plyr)
laply(ia, function(x) x$status)
```