accessionToTaxa {taxonomizr}R Documentation

Convert accessions to taxa

Description

Convert a vector of NCBI accession numbers to their assigned taxonomy

Usage

accessionToTaxa(accessions, sqlFile, version = c("version", "base"))

Arguments

accessions

a vector of NCBI accession strings to convert to taxa

sqlFile

a string giving the path to a SQLite file screated by read.accession2taxid

version

either 'version' indicating that taxaids are versioned e.g. Z17427.1 or 'base' indicating that taxaids do not have version numbers e.g. Z17427

Value

a vector of NCBI taxa ids

References

https://ftp.ncbi.nih.gov/pub/taxonomy/accession2taxid/

See Also

getTaxonomy, read.accession2taxid

Examples

taxa<-c(
 "accession\taccession.version\ttaxid\tgi",
 "Z17427\tZ17427.1\t3702\t16569",
 "Z17428\tZ17428.1\t3702\t16570",
 "Z17429\tZ17429.1\t3702\t16571",
 "Z17430\tZ17430.1\t3702\t16572",
 "X62402\tX62402.1\t9606\t30394"
)
inFile<-tempfile()
sqlFile<-tempfile()
writeLines(taxa,inFile)
read.accession2taxid(inFile,sqlFile,vocal=FALSE)
accessionToTaxa(c("Z17430.1","Z17429.1","X62402.1",'NOTREAL'),sqlFile)

[Package taxonomizr version 0.10.6 Index]