Back to index

python-biopython  1.60
Public Member Functions
test_Entrez.ESearchTest Class Reference

List of all members.

Public Member Functions

def test_pubmed1
def test_pubmed2
def test_pubmed3
def test_journals
def test_pmc
def test_nucleotide
def test_protein
def test_notfound
def test_notfound

Detailed Description

Tests for parsing XML output returned by ESearch

Definition at line 806 of file test_Entrez.py.


Member Function Documentation

Test parsing XML returned by ESearch from the Journals database

Definition at line 1026 of file test_Entrez.py.

01026 
01027     def test_journals(self):
01028         '''Test parsing XML returned by ESearch from the Journals database
01029         '''
01030         # Search in Journals for the term obstetrics.
01031         # To create the XML file, use
01032         # >>> Bio.Entrez.esearch(db="journals", term="obstetrics")
01033         handle = open('Entrez/esearch4.xml', "rb")
01034         record = Entrez.read(handle)
01035         handle.close()
01036         self.assertEqual(record['Count'], '177')
01037         self.assertEqual(record['RetMax'], '20')
01038         self.assertEqual(record['RetStart'], '0')
01039         self.assertEqual(len(record['IdList']), 20)
01040         self.assertEqual(record['IdList'][0], '75')
01041         self.assertEqual(record['IdList'][1], '138')
01042         self.assertEqual(record['IdList'][2], '136')
01043         self.assertEqual(record['IdList'][3], '137')
01044         self.assertEqual(record['IdList'][4], '139')
01045         self.assertEqual(record['IdList'][5], '140')
01046         self.assertEqual(record['IdList'][6], '355')
01047         self.assertEqual(record['IdList'][7], '354')
01048         self.assertEqual(record['IdList'][8], '27731')
01049         self.assertEqual(record['IdList'][9], '439')
01050         self.assertEqual(record['IdList'][10], '564')
01051         self.assertEqual(record['IdList'][11], '617')
01052         self.assertEqual(record['IdList'][12], '749')
01053         self.assertEqual(record['IdList'][13], '735')
01054         self.assertEqual(record['IdList'][14], '815')
01055         self.assertEqual(record['IdList'][15], '905')
01056         self.assertEqual(record['IdList'][16], '903')
01057         self.assertEqual(record['IdList'][17], '932')
01058         self.assertEqual(record['IdList'][18], '933')
01059         self.assertEqual(record['IdList'][19], '875')
01060         self.assertEqual(len(record['TranslationSet']), 0)
01061         self.assertEqual(len(record['TranslationStack']), 2)
01062         self.assertEqual(record['TranslationStack'][0]['Term'], 'obstetrics[All Fields]')
01063         self.assertEqual(record['TranslationStack'][0]['Field'], 'All Fields')
01064         self.assertEqual(record['TranslationStack'][0]['Count'], '177')
01065         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
01066         self.assertEqual(record['TranslationStack'][0].tag, "TermSet")
01067         self.assertEqual(record['TranslationStack'][1], 'GROUP')
01068         self.assertEqual(record['TranslationStack'][1].tag, "OP")
01069         self.assertEqual(record['QueryTranslation'], 'obstetrics[All Fields]')

Here is the call graph for this function:

Test parsing XML returned by ESearch when no items were found

Definition at line 1211 of file test_Entrez.py.

01211 
01212     def test_notfound(self):
01213         '''Test parsing XML returned by ESearch when no items were found
01214         '''
01215         # To create the XML file, use
01216         # >>> Bio.Entrez.esearch(db="protein", term="abcXYZ")
01217         handle = open('Entrez/esearch8.xml')
01218         record = Entrez.read(handle)
01219         handle.close()
01220         self.assertEqual(record['Count'], '3')
01221         self.assertEqual(record['RetMax'], '3')
01222         self.assertEqual(record['RetStart'], '0')
01223         self.assertEqual(len(record['IdList']), 3)
01224         self.assertEqual(record['IdList'][0], '16766766')
01225         self.assertEqual(record['IdList'][1], '16422035')
01226         self.assertEqual(record['IdList'][2], '4104812')
01227         self.assertEqual(len(record['TranslationSet']), 0)
01228         self.assertEqual(len(record['TranslationStack']), 2)
01229         self.assertEqual(record['TranslationStack'][0]['Term'], '000200020[molecular weight]')
01230         self.assertEqual(record['TranslationStack'][0]['Field'], 'molecular weight')
01231         self.assertEqual(record['TranslationStack'][0]['Count'], '3')
01232         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
01233         self.assertEqual(record['TranslationStack'][1], 'GROUP')
01234         self.assertEqual(record['QueryTranslation'], '000200020[molecular weight]')

