python爬蟲筆記:PubMed芙贫、Medline

from Bio import Entrez
from Bio import Medline
keyword = "PyCogent"
Entrez.email = "tongyuan915@163.com"
handle = Entrez.esearch(db = "pubmed", term = keyword)
record = Entrez.read(handle)
print(record)

{'IdList': ['22479120', '18230758', '17708774'], 'TranslationStack': [{'Count': '3', 'Explode': 'N', 'Term': 'PyCogent[All Fields]', 'Field': 'All Fields'}, 'GROUP'], 'Count': '3', 'RetMax': '3', 'RetStart': '0', 'TranslationSet': [], 'QueryTranslation': 'PyCogent[All Fields]'}

pmids = record['IdList']
print(pmids)

['22479120', '18230758', '17708774']

handle = Entrez.efetch(db="pubmed", id=pmids, rettype="medline", retmode="text")
medline_records = Medline.parse(handle)
records = list(medline_records)

[{'AU': ['Cieslik M', 'Derewenda ZS', 'Mura C'], 'DP': '2011 Apr 1', 'PST': 'ppublish', 'CRDT': ['2012/04/06 06:00'], 'OWN': 'NLM', 'PHST': ['2010/06/17 00:00 [received]', '2011/02/07 00:00 [accepted]', '2012/04/06 06:00 [entrez]', '2012/04/06 06:00 [pubmed]', '2012/04/06 06:00 [medline]'], 'GR': ['U54 GM074946/GM/NIGMS NIH HHS/United States'], 'IS': '0021-8898 (Print) 0021-8898 (Linking)', 'LA': ['eng'], 'JID': '9876190', 'MHDA': '2012/04/06 06:00', 'PMC': 'PMC3253748', 'PL': 'United States', 'PG': '424-428', 'DEP': '20110211', 'IP': 'Pt 2', 'PT': ['Journal Article'], 'JT': 'Journal of applied crystallography', 'TI': 'Abstractions, algorithms and data structures for structural bioinformatics in PyCogent.', 'EDAT': '2012/04/06 06:00', 'AID': ['10.1107/S0021889811004481 [doi]', 'kk5078 [pii]'], 'PMID': '22479120', 'AB': "To facilitate flexible and efficient structural bioinformatics analyses, new functionality for three-dimensional structure processing and analysis has been introduced into PyCogent - a popular feature-rich framework for sequence-based bioinformatics, but one which has lacked equally powerful tools for handling stuctural/coordinate-based data. Extensible Python modules have been developed, which provide object-oriented abstractions (based on a hierarchical representation of macromolecules), efficient data structures (e.g.kD-trees), fast implementations of common algorithms (e.g. surface-area calculations), read/write support for Protein Data Bank-related file formats and wrappers for external command-line applications (e.g. Stride). Integration of this code into PyCogent is symbiotic, allowing sequence-based work to benefit from structure-derived data and, reciprocally, enabling structural studies to leverage PyCogent's versatile tools for phylogenetic and evolutionary analyses.", 'LR': '20191120', 'VI': '44', 'STAT': 'Publisher', 'SO': 'J Appl Crystallogr. 2011 Apr 1;44(Pt 2):424-428. doi: 10.1107/S0021889811004481. Epub 2011 Feb 11.', 'TA': 'J Appl Crystallogr', 'FAU': ['Cieslik, Marcin', 'Derewenda, Zygmunt S', 'Mura, Cameron']}, {'AU': ['Smit S', 'Rother K', 'Heringa J', 'Knight R'], 'DP': '2008 Mar', 'PST': 'ppublish', 'AD': 'Centre for Integrative Bioinformatics VU (IBIVU), Vrije Universiteit Amsterdam, 1081 HV Amsterdam, The Netherlands.', 'CRDT': ['2008/01/31 09:00'], 'LR': '20181113', 'OWN': 'NLM', 'PHST': ['2008/01/31 09:00 [pubmed]', '2008/03/12 09:00 [medline]', '2008/01/31 09:00 [entrez]'], 'IS': '1469-9001 (Electronic) 1355-8382 (Linking)', 'LA': ['eng'], 'SB': 'IM', 'JID': '9509184', 'MHDA': '2008/03/12 09:00', 'PMC': 'PMC2248259', 'PL': 'United States', 'PG': '410-6', 'DEP': '20080129', 'IP': '3', 'PT': ['Journal Article', "Research Support, Non-U.S. Gov't"], 'JT': 'RNA (New York, N.Y.)', 'TI': 'From knotted to nested RNA structures: a variety of computational methods for pseudoknot removal.', 'EDAT': '2008/01/31 09:00', 'DCOM': '20080311', 'AID': ['rna.881308 [pii]', '10.1261/rna.881308 [doi]'], 'RN': ['63231-63-0 (RNA)'], 'PMID': '18230758', 'AB': 'Pseudoknots are abundant in RNA structures. Many computational analyses require pseudoknot-free structures, which means that some of the base pairs in the knotted structure must be disregarded to obtain a nested structure. There is a surprising diversity of methods to perform this pseudoknot removal task, but these methods are often poorly described and studies can therefore be difficult to reproduce (in part, because different procedures may be intuitively obvious to different investigators). Here we provide a variety of algorithms for pseudoknot removal, some of which can incorporate sequence or alignment information in the removal process. We demonstrate that different methods lead to different results, which might affect structure-based analyses. This work thus provides a starting point for discussion of the extent to which these different methods recapture the underlying biological reality. We provide access to reference implementations through a web interface (at http://www.ibi.vu.nl/programs/k2nwww), and the source code is available in the PyCogent project.', 'LID': '10.1261/rna.881308 [doi]', 'VI': '14', 'STAT': 'MEDLINE', 'SO': 'RNA. 2008 Mar;14(3):410-6. doi: 10.1261/rna.881308. Epub 2008 Jan 29.', 'TA': 'RNA', 'FAU': ['Smit, Sandra', 'Rother, Kristian', 'Heringa, Jaap', 'Knight, Rob'], 'MH': ['Algorithms', 'Base Pairing', 'Base Sequence', 'Computer Simulation', 'Models, Molecular', 'Nucleic Acid Conformation', 'RNA/chemistry/genetics/metabolism']}, {'AU': ['Knight R', 'Maxwell P', 'Birmingham A', 'Carnes J', 'Caporaso JG', 'Easton BC', 'Eaton M', 'Hamady M', 'Lindsay H', 'Liu Z', 'Lozupone C', 'McDonald D', 'Robeson M', 'Sammut R', 'Smit S', 'Wakefield MJ', 'Widmann J', 'Wikman S', 'Wilson S', 'Ying H', 'Huttley GA'], 'DP': '2007', 'PST': 'ppublish', 'AD': 'Department of Chemistry and Biochemistry, University of Colorado, Boulder, Colorado, USA. rob@spot.colorado.edu', 'CRDT': ['2007/08/22 09:00'], 'OWN': 'NLM', 'PHST': ['2007/05/30 00:00 [received]', '2007/08/13 00:00 [revised]', '2007/08/21 00:00 [accepted]', '2007/08/22 09:00 [pubmed]', '2008/03/01 09:00 [medline]', '2007/08/22 09:00 [entrez]'], 'GR': ['T32 GM008759/GM/NIGMS NIH HHS/United States', 'T32 GM065103/GM/NIGMS NIH HHS/United States'], 'IS': '1474-760X (Electronic) 1474-7596 (Linking)', 'LA': ['eng'], 'JID': '100960660', 'MHDA': '2008/03/01 09:00', 'PMC': 'PMC2375001', 'PL': 'England', 'PG': 'R171', 'SB': 'IM', 'IP': '8', 'PT': ['Evaluation Study', 'Journal Article', 'Research Support, N.I.H., Extramural', "Research Support, Non-U.S. Gov't"], 'JT': 'Genome biology', 'TI': 'PyCogent: a toolkit for making sense from sequence.', 'EDAT': '2007/08/22 09:00', 'DCOM': '20080229', 'AID': ['gb-2007-8-8-r171 [pii]', '10.1186/gb-2007-8-8-r171 [doi]'], 'RN': ['0 (BRCA1 Protein)', '0 (von Willebrand Factor)'], 'PMID': '17708774', 'AB': 'We have implemented in Python the COmparative GENomic Toolkit, a fully integrated and thoroughly tested framework for novel probabilistic analyses of biological sequences, devising workflows, and generating publication quality graphics. PyCogent includes connectors to remote databases, built-in generalized probabilistic techniques for working with biological sequences, and controllers for third-party applications. The toolkit takes advantage of parallel architectures and runs on a range of hardware and operating systems, and is available under the general public license from http://sourceforge.net/projects/pycogent.', 'LR': '20191210', 'VI': '8', 'STAT': 'MEDLINE', 'SO': 'Genome Biol. 2007;8(8):R171. doi: 10.1186/gb-2007-8-8-r171.', 'TA': 'Genome Biol', 'FAU': ['Knight, Rob', 'Maxwell, Peter', 'Birmingham, Amanda', 'Carnes, Jason', 'Caporaso, J Gregory', 'Easton, Brett C', 'Eaton, Michael', 'Hamady, Micah', 'Lindsay, Helen', 'Liu, Zongzhi', 'Lozupone, Catherine', 'McDonald, Daniel', 'Robeson, Michael', 'Sammut, Raymond', 'Smit, Sandra', 'Wakefield, Matthew J', 'Widmann, Jeremy', 'Wikman, Shandy', 'Wilson, Stephanie', 'Ying, Hua', 'Huttley, Gavin A'], 'MH': ['Animals', 'BRCA1 Protein/genetics', 'Databases, Genetic', 'Genomics/methods', 'Humans', 'Phylogeny', 'Protein Conformation', 'Proteobacteria/classification/genetics', 'Sequence Analysis/methods', 'Software', 'von Willebrand Factor/chemistry/genetics']}]

