Is there way to do batchquery and obtain ATC codes for pubchem CIDs?
2
0
Entering edit mode
8.1 years ago
Diwan ▴ 650

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

pubchem CID ATC codes • 4.1k views
ADD COMMENT
0
Entering edit mode

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 REPLY
2
Entering edit mode
6.4 years ago
Diwan ▴ 650

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 COMMENT
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode
8.0 years ago
Zhilong Jia ★ 2.2k

The pubchem API can do this task.

ADD COMMENT

Login before adding your answer.

Traffic: 1877 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