Here is the call graph for this function:

Here is the caller graph for this function:

Test parsing XML returned by ESearch when no items were found

Definition at line 1235 of file test_Entrez.py.

01235 
01236     def test_notfound(self):
01237         '''Test parsing XML returned by ESearch when no items were found
01238         '''
01239         # To create the XML file, use
01240         # >>> Bio.Entrez.esearch(db="protein", term="abcXYZ")
01241         handle = open('Entrez/esearch8.xml', "rb")
01242         record = Entrez.read(handle)
01243         handle.close()
01244         self.assertEqual(record['Count'], "0")
01245         self.assertEqual(record['RetMax'], "0")
01246         self.assertEqual(record['RetStart'], "0")
01247         self.assertEqual(len(record['IdList']), 0)
01248         self.assertEqual(len(record['TranslationSet']), 0)
01249         self.assertEqual(record['QueryTranslation'], '')
01250         self.assertEqual(len(record['ErrorList']), 2)
01251         self.assertTrue("PhraseNotFound" in record['ErrorList'])
01252         self.assertTrue("FieldNotFound" in record['ErrorList'])
01253         self.assertEqual(len(record['ErrorList']["PhraseNotFound"]), 1)
01254         self.assertEqual(len(record['ErrorList']["FieldNotFound"]), 0)
01255         self.assertEqual(record['ErrorList']["PhraseNotFound"][0], "abcXYZ")
01256         self.assertEqual(len(record['WarningList']), 3)
01257         self.assertTrue("PhraseIgnored" in record['WarningList'])
01258         self.assertTrue("QuotedPhraseNotFound" in record['WarningList'])
01259         self.assertTrue("OutputMessage" in record['WarningList'])
01260         self.assertEqual(len(record['WarningList']["PhraseIgnored"]), 0)
01261         self.assertEqual(len(record['WarningList']["QuotedPhraseNotFound"]), 0)
01262         self.assertEqual(len(record['WarningList']["OutputMessage"]), 1)
01263         self.assertEqual(record['WarningList']["OutputMessage"][0], "No items found.")

Here is the call graph for this function:

Test parsing XML returned by ESearch from the Nucleotide database

Definition at line 1150 of file test_Entrez.py.

01150 
01151     def test_nucleotide(self):
01152         '''Test parsing XML returned by ESearch from the Nucleotide database
01153         '''
01154         # Search in Nucleotide for a property of the sequence,
01155         # To create the XML file, use
01156         # >>> Bio.Entrez.esearch(db="nucleotide", term="biomol trna[prop]")
01157         handle = open('Entrez/esearch6.xml', "rb")
01158         record = Entrez.read(handle)
01159         handle.close()
01160         self.assertEqual(record['Count'], "699")
01161         self.assertEqual(record['RetMax'], "20")
01162         self.assertEqual(record['RetStart'], "0")
01163         self.assertEqual(len(record['IdList']), 20)
01164         self.assertEqual(record['IdList'][0], '220161')
01165         self.assertEqual(record['IdList'][1], '220160')
01166         self.assertEqual(record['IdList'][2], '220159')
01167         self.assertEqual(record['IdList'][3], '220263')
01168         self.assertEqual(record['IdList'][4], '220162')
01169         self.assertEqual(record['IdList'][5], '159885659')
01170         self.assertEqual(record['IdList'][6], '156572228')
01171         self.assertEqual(record['IdList'][7], '2648075')
01172         self.assertEqual(record['IdList'][8], '287595')
01173         self.assertEqual(record['IdList'][9], '402544')
01174         self.assertEqual(record['IdList'][10], '402506')
01175         self.assertEqual(record['IdList'][11], '402505')
01176         self.assertEqual(record['IdList'][12], '287594')
01177         self.assertEqual(record['IdList'][13], '287593')
01178         self.assertEqual(record['IdList'][14], '287592')
01179         self.assertEqual(record['IdList'][15], '287591')
01180         self.assertEqual(record['IdList'][16], '287590')
01181         self.assertEqual(record['IdList'][17], '287589')
01182         self.assertEqual(record['IdList'][18], '287588')
01183         self.assertEqual(record['IdList'][19], '287587')
01184         self.assertEqual(len(record['TranslationSet']), 0)
01185         self.assertEqual(record['QueryTranslation'], '')

