taxize: new function id2name() and WORMS in downstream()

taxonomy
taxize
worms
r
Tags: #<Tag:0x00007f57f60d3590> #<Tag:0x00007f57f60d3450> #<Tag:0x00007f57f60d3310> #<Tag:0x00007f57f60d31d0>

#1

Curious to get any feedback on some new things in the development version of taxize

id2name

Via a conversation with a taxize user recently, I realized that taxize has no easy way of getting a taxonomic name for a taxonomic identifier. So I thought we should have it. Enter the id2name() function. it’s setup similar to many functions in taxize, with a single function, and then S3 methods for each data source. You can select the data source with the db parameter or pass the output of a get_*() call to id2name for supported data sources.

Right now the data sources supported are: tol, itis, ncbi, worms, gbif, col, bold

Install from the id2name branch (related issue #712):

remotes::install_github("ropensci/taxize@id2name")
# restart your R session
library(taxize)
?id2name # get help

Here’s an example:

id2name(19322, db = "itis")
#> $`19322`
#>      id              name    rank   status parent_tsn
#> 1 19322 Quercus douglasii Species accepted      19276
#> 
#> attr(,"class")
#> [1] "id2name"
#> attr(,"db")
#> [1] "tsn"

downstream: worms

Via a tweet https://twitter.com/tomjwebb/status/1060273580490002433 it seems that there’s a desire to have WORMS as a data source in the downstream() function, where you can get taxonomic names for ranks lower than direct children of a target rank. E.g., get all species in a family.

Install from the id2name branch (related issue #713):

remotes::install_github("ropensci/taxize@downstream-worms")
# restart R
library(taxize)
?downstream # get help

Example:

# by worms AphiaID
x <- downstream(125732, db = 'worms', downto = 'species')
head(x$`125732`)
#>       id             name    rank
#> 1 300720  Gadus abyssorum species
#> 2 154763 Gadus aeglefinus species
#> 3 300721     Gadus agilis species
#> 4 300723    Gadus albidus species
#> 5 300722    Gadus albidus species
#> 6 300724   Gadus arenosus species

# or by name, passes through `get_wormsid()` (not run)
downstream("Gadus", db = 'worms', downto = 'species')