Skip to contents

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

Usage

read.nodes(nodeFile)

Arguments

nodeFile

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

Value

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

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|\tdomain\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()
writeLines(nodes,tmpFile)
read.nodes(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.nodes.sql or ?taxonomizrSwitch
#> Key: <id>
#>       id    rank parent
#>    <num>  <char>  <num>
#> 1:     1 no rank      1
#> 2:     2  domain 131567
#> 3:     6   genus 335928
#> 4:     7 species      6
#> 5:     9 species  32199