read.names.sql: Read NCBI names file

View source: R/taxa.R

read.names.sqlR Documentation

Read NCBI names file

Description

Take an NCBI names file, keep only scientific names and convert it to a SQLite table

Usage

read.names.sql(nameFile, sqlFile = "nameNode.sqlite", overwrite = FALSE)

Arguments

nameFile

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

sqlFile

a string giving the path where the output SQLite file should be saved

overwrite

If TRUE, delete names table in database if present and regenerate

Value

invisibly returns a string with path to sqlfile

References

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

See Also

read.nodes

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)
sqlFile<-tempfile()
read.names.sql(tmpFile,sqlFile)

taxonomizr documentation built on Feb. 16, 2023, 6:25 p.m.