ropensci / taxa

taxonomic classes for R
https://docs.ropensci.org/taxa
Other
48 stars 12 forks source link

No taxon_rank information when parsing from NCBI taxonomy #203

Open janstrauss1 opened 4 years ago

janstrauss1 commented 4 years ago

Hi there,

I'm looking up taxonomic data from NCBI taxon IDs that I would like to subsequently filter using taxon_ranks == "species".

Unfortunately, it seems that NCBI taxon rank information is not parsed when using lookup_tax_data?!

Below a reproducible example:

tax_ids <- data.frame(ID = c("9606","10090","4932"))

taxmap <- lookup_tax_data(
  tax_data = tax_ids,
  type = "taxon_id",
  column = 1,
  datasets = list(),
  mappings = c(),
  database = "ncbi",
  include_tax_data = TRUE,
  use_database_ids = TRUE,
  ask = TRUE
)

Calling taxon_ranks(taxmap) returns

> taxon_ranks(taxmap)
 131567    2759   33154   33208    4751    6072  451864   33213    4890   33511  716545    7711  147537   89593    4891    7742    4892    7776 
     NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA 
   4893  117570    4930  117571    4932    8287 1338369   32523   32524   40674   32525    9347 1437010  314146    9443  314147  376913    9989 
     NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA 
 314293 1963758    9526  337687  314295   10066    9604   39107  207598   10088    9605  862507    9606   10090 
     NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA 

How could I get the taxon rank information from NCBI? Many thanks in advance for your help!

zachary-foster commented 4 years ago

Hello @janstrauss1,

Thanks for the note, I just added that functionality. Try it with the dev version:

devtools::install_github("ropensci/taxa")