Here is the call graph for this function:

Test parsing XML returned by ESearch from PubMed Central

Definition at line 1070 of file test_Entrez.py.

01070 
01071     def test_pmc(self):
01072         '''Test parsing XML returned by ESearch from PubMed Central
01073         '''
01074         # Search in PubMed Central for stem cells in free fulltext articles.
01075         # To create the XML file, use
01076         # >>> Bio.Entrez.esearch(db="pmc",
01077         #                        term="stem cells AND free fulltext[filter]")
01078         handle = open('Entrez/esearch5.xml', "rb")
01079         record = Entrez.read(handle)
01080         handle.close()
01081         self.assertEqual(record['Count'], '23492')
01082         self.assertEqual(record['RetMax'], '20')
01083         self.assertEqual(record['RetStart'], '0')
01084         self.assertEqual(len(record['IdList']), 20)
01085         self.assertEqual(record['IdList'][0], '1894783')
01086         self.assertEqual(record['IdList'][1], '2064507')
01087         self.assertEqual(record['IdList'][2], '520747')
01088         self.assertEqual(record['IdList'][3], '2043120')
01089         self.assertEqual(record['IdList'][4], '2118723')
01090         self.assertEqual(record['IdList'][5], '1815228')
01091         self.assertEqual(record['IdList'][6], '1253596')
01092         self.assertEqual(record['IdList'][7], '2077853')
01093         self.assertEqual(record['IdList'][8], '1308908')
01094         self.assertEqual(record['IdList'][9], '2233634')
01095         self.assertEqual(record['IdList'][10], '556262')
01096         self.assertEqual(record['IdList'][11], '1925137')
01097         self.assertEqual(record['IdList'][12], '1860068')
01098         self.assertEqual(record['IdList'][13], '1626529')
01099         self.assertEqual(record['IdList'][14], '2217616')
01100         self.assertEqual(record['IdList'][15], '1584276')
01101         self.assertEqual(record['IdList'][16], '2000702')
01102         self.assertEqual(record['IdList'][17], '186324')
01103         self.assertEqual(record['IdList'][18], '1959362')
01104         self.assertEqual(record['IdList'][19], '1413911')
01105         self.assertEqual(len(record['TranslationSet']), 1)
01106         self.assertEqual(record['TranslationSet'][0]['From'], 'stem cells')
01107         self.assertEqual(record['TranslationSet'][0]['To'], '("stem cells"[MeSH Terms] OR stem cells[Acknowledgments] OR stem cells[Figure/Table Caption] OR stem cells[Section Title] OR stem cells[Body - All Words] OR stem cells[Title] OR stem cells[Abstract])')
01108         self.assertEqual(len(record['TranslationStack']), 16)
01109         self.assertEqual(record['TranslationStack'][0]['Term'], '"stem cells"[MeSH Terms]')
01110         self.assertEqual(record['TranslationStack'][0]['Field'], 'MeSH Terms')
01111         self.assertEqual(record['TranslationStack'][0]['Count'], '12224')
01112         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
01113         self.assertEqual(record['TranslationStack'][1]['Term'], 'stem cells[Acknowledgments]')
01114         self.assertEqual(record['TranslationStack'][1]['Field'], 'Acknowledgments')
01115         self.assertEqual(record['TranslationStack'][1]['Count'], '79')
01116         self.assertEqual(record['TranslationStack'][1]['Explode'], 'Y')
01117         self.assertEqual(record['TranslationStack'][2], 'OR')
01118         self.assertEqual(record['TranslationStack'][3]['Term'], 'stem cells[Figure/Table Caption]')
01119         self.assertEqual(record['TranslationStack'][3]['Field'], 'Figure/Table Caption')
01120         self.assertEqual(record['TranslationStack'][3]['Count'], '806')
01121         self.assertEqual(record['TranslationStack'][3]['Explode'], 'Y')
01122         self.assertEqual(record['TranslationStack'][4], 'OR')
01123         self.assertEqual(record['TranslationStack'][5]['Term'], 'stem cells[Section Title]')
01124         self.assertEqual(record['TranslationStack'][5]['Field'], 'Section Title')
01125         self.assertEqual(record['TranslationStack'][5]['Count'], '522')
01126         self.assertEqual(record['TranslationStack'][5]['Explode'], 'Y')
01127         self.assertEqual(record['TranslationStack'][6], 'OR')
01128         self.assertEqual(record['TranslationStack'][7]['Term'], 'stem cells[Body - All Words]')
01129         self.assertEqual(record['TranslationStack'][7]['Field'], 'Body - All Words')
01130         self.assertEqual(record['TranslationStack'][7]['Count'], '13936')
01131         self.assertEqual(record['TranslationStack'][7]['Explode'], 'Y')
01132         self.assertEqual(record['TranslationStack'][8], 'OR')
01133         self.assertEqual(record['TranslationStack'][9]['Term'], 'stem cells[Title]')
01134         self.assertEqual(record['TranslationStack'][9]['Field'], 'Title')
01135         self.assertEqual(record['TranslationStack'][9]['Count'], '1005')
01136         self.assertEqual(record['TranslationStack'][9]['Explode'], 'Y')
01137         self.assertEqual(record['TranslationStack'][10], 'OR')
01138         self.assertEqual(record['TranslationStack'][11]['Term'], 'stem cells[Abstract]')
01139         self.assertEqual(record['TranslationStack'][11]['Field'], 'Abstract')
01140         self.assertEqual(record['TranslationStack'][11]['Count'], '2503')
01141         self.assertEqual(record['TranslationStack'][11]['Explode'], 'Y')
01142         self.assertEqual(record['TranslationStack'][12], 'OR')
01143         self.assertEqual(record['TranslationStack'][13], 'GROUP')
01144         self.assertEqual(record['TranslationStack'][14]['Term'], 'free fulltext[filter]')
01145         self.assertEqual(record['TranslationStack'][14]['Field'], 'filter')
01146         self.assertEqual(record['TranslationStack'][14]['Count'], '1412839')
01147         self.assertEqual(record['TranslationStack'][14]['Explode'], 'Y')
01148         self.assertEqual(record['TranslationStack'][15], 'AND')
01149         self.assertEqual(record['QueryTranslation'], '("stem cells"[MeSH Terms] OR stem cells[Acknowledgments] OR stem cells[Figure/Table Caption] OR stem cells[Section Title] OR stem cells[Body - All Words] OR stem cells[Title] OR stem cells[Abstract]) AND free fulltext[filter]')

