read.nodes.sql: Read NCBI nodes file

View source: R/taxa.R

read.nodes.sqlR Documentation

Read NCBI nodes file

Description

Take an NCBI nodes file and convert it to a data.table

Usage

read.nodes.sql(nodeFile, sqlFile = "nameNode.sqlite", overwrite = FALSE)

Arguments

nodeFile

string giving the path to an NCBI node 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 nodes table in database if present and regenerate

Value

a data.table with columns id, parent and rank with a key on id

References

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

See Also

read.names.sql

Examples

nodes<-c(
 "1\t|\t1\t|\tno rank\t|\t\t|\t8\t|\t0\t|\t1\t|\t0\t|\t0\t|\t0\t|\t0\t|\t0\t|\t\t|",
 "2\t|\t131567\t|\tsuperkingdom\t|\t\t|\t0\t|\t0\t|\t11\t|\t0\t|\t0\t|\t0\t|\t0\t|\t0\t|\t\t|",
 "6\t|\t335928\t|\tgenus\t|\t\t|\t0\t|\t1\t|\t11\t|\t1\t|\t0\t|\t1\t|\t0\t|\t0\t|\t\t|",
 "7\t|\t6\t|\tspecies\t|\tAC\t|\t0\t|\t1\t|\t11\t|\t1\t|\t0\t|\t1\t|\t1\t|\t0\t|\t\t|",
 "9\t|\t32199\t|\tspecies\t|\tBA\t|\t0\t|\t1\t|\t11\t|\t1\t|\t0\t|\t1\t|\t1\t|\t0\t|\t\t|"
)
tmpFile<-tempfile()
sqlFile<-tempfile()
writeLines(nodes,tmpFile)
read.nodes.sql(tmpFile,sqlFile)

sherrillmix/taxonomizr documentation built on Jan. 26, 2024, 11:01 a.m.