read.names: Read NCBI names file

View source: R/taxa.R

read.namesR Documentation

Read NCBI names file

Description

Take an NCBI names file, keep only scientific names and convert it to a data.table. NOTE: This function is now deprecated for read.names.sql (using SQLite rather than data.table).

Usage

read.names(nameFile, onlyScientific = TRUE)

Arguments

nameFile

string giving the path to an NCBI name file to read from (both gzipped or uncompressed files are ok)

onlyScientific

If TRUE, only store scientific names. If FALSE, synonyms and other types are included (increasing the potential for ambiguous taxonomic assignments).

Value

a data.table with columns id and name with a key on id

References

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

See Also

read.nodes, read.names.sql

Examples

namesText<-c(
  "1\t|\tall\t|\t\t|\tsynonym\t|",
  "1\t|\troot\t|\t\t|\tscientific name\t|",
  "2\t|\tBacteria\t|\tBacteria <prokaryotes>\t|\tscientific name\t|",
  "2\t|\tMonera\t|\tMonera <Bacteria>\t|\tin-part\t|",
  "2\t|\tProcaryotae\t|\tProcaryotae <Bacteria>\t|\tin-part\t|"
)
tmpFile<-tempfile()
writeLines(namesText,tmpFile)
read.names(tmpFile)

taxonomizr documentation built on May 29, 2024, 8:49 a.m.