Here is the call graph for this function:

Test parsing XML returned by ESearch from the Protein database

Definition at line 1186 of file test_Entrez.py.

01186 
01187     def test_protein(self):
01188         '''Test parsing XML returned by ESearch from the Protein database
01189         '''
01190         # Search in Protein for a molecular weight
01191         # To create the XML file, use
01192         # >>> Bio.Entrez.esearch(db="protein", term="200020[molecular weight]")
01193         handle = open('Entrez/esearch7.xml', "rb")
01194         record = Entrez.read(handle)
01195         handle.close()
01196         self.assertEqual(record['Count'], '3')
01197         self.assertEqual(record['RetMax'], '3')
01198         self.assertEqual(record['RetStart'], '0')
01199         self.assertEqual(len(record['IdList']), 3)
01200         self.assertEqual(record['IdList'][0], '16766766')
01201         self.assertEqual(record['IdList'][1], '16422035')
01202         self.assertEqual(record['IdList'][2], '4104812')
01203         self.assertEqual(len(record['TranslationSet']), 0)
01204         self.assertEqual(len(record['TranslationStack']), 2)
01205         self.assertEqual(record['TranslationStack'][0]['Term'], '000200020[molecular weight]')
01206         self.assertEqual(record['TranslationStack'][0]['Field'], 'molecular weight')
01207         self.assertEqual(record['TranslationStack'][0]['Count'], '3')
01208         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
01209         self.assertEqual(record['TranslationStack'][1], 'GROUP')
01210         self.assertEqual(record['QueryTranslation'], '000200020[molecular weight]')

