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).
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)
#> Warning: taxonomizr is moving from data.table to SQLite databases to improve performance. This will require changing nodes and names processing. Please see ?read.names.sql or ?taxonomizrSwitch
#> Key: <id>
#> Index: <name>
#> id name
#> <num> <char>
#> 1: 1 root
#> 2: 2 Bacteria