Question: Using Taxonomizr to Call Bacterial Taxonomy From CSV File
0
gravatar for Kevin.Y
19 months ago by
Kevin.Y10
Kevin.Y10 wrote:

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.

taxonomizr R software error • 689 views
ADD COMMENTlink modified 9 months ago by RamRS24k • written 19 months ago by Kevin.Y10

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 REPLYlink written 19 months ago by RamRS24k

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 REPLYlink written 19 months ago by RamRS24k
1
gravatar for sherrillmix
9 months ago by
sherrillmix10
sherrillmix10 wrote:

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 COMMENTlink written 9 months ago by sherrillmix10

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 REPLYlink modified 9 months ago • written 9 months ago by RamRS24k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2044 users visited in the last hour