Here is the call graph for this function:

Test parsing XML returned by ESearch from PubMed (first test)

Definition at line 809 of file test_Entrez.py.

00809 
00810     def test_pubmed1(self):
00811         '''Test parsing XML returned by ESearch from PubMed (first test)
00812         '''
00813         # To create the XML file, use
00814         # >>> Bio.Entrez.esearch(db="pubmed", term="biopython")
00815         handle = open('Entrez/esearch1.xml', "rb")
00816         record = Entrez.read(handle)
00817         handle.close()
00818         self.assertEqual(record['Count'], '5')
00819         self.assertEqual(record['RetMax'], '5')
00820         self.assertEqual(record['RetStart'], '0')
00821         self.assertEqual(len(record['IdList']), 5)
00822         self.assertEqual(record['IdList'][0], '16403221')
00823         self.assertEqual(record['IdList'][1], '16377612')
00824         self.assertEqual(record['IdList'][2], '14871861')
00825         self.assertEqual(record['IdList'][3], '14630660')
00826         self.assertEqual(record['IdList'][4], '12230038')
00827         self.assertEqual(len(record['TranslationSet']), 0)
00828         self.assertEqual(len(record['TranslationStack']), 2)
00829         self.assertEqual(record['TranslationStack'][0]['Term'], 'biopython[All Fields]')
00830         self.assertEqual(record['TranslationStack'][0]['Field'], 'All Fields')
00831         self.assertEqual(record['TranslationStack'][0]['Count'], '5')
00832         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
00833         self.assertEqual(record['TranslationStack'][1], 'GROUP')
00834         self.assertEqual(record['QueryTranslation'], 'biopython[All Fields]')

Here is the call graph for this function:

Test parsing XML returned by ESearch from PubMed (second test)

Definition at line 835 of file test_Entrez.py.