n=1
for record in records:
    #print(record['TI'])
    if keyword in record['TI']:
        print("{} ) {}".format(n, record['TI']))
        n += 1

1 ) Abstractions, algorithms and data structures for structural bioinformatics in PyCogent.
2 ) PyCogent: a toolkit for making sense from sequence.

from Bio import Entrez
handle = Entrez.esearch(db="pubmed", term="PyCogent AND RNA")
record = Entrez.read(handle)
print(record['IdList'])
handle = Entrez.esearch(db="pubmed", term="PyCogent OR RNA")
record = Entrez.read(handle)
print(record['Count'])
handle = Entrez.esearch(db="pubmed", term="PyCogent AND 2008[year]")
record = Entrez.read(handle)
print(record['IdList'])
handle = Entrez.esearch(db="pubmed", term="C. elegans [Organism] AND 2008[year] AND Mapk [Gene]")
record = Entrez.read(handle)
print(record['Count'])

\color{green}{?? OK ??}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末糊渊,一起剝皮案震驚了整個(gè)濱河市架专,隨后出現(xiàn)的幾起案子介粘,更是在濱河造成了極大的恐慌喷鸽,老刑警劉巖乐设,帶你破解...
    沈念sama閱讀 218,858評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件讼庇,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡近尚,警方通過查閱死者的電腦和手機(jī)蠕啄,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,372評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人歼跟,你說我怎么就攤上這事和媳。” “怎么了哈街?”我有些...
    開封第一講書人閱讀 165,282評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵留瞳,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我叹卷,道長(zhǎng)撼港,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,842評(píng)論 1 295
  • 正文 為了忘掉前任骤竹,我火速辦了婚禮宽气,結(jié)果婚禮上净蚤,老公的妹妹穿的比我還像新娘踏揣。我一直安慰自己眯杏,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,857評(píng)論 6 392
  • 文/花漫 我一把揭開白布懒震。 她就那樣靜靜地躺著罩息,像睡著了一般。 火紅的嫁衣襯著肌膚如雪个扰。 梳的紋絲不亂的頭發(fā)上瓷炮,一...
    開封第一講書人閱讀 51,679評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音递宅,去河邊找鬼娘香。 笑死,一個(gè)胖子當(dāng)著我的面吹牛办龄,可吹牛的內(nèi)容都是我干的烘绽。 我是一名探鬼主播,決...
    沈念sama閱讀 40,406評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼俐填,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼安接!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起英融,我...
    開封第一講書人閱讀 39,311評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤盏檐,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后驶悟,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體胡野,經(jīng)...
    沈念sama閱讀 45,767評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,945評(píng)論 3 336
  • 正文 我和宋清朗相戀三年撩银,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了给涕。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片豺憔。...
    茶點(diǎn)故事閱讀 40,090評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡额获,死狀恐怖够庙,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情抄邀,我是刑警寧澤耘眨,帶...
    沈念sama閱讀 35,785評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站境肾,受9級(jí)特大地震影響剔难,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜奥喻,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,420評(píng)論 3 331
  • 文/蒙蒙 一偶宫、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧环鲤,春花似錦纯趋、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,988評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至西剥,卻和暖如春痹栖,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背瞭空。 一陣腳步聲響...
    開封第一講書人閱讀 33,101評(píng)論 1 271
  • 我被黑心中介騙來泰國(guó)打工揪阿, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人匙铡。 一個(gè)月前我還...
    沈念sama閱讀 48,298評(píng)論 3 372
  • 正文 我出身青樓图甜,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親鳖眼。 傳聞我的和親對(duì)象是個(gè)殘疾皇子黑毅,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,033評(píng)論 2 355