服务热线
178 0020 3020
今儿是我预产期,居然完全没有动静,写个作业以表纪念。
但是,确实不怎么会写,代码学习了02同学的打样,收获很大。改动了杂志和pubmed id,将其变成了本领域的杂志及这几天看的一篇文献。
#任务1
#没有使用规定的Cell杂志,选择了影像领域杂志Radiology
library(httr)
baseUrl="https://eutils.ncbi.nlm.nih.gov/"
pubmedAction=list(
base="entrez/eutils/index.fcgi",
search="entrez/eutils/esearch.fcgi", #搜索接口
fetch="entrez/eutils/efetch.fcgi", #获取数据接口
summary="entrez/eutils/esummary.fcgi" #获取数据接口(fetch可返回多种数据格式)
)
#搜索文章的参数
searchArticleParam=list(
retstart=0, #起始位置
retmax=20, #每次取的数量
usehistory='Y',#是否使用历史搜索
querykey='',
webenv='',
term='(Radiology[TA]) AND 2017[DP]',#提交pubmed的词,
total_num=0, #总记录
total_page=1, #总页数
page_size=20, #每页数目
current_page=1 #当前所在页数
)
postSearchUrl=paste(baseUrl,pubmedAction$search,sep="") #拼接搜索地址
r <- POST(postSearchUrl,
body = list(
db='pubmed',
term=searchArticleParam$term,
retmode='json',
retstart=searchArticleParam$retstart,
retmax=searchArticleParam$retmax,
usehistory=searchArticleParam$usehistory,
rettype='uilist'
)
)
stop_for_status(r) #清除http状态字符串
data=content(r, "parsed", "application/json")
#data里面存储了所有数据
esearchresult=data$esearchresult
# $count=562,$retmax=20, $retstart=0,$querykey=1, $webenv=NCID_1_30290513_130.14.18.34_9001_1515165012_617859421_0MetA0_S_MegaStore_F_1
count = esearchresult$count
print(count)
[1] "677" #2017年Radiology共发表论文667篇
#任务2 选择了最近看过的一篇文献的Pubmed id
searchArticleParam$total_num=esearchresult$count
searchArticleParam$querykey=esearchresult$querykey
searchArticleParam$webenv=esearchresult$webenv
pubmedidStr="27428890";
postFetchUrl=paste(baseUrl,pubmedAction$fetch,sep="")
r2 <- POST(postFetchUrl,
body = list(
db='pubmed',
id=pubmedidStr,
retmode='xml', #返回xml格式的,这个接口不支持json格式
usehistory=searchArticleParam$usehistory,
querykey=searchArticleParam$querykey,
webenv=searchArticleParam$webenv
)
)
stop_for_status(r2)
library(xml2)
data2=content(r2, "parsed", "application/xml")
article=xml_children(data2)
#xml_length(article)为里面文章的数量
count=length(article)
cnt=1
while(cnt<=count){ #循环将title和abstract输出
title=xml_find_first(article[cnt],".//ArticleTitle") #找到第一个ArticleTitle节点
abstract=xml_find_first(article[cnt],".//AbstractText")
print(xml_text(title))
print(xml_text(abstract))
cnt = cnt + 1
}
[1] "Recurrent Glioblastoma: Combination of High Cerebral Blood Flow with MGMT Promoter Methylation Is Associated with Benefit from Low-Dose Temozolomide Rechallenge at First Recurrence."
[1] "Purpose To determine if the combination of high cerebral blood flow (CBF) and O6-methylguanine DNA methyltransferase (MGMT) promoter methylation is associated with benefit from a second round of low-dose temozolomide (TMZ) (ie, rechallenge) in patients with glioblastoma at first recurrence. Materials and Methods The institutional review board approved this retrospective cohort study and waived the requirement for informed consent. Seventy-two patients with recurrent glioblastoma after concurrent TMZ radiation therapy were treated with a low-dose TMZ rechallenge and underwent arterial spin labeling magnetic resonance imaging. The cohort was dichotomized to high-CBF and low-CBF subgroups. MGMT promoter methylation was determined before concurrent TMZ radiation therapy. The coprimary end points were median time to progression (TTP) and 6-month outcome after the initiation of low-dose TMZ. The Cox proportional hazards model was used to assess the association between clinical outcome a... <truncated>
附件