Biostar Beta. Not for public use.
Is there way to do batchquery and obtain ATC codes for pubchem CIDs?
0
Entering edit mode
20 months ago
Diwan • 560
United States

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

ADD COMMENTlink
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 REPLYlink
2
Entering edit mode
20 months ago
Diwan • 560
United States

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

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

ADD REPLYlink
1
Entering edit mode
11 months ago
Zhilong Jia ♦ 1.4k
London

The pubchem API can do this task.

ADD COMMENTlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1