00835 
00836     def test_pubmed2(self):
00837         '''Test parsing XML returned by ESearch from PubMed (second test)
00838         '''
00839         # Search in PubMed for the term cancer for the entrez date from
00840         # the last 60 days and retrieve the first 100 IDs and translations
00841         # using the history parameter. 
00842         # To create the XML file, use
00843         # >>> Bio.Entrez.esearch(db="pubmed", term="cancer", reldate=60,
00844         #                        datetype="edat", retmax=100, usehistory="y")
00845         handle = open('Entrez/esearch2.xml', "rb")
00846         record = Entrez.read(handle)
00847         handle.close()
00848         self.assertEqual(record['Count'], "10238")
00849         self.assertEqual(record['RetMax'], "100")
00850         self.assertEqual(record['RetStart'], "0")
00851         self.assertEqual(record['QueryKey'], '12')
00852         self.assertEqual(record['WebEnv'], '0rYFb69LfbTFXfG7-0HPo2BU-ZFWF1s_51WtYR5e0fAzThQCR0WIW12inPQRRIj1xUzSfGgG9ovT9-@263F6CC86FF8F760_0173SID')
00853         self.assertEqual(len(record['IdList']), 100)
00854         self.assertEqual(record['IdList'][0], '18411453')
00855         self.assertEqual(record['IdList'][1], '18411431')
00856         self.assertEqual(record['IdList'][2], '18411430')
00857         self.assertEqual(record['IdList'][3], '18411429')
00858         self.assertEqual(record['IdList'][4], '18411428')
00859         self.assertEqual(record['IdList'][5], '18411402')
00860         self.assertEqual(record['IdList'][6], '18411381')
00861         self.assertEqual(record['IdList'][7], '18411373')
00862         self.assertEqual(record['IdList'][8], '18411372')
00863         self.assertEqual(record['IdList'][9], '18411371')
00864         self.assertEqual(record['IdList'][10], '18411370')
00865         self.assertEqual(record['IdList'][11], '18411367')
00866         self.assertEqual(record['IdList'][12], '18411306')
00867         self.assertEqual(record['IdList'][13], '18411292')
00868         self.assertEqual(record['IdList'][14], '18411277')
00869         self.assertEqual(record['IdList'][15], '18411260')
00870         self.assertEqual(record['IdList'][16], '18411234')
00871         self.assertEqual(record['IdList'][17], '18411200')
00872         self.assertEqual(record['IdList'][18], '18411199')
00873         self.assertEqual(record['IdList'][19], '18411198')
00874         self.assertEqual(record['IdList'][20], '18411197')
00875         self.assertEqual(record['IdList'][21], '18411195')
00876         self.assertEqual(record['IdList'][22], '18411194')
00877         self.assertEqual(record['IdList'][23], '18411193')
00878         self.assertEqual(record['IdList'][24], '18411192')
00879         self.assertEqual(record['IdList'][25], '18411191')
00880         self.assertEqual(record['IdList'][26], '18411052')
00881         self.assertEqual(record['IdList'][27], '18411048')
00882         self.assertEqual(record['IdList'][28], '18411046')
00883         self.assertEqual(record['IdList'][29], '18411019')
00884         self.assertEqual(record['IdList'][30], '18411018')
00885         self.assertEqual(record['IdList'][31], '18411017')
00886         self.assertEqual(record['IdList'][32], '18411015')
00887         self.assertEqual(record['IdList'][33], '18411014')
00888         self.assertEqual(record['IdList'][34], '18411011')
00889         self.assertEqual(record['IdList'][35], '18411010')
00890         self.assertEqual(record['IdList'][36], '18411005')
00891         self.assertEqual(record['IdList'][37], '18411003')
00892         self.assertEqual(record['IdList'][38], '18411001')
00893         self.assertEqual(record['IdList'][39], '18411000')
00894         self.assertEqual(record['IdList'][40], '18410999')
00895         self.assertEqual(record['IdList'][41], '18410998')
00896         self.assertEqual(record['IdList'][42], '18410997')
00897         self.assertEqual(record['IdList'][43], '18410995')
00898         self.assertEqual(record['IdList'][44], '18410977')
00899         self.assertEqual(record['IdList'][45], '18410975')
00900         self.assertEqual(record['IdList'][46], '18410966')
00901         self.assertEqual(record['IdList'][47], '18410954')
00902         self.assertEqual(record['IdList'][48], '18410953')
00903         self.assertEqual(record['IdList'][49], '18410934')
00904         self.assertEqual(record['IdList'][50], '18410925')
00905         self.assertEqual(record['IdList'][51], '18410903')
00906         self.assertEqual(record['IdList'][52], '18410826')
00907         self.assertEqual(record['IdList'][53], '18410739')
00908         self.assertEqual(record['IdList'][54], '18410720')
00909         self.assertEqual(record['IdList'][55], '18410716')
00910         self.assertEqual(record['IdList'][56], '18410709')
00911         self.assertEqual(record['IdList'][57], '18410705')
00912         self.assertEqual(record['IdList'][58], '18410692')
00913         self.assertEqual(record['IdList'][59], '18410690')
00914         self.assertEqual(record['IdList'][60], '18410634')
00915         self.assertEqual(record['IdList'][61], '18410618')
00916         self.assertEqual(record['IdList'][62], '18410610')
00917         self.assertEqual(record['IdList'][63], '18410593')
00918         self.assertEqual(record['IdList'][64], '18410587')
00919         self.assertEqual(record['IdList'][65], '18410567')
00920         self.assertEqual(record['IdList'][66], '18410539')
00921         self.assertEqual(record['IdList'][67], '18410530')
00922         self.assertEqual(record['IdList'][68], '18410528')
00923         self.assertEqual(record['IdList'][69], '18410461')
00924         self.assertEqual(record['IdList'][70], '18410455')
00925         self.assertEqual(record['IdList'][71], '18410444')
00926         self.assertEqual(record['IdList'][72], '18410443')
00927         self.assertEqual(record['IdList'][73], '18410442')
00928         self.assertEqual(record['IdList'][74], '18410441')
00929         self.assertEqual(record['IdList'][75], '18410440')
00930         self.assertEqual(record['IdList'][76], '18410439')
00931         self.assertEqual(record['IdList'][77], '18410437')
00932         self.assertEqual(record['IdList'][78], '18410436')
00933         self.assertEqual(record['IdList'][79], '18410435')
00934         self.assertEqual(record['IdList'][80], '18410431')
00935         self.assertEqual(record['IdList'][81], '18410430')
00936         self.assertEqual(record['IdList'][82], '18410428')
00937         self.assertEqual(record['IdList'][83], '18410427')
00938         self.assertEqual(record['IdList'][84], '18410405')
00939         self.assertEqual(record['IdList'][85], '18410404')
00940         self.assertEqual(record['IdList'][86], '18410355')
00941         self.assertEqual(record['IdList'][87], '18410327')
00942         self.assertEqual(record['IdList'][88], '18410312')
00943         self.assertEqual(record['IdList'][89], '18410311')
00944         self.assertEqual(record['IdList'][90], '18410307')
00945         self.assertEqual(record['IdList'][91], '18410259')
00946         self.assertEqual(record['IdList'][92], '18410249')
00947         self.assertEqual(record['IdList'][93], '18410245')
00948         self.assertEqual(record['IdList'][94], '18410243')
00949         self.assertEqual(record['IdList'][95], '18410242')
00950         self.assertEqual(record['IdList'][96], '18410060')
00951         self.assertEqual(record['IdList'][97], '18410013')
00952         self.assertEqual(record['IdList'][98], '18409992')
00953         self.assertEqual(record['IdList'][99], '18409991')
00954         self.assertEqual(len(record['TranslationSet']), 1)
00955         self.assertEqual(record['TranslationSet'][0]['From'], 'cancer')
00956         self.assertEqual(record['TranslationSet'][0]['To'], '(("neoplasms"[TIAB] NOT Medline[SB]) OR "neoplasms"[MeSH Terms] OR cancer[Text Word])')
00957         self.assertEqual(len(record['TranslationStack']), 13)
00958         self.assertEqual(record['TranslationStack'][0]['Term'], '"neoplasms"[TIAB]')
00959         self.assertEqual(record['TranslationStack'][0]['Field'], 'TIAB')
00960         self.assertEqual(record['TranslationStack'][0]['Count'], "52104")
00961         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
00962         self.assertEqual(record['TranslationStack'][1]['Term'], 'Medline[SB]')
00963         self.assertEqual(record['TranslationStack'][1]['Field'], 'SB')
00964         self.assertEqual(record['TranslationStack'][1]['Count'], "16509514")
00965         self.assertEqual(record['TranslationStack'][1]['Explode'], 'Y')
00966         self.assertEqual(record['TranslationStack'][2], 'NOT')
00967         self.assertEqual(record['TranslationStack'][3], 'GROUP')
00968         self.assertEqual(record['TranslationStack'][4]['Term'], '"neoplasms"[MeSH Terms]')
00969         self.assertEqual(record['TranslationStack'][4]['Field'], 'MeSH Terms')
00970         self.assertEqual(record['TranslationStack'][4]['Count'], "1918010")
00971         self.assertEqual(record['TranslationStack'][4]['Explode'], 'Y')
00972         self.assertEqual(record['TranslationStack'][5], 'OR')
00973         self.assertEqual(record['TranslationStack'][6]['Term'], 'cancer[Text Word]')
00974         self.assertEqual(record['TranslationStack'][6]['Field'], 'Text Word')
00975         self.assertEqual(record['TranslationStack'][6]['Count'], "638849")
00976         self.assertEqual(record['TranslationStack'][6]['Explode'], 'Y')
00977         self.assertEqual(record['TranslationStack'][7], 'OR')
00978         self.assertEqual(record['TranslationStack'][8], 'GROUP')
00979         self.assertEqual(record['TranslationStack'][9]['Term'], '2008/02/16[EDAT]')
00980         self.assertEqual(record['TranslationStack'][9]['Field'], 'EDAT')
00981         self.assertEqual(record['TranslationStack'][9]['Count'], "-1")
00982         self.assertEqual(record['TranslationStack'][9]['Explode'], 'Y')
00983         self.assertEqual(record['TranslationStack'][10]['Term'], '2008/04/16[EDAT]')
00984         self.assertEqual(record['TranslationStack'][10]['Field'], 'EDAT')
00985         self.assertEqual(record['TranslationStack'][10]['Count'], "-1")
00986         self.assertEqual(record['TranslationStack'][10]['Explode'], 'Y')
00987         self.assertEqual(record['TranslationStack'][11], 'RANGE')
00988         self.assertEqual(record['TranslationStack'][12], 'AND')
00989         self.assertEqual(record['QueryTranslation'], '(("neoplasms"[TIAB] NOT Medline[SB]) OR "neoplasms"[MeSH Terms] OR cancer[Text Word]) AND 2008/02/16[EDAT] : 2008/04/16[EDAT]')

