You could take a look at the rentrez
package for R. You can use the entrez_search
function to get the GEO IDs for the studies related to your query, and then the entrez_summary
function for the results. So, for example:
x <- rentrez::entrez_search(db="gds", term=paste0("tolvaptan AND gse[ETYP]"),
use_history = T)
res <- rentrez::entrez_summary(db="gds", id=x$ids)
str(res)
Where res
will be a list containing objects of the esummary
class. Then, you can use the following line to get the GSE accession numbers related to tolvaptan:
lapply(res, `[[`, "gse")
So you could put this function in a loop replacing "tolvaptan" with your drugs:
drugs <- c("drugA", "drugB", "drugC")
for(drug in drugs){
x <- rentrez::entrez_search(db="gds", term=paste0(drug, " AND gse[ETYP]"))
res <- rentrez::entrez_summary(db="gds", id=x$ids)
lapply(res, `[[`, "gse")
}
Take a look at the rentrez
documentation for more details.