python 使用Entrez API获取发布的引用的示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用Entrez API获取发布的引用的示例相关的知识,希望对你有一定的参考价值。

## this little script shows off the use of the pubmed API through bioconductor
## requires installing Biopython (using pip)
## also requires installing the DTD files for each of the Entrez API calls, 
## but the instructions for this are given when you run the script

## useful list of Entrez databases that can be queried through API
# pmc_pubmed	PubMed citations for these articles
# pmc_refs_pubmed	PubMed article citing PMC article
# pmc_pmc_cites	   PMC articles that given PMC article cites
# pmc_pmc_citedby	PMC article citing given PMC article
# pubmed_pubmed	 Calculated set of PubMed citations similar to the selected article(s) retrieved using a word weight algorithm. 
# pubmed_pubmed_refs    Citation referenced in PubMed article. Only valid for PubMed citations that are also in PMC.


from Bio import Entrez

Entrez.email = "mcfrank@stanford.edu"

def get_abstract(pmid):
    handle = Entrez.efetch(db='pubmed', id=pmid, retmode='text', rettype='abstract')
    return handle.read()

def get_links_id(pmid):
	link_list = []
	links = Entrez.elink(dbfrom="pubmed", id=pmid, linkname="pubmed_pubmed")	
	record = Entrez.read(links)
	
	records = record[0][u'LinkSetDb'][0][u'Link']

	for link in records:
		link_list.append(link[u'Id'])

	return link_list

def get_links_term(term):
	links = Entrez.esearch(db="pubmed", retmax = 1000, term=term)	
	record = Entrez.read(links)
	link_list = record[u'IdList']

	return link_list


### MAIN -----------------------

print(get_links_term("Saffran JR[Author] "))

print "----------------------------"

print(get_abstract("26113833"))

print "----------------------------"

print(get_links_id("8943209"))

以上是关于python 使用Entrez API获取发布的引用的示例的主要内容,如果未能解决你的问题,请参考以下文章

Python3,Bio Entrez,PubMed:是否可以获取一篇文章被引用的次数?

Biopython中Entrez模块--从pubmed中查找相关文献, 所有返回的结果用Entrez.read()解析

Entrez Direct

是否可以在 iFrame 中使用 JavaScript 获取 iFrame 父页面的引用者?

使用biopython查询NCBI数据库

如何在 Isabelle/HOL 的引理之外获取见证实例