library(RISmed)
library(xlsx)
#限定下检索主题
pubmed_query<-function(gene){
search_topic <-paste(gene,"[TI]"," AND (cancer[TI] OR tumor[TI])", sep = "")
try({
search_query <- EUtilsSummary(search_topic,db="pubmed", retmax=10000,datetype='pdat', mindate=2000, maxdate=2020)
#查查看下检索内容
summary(search_query)
#看下这些文献的Id
QueryId(search_query)
#获取检索结果
records<- EUtilsGet(search_query) class(records) str(records)
##提取检索结果
pubmed_data <- data.frame('Title'=ArticleTitle(records),
'Year'=YearAccepted(records),
'journal'=ISOAbbreviation(records))
head(pubmed_data,1)
pubmed_data[1:3,1]
write.xlsx(pubmed_data,"pubmed.xlsx",sheetName = gene,append = TRUE)
})
}
listgene<-data.frame("CUL4A","RAB15","FBLN5","NIPA2","SLC12A6","ZSCAN29","GCNT3","LINC01587","BNIP2","BAHD1","TLE3","TSPAN3","MESDC1")
apply(listgene,2, pubmed_query)
结果将保存在目录下的Excel的不同sheets里