Here is the call graph for this function:

Test parsing XML returned by ESearch from PubMed (third test)

Definition at line 990 of file test_Entrez.py.

00990 
00991     def test_pubmed3(self):
00992         '''Test parsing XML returned by ESearch from PubMed (third test)
00993         '''
00994         # Search in PubMed for the journal PNAS Volume 97, and retrieve
00995         # 6 IDs starting at ID 7.
00996         # To create the XML file, use
00997         # >>> Bio.Entrez.esearch(db="pubmed", term="PNAS[ta] AND 97[vi]",
00998         #                        retstart=6, retmax=6)
00999         handle = open('Entrez/esearch3.xml', "rb")
01000         record = Entrez.read(handle)
01001         handle.close()
01002         self.assertEqual(record['Count'], '2652')
01003         self.assertEqual(record['RetMax'], '6')
01004         self.assertEqual(record['RetStart'], '6')
01005         self.assertEqual(len(record['IdList']), 6)
01006         self.assertEqual(record['IdList'][0], '11121077')
01007         self.assertEqual(record['IdList'][1], '11121076')
01008         self.assertEqual(record['IdList'][2], '11121075')
01009         self.assertEqual(record['IdList'][3], '11121074')
01010         self.assertEqual(record['IdList'][4], '11121073')
01011         self.assertEqual(record['IdList'][5], '11121072')
01012         self.assertEqual(len(record['TranslationSet']), 1)
01013         self.assertEqual(record['TranslationSet'][0]['From'], 'PNAS[ta]')
01014         self.assertEqual(record['TranslationSet'][0]['To'], '"Proc Natl Acad Sci U S A"[Journal:__jrid6653]')
01015         self.assertEqual(len(record['TranslationStack']), 3)
01016         self.assertEqual(record['TranslationStack'][0]['Term'], '"Proc Natl Acad Sci U S A"[Journal]')
01017         self.assertEqual(record['TranslationStack'][0]['Field'], 'Journal')
01018         self.assertEqual(record['TranslationStack'][0]['Count'], '91806')
01019         self.assertEqual(record['TranslationStack'][0]['Explode'], 'Y')
01020         self.assertEqual(record['TranslationStack'][1]['Term'], '97[vi]')
01021         self.assertEqual(record['TranslationStack'][1]['Field'], 'vi')
01022         self.assertEqual(record['TranslationStack'][1]['Count'], '58681')
01023         self.assertEqual(record['TranslationStack'][1]['Explode'], 'Y')
01024         self.assertEqual(record['TranslationStack'][2], 'AND')
01025         self.assertEqual(record['QueryTranslation'], '"Proc Natl Acad Sci U S A"[Journal] AND 97[vi]')

Here is the call graph for this function:


The documentation for this class was generated from the following file: