Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching by name #8

Open
ucb opened this issue Feb 25, 2025 · 1 comment
Open

Searching by name #8

ucb opened this issue Feb 25, 2025 · 1 comment

Comments

@ucb
Copy link

ucb commented Feb 25, 2025

Hi,

I am new to the library and am not sure if I could be coing somthing more, but I have experimented with PFOA translation. I get no results:

db_name<-'ctsgetr.sqlite' # local cache
id<-tolower(c("alanine",'lactic acid','Perfluorooctane Acid','PFOA','Perfluorooctanoic acid'))
from<-"Chemical Name"
to<-"CAS"

CTSgetR(id,from,to,db_name=db_name)

Output:

                      id         CAS
1                alanine 115967-49-2
2            lactic acid  10326-41-7
3   perfluorooctane acid        <NA>
4                   pfoa        <NA>
5 perfluorooctanoic acid        <NA>

The last entry in id is verbatim from PubChem. Also, if I turn tables and search by CID, I get a related CAS and not the main CAS for the CID:
PubChem Page

db_name<-'ctsgetr.sqlite' # local cache
id<-tolower(c("9554"))
from<-"PubChem CID"
to<-"CAS"

CTSgetR(id,from,to,db_name=db_name)

Output:

     id       CAS
 1 9554 2395-00-8

Are there some other databases I should be loading in addition to what is recommended as a local cache (db_name<-'ctsgetr.sqlite' # local cache)

@dgrapov
Copy link
Owner

dgrapov commented Mar 1, 2025

Hi @ucb, Thanks for the nice example of what you tried. I've tested and am not able to replicate the issue. The db_name object is a local cache for storing results retrived from the primary source (https://cts.fiehnlab.ucdavis.edu/) to speed up redundant queries. Switching it just refreshes the cache in case the primary source changed some of its ID mappings.

library(CTSgetR)

db_name<-'ctsgetr.sqlite' # local cache
id<-tolower(c("alanine",'lactic acid','Perfluorooctane Acid','PFOA','Perfluorooctanoic acid'))
from<-"Chemical Name"
to<-"CAS"

CTSgetR(id,from,to,db_name=db_name)

id         CAS
1                alanine 115967-49-2
2            lactic acid  10326-41-7
3   perfluorooctane acid        <NA>
4                   pfoa   2395-00-8
5 perfluorooctanoic acid   2395-00-8

db_name<-'ctsgetr2.sqlite' # try new cache
init_CTSgetR_db(db_name)
id<-tolower(c("alanine",'lactic acid','Perfluorooctane Acid','PFOA','Perfluorooctanoic acid'))
from<-"Chemical Name"
to<-"CAS"
CTSgetR(id,from,to,db_name=db_name)

id         CAS
1                alanine 115967-49-2
2            lactic acid  10326-41-7
3   perfluorooctane acid        <NA>
  4                   pfoa   2395-00-8
5 perfluorooctanoic acid   2395-00-8

I am not sure why, but maybe the primary source website had some issues when you queried it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants