Skip to content

Commit

Permalink
Merge pull request #417 from EDiLD/master
Browse files Browse the repository at this point in the history
minor fixes
  • Loading branch information
eduardszoecs committed Apr 29, 2015
2 parents 41b0677 + 2389436 commit 0b9fbbf
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ inst/doc/.texpadtmp/taxize_ms.log
inst/doc/.texpadtmp/taxize_ms.out
inst/doc/.texpadtmp/taxize_ms.synctex.gz
.httr-oauth
inst/vign/taxize_vignette_cache
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Depends:
Imports:
XML,
RCurl (>= 1.6),
reshape2,
stringr,
plyr,
httr (>= 0.2),
jsonlite,
foreach,
ape,
Taxonstand,
reshape2,
data.table,
vegan,
bold
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ import(foreach)
import(httr)
import(jsonlite)
import(plyr)
import(reshape2)
import(stringr)
importFrom(bold,bold_tax_id)
importFrom(bold,bold_tax_name)
importFrom(reshape2,dcast)
importFrom(reshape2,melt)
importFrom(vegan,taxa2dist)
3 changes: 2 additions & 1 deletion R/tax_agg.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Aggregate species data to given taxonomic rank
#'
#' @import reshape2
#' @importFrom reshape2 melt
#' @importFrom reshape2 dcast
#'
#' @param x Community data matrix. Taxa in columns, samples in rows.
#' @param rank character; Taxonomic rank to aggregate by.
Expand Down
36 changes: 18 additions & 18 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -178,36 +178,36 @@ For more examples see the [tutorial][tut]

#### Stable version from CRAN

```{r eval=FALSE}
```{r install_stable, eval=FALSE}
install.packages("taxize")
```

#### Development version from GitHub

Windows users install [Rtools](http://cran.r-project.org/bin/windows/Rtools/) first.

```{r eval=FALSE}
```{r install_dev, eval=FALSE}
install.packages("devtools")
devtools::install_github("taxize", "ropensci")
```

```{r}
```{r load}
library('taxize')
```

### Get unique taxonomic identifier from NCBI

Alot of `taxize` revolves around taxonomic identifiers. Because, as you know, names can be a mess (misspelled, synonyms, etc.), it's better to get an identifier that a particular data sources knows about, then we can move forth acquiring more fun taxonomic data.

```{r}
```{r get_uid}
uids <- get_uid(c("Chironomus riparius", "Chaetopteryx"))
```

### Retrieve classifications

Classifications - think of a species, then all the taxonomic ranks up from that species, like genus, family, order, class, kingdom.

```{r}
```{r classification}
out <- classification(uids)
lapply(out, head)
```
Expand All @@ -216,86 +216,86 @@ lapply(out, head)

Get immediate children of _Salmo_. In this case, _Salmo_ is a genus, so this gives species within the genus.

```{r}
```{r children}
children("Salmo", db = 'ncbi')
```

### Downstream children to a rank

Get all species in the genus _Apis_

```{r}
```{r downstream}
downstream("Apis", db = 'itis', downto = 'Species', verbose = FALSE)
```

### Upstream taxa

Get all genera up from the species _Pinus contorta_ (this includes the genus of the species, and its co-genera within the same family).

```{r}
```{r upstream}
upstream("Pinus contorta", db = 'itis', upto = 'Genus', verbose=FALSE)
```

### Get synonyms

```{r}
```{r synonyms}
synonyms("Salmo friderici", db='ubio')
```

### Get taxonomic IDs from many sources

```{r}
```{r get_ids}
get_ids(names="Salvelinus fontinalis", db = c('ubio','ncbi'), verbose=FALSE)
```

You can limit to certain rows when getting ids in any `get_*()` functions

```{r}
```{r get_ids2}
get_ids(names="Poa annua", db = "gbif", rows=1)
```

Furthermore, you can just back all ids if that's your jam with the `get_*_()` functions (all `get_*()` functions with additional `_` underscore at end of function name)

```{r}
```{r get_ids_}
get_ids_(c("Chironomus riparius", "Pinus contorta"), db = 'nbn', rows=1:3)
```

### Common names from scientific names

```{r}
```{r sci2comm}
sci2comm('Helianthus annuus', db = 'itis')
```

### Scientific names from common names

```{r}
```{r comm2sci}
comm2sci("black bear", db = "itis")
```

### Coerce codes to taxonomic id classes

`numeric` to `uid`

```{r}
```{r as.uid}
as.uid(315567)
```

`list` to `uid`

```{r}
```{r as.uid2}
as.uid(list("315567", "3339", "9696"))
```

### Coerce taxonomic id classes to a data.frame

```{r}
```{r as.uid3}
out <- as.uid(c(315567, 3339, 9696))
(res <- data.frame(out))
```

## Contributors

+ [Scott Chamberlain](https://github.com/SChamberlain)
+ [Scott Chamberlain](https://github.com/sckott)
+ [Eduard Szöcs](https://github.com/EDiLD)
+ [Zachary Foster](https://github.com/zachary-foster)
+ [Carl Boettiger](https://github.com/cboettig)
Expand Down
2 changes: 1 addition & 1 deletion inst/vign/taxize_vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ A_clas[[1]]$rank[tolower(A_clas[[1]]$name) %in% B3]

If we find a direct match (here *Gammarus roeseli*), we are lucky. But we can also match Gammaridae with *Gammarus roeseli*, but on a lower taxonomic level. A more comprehensive and realistic example (matching a trait table with an abundance table) is given in the vignette on matching.

[eol]: http://eol.org/
[eol]: http://www.eol.org/
[taxosaurus]: http://api.phylotastic.org/tnrs
[ncbi]: http://www.ncbi.nlm.nih.gov/
[itis]: http://www.itis.gov/
Expand Down

0 comments on commit 0b9fbbf

Please sign in to comment.