Using Taxonomizr to Call Bacterial Taxonomy From CSV File
1
0
Entering edit mode
6.8 years ago
Kevin.Y ▴ 10

I am trying to use taxonomizr in R to get taxonomy from a csv file with NCBI accession numbers.

However, using these lines:

bacterial<-read.csv('unique_accession.csv')
taxaId<-accessionToTaxa("bacterial$Accession_Number","accessionTaxa.sql")
getTaxonomy(taxaId,taxaNodes,taxaNames)

I followed taxonomizr vignette in correctly setting it up. I've tested it by giving just accession numbers, and it has been able to give taxonomic classifications.

But when I provide it with my csv file, instead of getting taxonomic classifications for all my accession numbers, I am getting NA in the classification.

I was wondering if anyone else has run into this issue, and how to solve it.

R software error taxonomizr • 2.4k views
ADD COMMENT
0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time. Formatting bar

ADD REPLY
0
Entering edit mode

This looks like a problem with how you read the file. Tweak the parser parameters passed to read.csv and ensure the data that was read looks as it should - often times, you will need options such as stringsAsFactors=FALSE, quote=FALSE, comment.char="", etc.

ADD REPLY
1
Entering edit mode
6.0 years ago
sherrillmix ▴ 10

Sorry I don't really follow biostars (feel free to leave a GitHub issue if you have any further problems) so this is pretty late but just in case anyone else ends up here, the problem is that you have quotes around "bacterial$Accession_Number". R is interpreting that as a string so it's trying to look up the taxa ID for a taxon called literally "bacterial$Accession_Number" (which obviously doesn't exist and returns NA).

Remove the quotes and you should be on your way.

ADD COMMENT
0
Entering edit mode

Thank you for checking out this post on biostars. I'd think that user queries are better off in forums than on GitHub as issues, no? After all, seldom are user queries directly related to genuine software bugs/feature requests. If people could open a question on a scientific forum such as biostars or seqanswers or bioinformatics SE, they can be directed to add a tag, say. taxonomizr, and you can find these tagged posts (or subscribe to a feed that automatically emails you new posts with the tag), and you can access these posts easily using https://biostars.org/t/taxonomizr/. I edited this post and added the tag so it should show up in the search.

What do you think?

ADD REPLY

Login before adding your answer.

Traffic: 1388 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6