工作中,我經(jīng)常需要編程訪問PubMed的文獻信息。為了方便從文章中解析出這些信息,我開發(fā)了一個Python包
(pubmed-mapper:https://github.com/soultoolman/pubmed-mapper/blob/master/README.md)。下面就以Associations of Coffee and Tea Consumption With Survival to Age 90 Years Among Older Women``(PubMed ID:32329900)為例來說明pubmed-mapper的用法。更多用法見https://github.com/soultoolman/pubmed-mapper/blob/master/README.md。
安裝
pip install pubmed-mapper
使用
from pubmed_mapper import Article
article = Article.parse_pmid('32329900')
獲取PubMed ID
print(article.pmid)
32329900
2. 獲取其他ID,例如DOI、PubMed Central ID等
for id in article.ids:
print('ID類型:%s,ID值:%s' % (id.id_type, id.id_value))
ID類型:pubmed,ID值:32329900
ID類型:doi,ID值:10.1111/jgs.16467
3. 獲取文章標題
print(article.title)
Associations of Coffee and Tea Consumption With Survival to Age 90?Years Among Older Women.
4. 獲取文章摘要
print(article.abstract)
<p><strong>Background: </strong>Coffee and tea are two of the most widely consumed beverages worldwide and have been associated with reduced risk of mortality in some studies. However, it is unknown whether consumption of these beverages is associated with survival to an advanced age.</p>
...
5. 獲取文章關(guān)鍵字
print(article.keywords)
['aging', 'coffee; diet; longevity', 'tea']
6. 獲取文章MeSH
print(article.mesh_headings)
['Aged', 'Body Mass Index', 'Coffee', 'Diet', 'Female', 'Global Health', 'Humans', 'Life Style', 'Prospective Studies', 'Survival', 'Tea', "Women's Health"]
7. 獲取文章作者信息
for author in article.authors:
print('姓名:%s,%s,單位:%s...' % (author.last_name, author.forename, author.affiliation[: 20]))
姓名:Shadyab,Aladdin H,單位:Department of Family...
姓名:Manson,JoAnn E,單位:Department of Epidem...
姓名:Luo,Juhua,單位:Department of Epidem...
姓名:Haring,Bernhard,單位:Department of Intern...
姓名:Saquib,Nazmus,單位:College of Medicine,...
姓名:Snetselaar,Linda G,單位:Department of Epidem...
姓名:Chen,Jiu-Chiuan,單位:Department of Preven...
姓名:Groessl,Erik J,單位:Department of Family...
姓名:Wassertheil-Smoller,Sylvia,單位:Department of Epidem...
姓名:Sun,Yangbo,單位:Department of Epidem...
姓名:Hale,Lauren,單位:Department of Family...
姓名:LeBoff,Meryl S,單位:Division of Endocrin...
姓名:LaCroix,Andrea Z,單位:Department of Family...
8. 獲取文章期刊信息
journal = article.journal
print('ISSN:%s(%s),名稱:%s,簡稱:%s' % (journal.issn, journal.issn_type, journal.title, journal.abbr))
ISSN:1532-5415(Electronic),名稱:Journal of the American Geriatrics Society,簡稱:J Am Geriatr Soc
9. 獲取文獻發(fā)表在期刊的volume、issue信息
print('Volume:%s, Issue:%s' % (article.volume, article.issue))
Volume:68, Issue:9
10. 獲取文獻的引用信息
for reference in article.references:
print(reference.citation)
Loftfield E, Freedman ND, Dodd KW, et al. Coffee drinking is widespread in the United States, but usual intake varies by key demographic and lifestyle factors. J Nutr
. 2016;146:1762-1768.
...
11. 獲取文獻的發(fā)表日期
print(article.pubdate)
2020-09-01