[Biopython-dev] Bio.Entrez XML parsing

Michiel de Hoon mjldehoon at yahoo.com
Tue Apr 1 12:52:17 UTC 2008


I have added a read() function to Bio.Entrez in CVS.
Following Peter's suggestion, I put a dictionary (_NameToModule) inside the Bio.Entrez.DataHandler class, which can be used to override the default parser with a user-defined parser.

I am not sure though why a user-defined parser needs to go through Bio.Entrez.read(). Wouldn't it be easier to do something like
>>> from Bio import Entrez
>>> handle = Entrez.efetch(something)
>>> record = run_my_parser(handle)

Currently, I have added only one parser (for EInfo). To try it, use
>>> from Bio import Entrez
>>> handle = Entrez.einfo()
>>> record = Entrez.read(handle)
>>> print record
['pubmed', 'protein', 'nucleotide', 'nuccore', 'nucgss', 'nucest', 'structure', 'genome', 'books', 'cancerchromosomes', 'cdd', 'gap', 'domains', 'gene', 'genomeprj', 'gensat', 'geo', 'gds', 'homologene', 'journals', 'mesh', 'ncbisearch', 'nlmcatalog', 'omia', 'omim', 'pmc', 'popset', 'probe', 'proteinclusters', 'pcassay', 'pccompound', 'pcsubstance', 'snp', 'taxonomy', 'toolkit', 'unigene', 'unists']

# To get information about the snp database
>>> handle = Entrez.einfo(db="snp")
 >>> record = Entrez.read(handle)
>>> print record["Count"]
44992036
>>> print record["LastUpdate"]
2007/11/29 18:22


--Michiel.

Sean Davis <sdavis2 at mail.nih.gov> wrote:This makes sense.  However, it seems that there needs to be a way to
"register" a parser with read() so that users can extend their local
installation with a specialized parser.  In other words, it seems that
a way to dynamically register a parser with read() would be helpful.
Or am I missing something?

Sean


       
---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.



More information about the Biopython-dev mailing list