Question: Is there way to do batchquery and obtain ATC codes for pubchem CIDs?
0
gravatar for Diwan
3.1 years ago by
Diwan560
United States
Diwan560 wrote:

Hello,

I have large list of chemicals with common drug names and pubchem CIDs. I want to add the Anatomical Therapeutic Chemical (ATC) Classification System -codes (ATC codes), for each one of them. I notice that pubchem provides this info in the compound summary page. Is there a way to do batch query and obtain ATC codes? (or) is there any website or tool to get this info,i.e., given a pubchem CID obtain ATC codes?

Thanks, Diwan

atc codes pubchem cid • 1.7k views
ADD COMMENTlink modified 16 months ago by Biostar ♦♦ 20 • written 3.1 years ago by Diwan560

Diwan, were you able to solve this question? The pubchem API doesn't let you retrieve ATC codes as far as I can see

ADD REPLYlink written 17 months ago by rf100
2
gravatar for Diwan
17 months ago by
Diwan560
United States
Diwan560 wrote:

Hi RF, My solution is given below. HTH

 
 #install.packages('httr')
  library(httr)
 #install.packages("RCurl")
  library(RCurl)
 #install.packages("RJSONIO")
  library(RJSONIO)
 #install.packages("plyr")
  library(plyr)

getATC <- function(cidnum){ pubchem_url_in<-paste('https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/compound/',cidnum,'/JSON',sep='') pubchempage <- GET(pubchem_url_in) page_text <- content(pubchempage,as='text') page_test2 <- fromJSON(page_text) ATC_parse1 <- grep('www.whocc.no',unlist(page_test2),value=T) ATC_parse2 <- ATC_parse1[2] ATCout1 <-strsplit(strsplit(ATC_parse2,'code=')[[1]][2],'&showdescription')[[1]][1] return(c(cidnum,ATCout1)) }

getATC('3385')

 #For many CID query
cidnum_few<-c('5453','3385','3199')
testout <- lapply(cidnum_few,getATC)
cid_getatc <- do.call(rbind,testout)

ADD COMMENTlink written 17 months ago by Diwan560
1

Thanks so much for your help, this is very useful!

ADD REPLYlink written 17 months ago by rf100
1
gravatar for Zhilong Jia
3.1 years ago by
Zhilong Jia1.4k
London
Zhilong Jia1.4k wrote:

The pubchem API can do this task.

ADD COMMENTlink written 3.1 years ago by Zhilong Jia1.4k
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: 1134 users visited in the last hour