[Biopython-dev] [BioPython] PubMed find_related

Michiel de Hoon mjldehoon at yahoo.com
Sat Nov 29 02:04:33 EST 2008


I've expanded your example a bit and added it to the documentation of Entrez.elink. Thanks!

--Michiel.


--- On Fri, 11/28/08, Peter <biopython at maubp.freeserve.co.uk> wrote:

> From: Peter <biopython at maubp.freeserve.co.uk>
> Subject: Re: [BioPython] PubMed find_related
> To: mjldehoon at yahoo.com
> Cc: "BioPython-Dev Mailing List" <biopython-dev at lists.open-bio.org>
> Date: Friday, November 28, 2008, 7:37 AM
> On Tue, Nov 25, 2008 at 4:05 AM, Michiel de Hoon
> <mjldehoon at yahoo.com> wrote:
> >>>> from Bio import Entrez
> >>>> handle =
> Entrez.elink(dbfrom='pubmed',id=12345)
> >>>> record = Entrez.read(handle)
> >
> > Feel free to write a section about Entrez.elink for
> the Biopython documentation :-).
> > Currently, this section is almost empty.
> 
> This does need a little love, doesn't it.  Here is a
> slightly longer
> example which could form the basis of a tutorial entry:
> 
>     >>> from Bio import Entrez
>     >>> Entrez.email =
> "A.N.Other at example.com"
>     >>> pmid = "12230038"
>     >>> handle =
> Entrez.elink(dbfrom='pubmed', id=pmid)
>     >>> result = Entrez.read(handle)
>     >>> for link in
> result[0]["LinkSetDb"][0]['Link'] :
>     ...     print link
> 
> The deeply nested nature of the XML results do suggest that
> a helper
> function in Bio.Entrez would be useful here.  Maybe
> something like:
> 
> def find_related(dbfrom, id) :
>     #Returns a list of dictionaries containing Score and ID
> matched
>     result = read(elink(dbfrom=dbfrom, id=id))
>     return
> result[0]["LinkSetDb"][0]['Link']
> 
> It might make more sense to return just a list of ID
> strings, but the
> score may be interesting.
> 
> Peter


      


More information about the Biopython-dev mailing list