[BioPython] Bio.Medline parser

Michiel de Hoon mjldehoon at yahoo.com
Sun Aug 3 01:57:18 UTC 2008


> The alias idea is nice but does mean there is more than one
> way to access the data (not encouraged in python).  A related
> suggestion is to support the properties record.entry_date, 
> record.author etc (what ever the current parser does) as
> alternatives to record["DA"], record["AU"], ... ?  This would
> then be backwards compatible.  This could probably be done with
> a private dictionary mapping keys ("DA") to property names 
> ("entry_date").  When ever we add a new entry to the
> dictionary, also see if it has a named property to define
> too.
> 
Thinking it over, I think that having a key and an attribute mapping to the same value is not so clean. Alternatively we could add a .find(term) method to the Bio.Medline.Record class, which takes a term and returns the appropriate value. So record.find("author") returns record["AU"]. This gives a clear separation between the raw keys in the Medline file and the more descriptive names. Also, such a .find method can accept a wider variety of terms than an attribute name (e.g., "Full Author", "full_author", etc. all return record["FAU"]).

--Michiel


      



More information about the Biopython mailing list