sherrillmix / taxonomizr

Parse NCBI taxonomy and accessions to find taxonomic assignments
GNU General Public License v2.0
70 stars 11 forks source link

Unable to covert genbank IDs to lineage #15

Closed sankadinesh closed 4 years ago

sankadinesh commented 4 years ago

I am trying to convert a csv file with 1000 genbank IDs to taxonomic lineage using the following commands in R Taxonomizr. I have attached db link of input file also. Thanks in advance. https://www.dropbox.com/s/e80fg5ucydqfdsr/nifHgbID.csv?dl=0

image

sherrillmix commented 4 years ago

Small screenshots of code might not be the best way to debug problems so I can't tell if you created the "accessionTaxa.sql" database necessary for processing. Maybe post your full taxonomizr code. Also were things working previously? Do the examples work?

sankadinesh commented 4 years ago

Hi there, Sorry. Please check the text of the codes given and output.

library(taxonomizr) x<-data.table::fread(file="nifHgbID.csv",header = F,sep=",") taxaId<-accessionToTaxa("x","accessionTaxa.sql") Warning messages: 1: In file.remove(tmp) : cannot remove file 'C:\Users\Admin\AppData\Local\Temp\RtmpyIgQ6H\file2a1c5fe462d8', reason 'Permission denied' 2: In file.remove(tmp) : cannot remove file 'C:\Users\Admin\AppData\Local\Temp\RtmpyIgQ6H\file2a1c5fe462d8', reason 'Permission denied'

Example did work. Hence, I think accessionTaxa.sql (56.4 GB) is there and working.

taxaId<-accessionToTaxa(c("LN847353.1","AL079352.3"),"accessionTaxa.sql") Warning messages: 1: In file.remove(tmp) : cannot remove file 'C:\Users\Admin\AppData\Local\Temp\RtmpyIgQ6H\file2a1c387e54fd', reason 'Permission denied' 2: In file.remove(tmp) : cannot remove file 'C:\Users\Admin\AppData\Local\Temp\RtmpyIgQ6H\file2a1c387e54fd', reason 'Permission denied' print(taxaId) [1] 1313 9606 getTaxonomy(taxaId,'accessionTaxa.sql') superkingdom phylum class order family
1313 "Bacteria" "Firmicutes" "Bacilli" "Lactobacillales" "Streptococcaceae" 9606 "Eukaryota" "Chordata" "Mammalia" "Primates" "Hominidae"
genus species
1313 "Streptococcus" "Streptococcus pneumoniae" 9606 "Homo" "Homo sapiens"
There were 31 warnings (use warnings() to see them)

sherrillmix commented 4 years ago

It seems like something weird is going on with your temp directory. As a start, in the same session, could you create a tempfile and try to delete it e.g.:

tmp<-tempfile()
file.create(tmp)
print(list.files(tempdir(),basename(tmp)))
file.remove(tmp)
print(list.files(tempdir(),basename(tmp)))

Does that generate a warning?

sherrillmix commented 4 years ago

Also it looks like the only visible problems are just warnings that files couldn't be deleted. That shouldn't affect the computations and the files should be deleted when R exits (at least on a normal system with functioning temp directory) so that's really not that big a deal. If you run your code and print(taxaId) do you get answers that look reasonable?

sankadinesh commented 4 years ago

Hi Sherrillmix I used those commands and got the following errors.

temp<-tempfile() file.create(tmp) Error in file.create(tmp) : object 'tmp' not found print(list.files(tempdir(),basename(tmp))) Error in basename(tmp) : object 'tmp' not found file.remove(tmp) Error in file.remove(tmp) : object 'tmp' not found print(list.files(temp(), basename(tmp))) Error in temp() : could not find function "temp"

sankadinesh commented 4 years ago

Dear All, can anyone please give me a script for import and export through .csv format. I am creating custom database of 35k sequences. Thanks Regards, Dinesh S L

sherrillmix commented 4 years ago

You entered temp<-tempfile() when the example used tmp<-tempfile() and also had a few similar typos. So that output does not provide me with any information.

I definitely appreciate not blindly copy and pasting but if things aren't working and you don't want to debug yourself then perhaps copy-paste would be more appropriate?