sherrillmix/taxonomizr

Unable to query SQL database when built with `getAccessions=FALSE`

Closed this issue · 2 comments

Hi there!
To save disk space, I built my database using this command: prepareDatabase('accessionTaxa.sql', getAccessions=FALSE). All fine, no error messages and the size of the "accessionTaxa.sql" file is 496MB. However, when I try querying it to retrieve an ID of interest, I get the following error message:

> accessionToTaxa("Homo sapiens", "accessionTaxa.sql")
Error: no such table: accessionTaxa

That said, when I instead run the following command, the output seems to be correct and the ID 9606 apparently is present in the database:

> getTaxonomy(9606, "accessionTaxa.sql")
     superkingdom phylum     class      order      family      genus  species       
9606 "Eukaryota"  "Chordata" "Mammalia" "Primates" "Hominidae" "Homo" "Homo sapiens"

Am I doing something wrong, or is there a bug perhaps in how the getAccessions=FALSE option is handled?

Never mind, I just realised getId, rather than accessionToTaxa, is the function I needed for what I wanted to do:

> getId("Homo sapiens", "accessionTaxa.sql")
[1] "9606"

Cheers!

Yeah the function naming could probably use a bit of polishing but things crystalize a bit after people are using. Glad everything worked out. Good luck in your research!