get_lineage: Get full lineage details from a taxonomic ID number.

Description Usage Arguments Value Author(s) References Examples

View source: R/taxonomy.R

Description

This function derives the full lineage of a taxon ID number from a given taxonomy database.

Usage

1
get_lineage(taxIDs, db, simplify = TRUE, numbers = FALSE, cores = 1)

Arguments

taxIDs

integer or vector of integers giving the taxonomic ID number(s).

db

a taxonomy database (a data.frame object). See taxonomy for details.

simplify

logical indicating whether a single lineage derived from a length-one input should be simplified from a list to a named character vector. Defaults to TRUE.

numbers

logical indicating whether the output string(s) should be comprised of the taxonomic ID numbers rather than taxon names. Defaults to FALSE.

cores

integer giving the number of CPUs to parallelize the operation over (Defaults to 1). This argument may alternatively be a 'cluster' object, in which case it is the user's responsibility to close the socket connection at the conclusion of the operation, for example by running parallel::stopCluster(cores). The string 'autodetect' is also accepted, in which case the maximum number of cores to use is one less than the total number of cores available. Note that in this case there may be a tradeoff in terms of speed depending on the number and size of sequences to be processed, due to the extra time required to initialize the cluster.

Value

the full lineage as a named character vector, or list of named character vectors if the length of the input object is > 1 or simplify = FALSE. "names" attributes are taxonomic ranks.

Author(s)

Shaun Wilkinson

References

Federhen S (2012) The NCBI Taxonomy database. Nucleic Acids Research 40, D136-D143. doi:10.1093/nar/gkr1178.

https://www.ncbi.nlm.nih.gov/taxonomy/

Examples

1
2
3
4
data(whales)
data(whale_taxonomy)
taxIDs <- as.integer(gsub(".+\\|", "", names(whales)[1:2]))
get_lineage(taxIDs, db = whale_taxonomy)

shaunpwilkinson/insect documentation built on Aug. 11, 2018, 7:16 p.m.