[Biopython-dev] Bio.PubMed find_related additional keyword options

Jeffrey Chang jchang at jeffchang.com
Wed May 21 16:58:06 EDT 2003


Can you restrict the keywords that can be passed to the function?  e.g.
     def find_related(pmid, mindate=None, datetype=None, XXX):

Once Andrew's EUtils.py matures, we can change the underlying code to 
use that package, which should be more robust than the current code.  
If the keywords are explicitly defined, it will be easier to make that 
change, because we will know what the user is passing in.

Also, having explicit keywords will insulate find_related from changes 
in EUtils.  If the EUtils parameters change, we can handle the changes 
within the find_related function, rather than in every function that 
calls it.

Jeff




On Wednesday, May 21, 2003, at 01:39  PM, Michael Hoffman wrote:

> The following will allow extra keyword options to find_related() as
> shown in the new docstring example. I also added a unit test for this
> functionality (not shown).
>
> OK to check in?
> -- 
> Michael Hoffman <grouse at alumni.utexas.net>
> The University of Texas at Austin
>
> Index: PubMed.py
> ===================================================================
> RCS file: /home/repository/biopython/biopython/Bio/PubMed.py,v
> retrieving revision 1.3
> diff -u -r1.3 PubMed.py
> --- PubMed.py	24 Sep 2002 06:34:27 -0000	1.3
> +++ PubMed.py	21 May 2003 20:38:21 -0000
> @@ -199,12 +199,20 @@
>              break
>      return ids
>
> -def find_related(pmid):
> -    """find_related(pmid) -> ids
> +def find_related(pmid, **keywds):
> +    """find_related(pmid, **keywds) -> ids
>
>      Search PubMed for a list of citations related to pmid.  pmid can
>      be a PubMed ID, a MEDLINE UID, or a list of those.
>
> +    keywds - additional keywords to be passed to ELink
> +
> +    for example:
> +
> +    >>> find_related("11812492", mindate="2003", datetype="pdat")
> +
> +    will find citations related to pmid 11835276 published in 2003
> +    or later
>      """
>      class ResultParser(sgmllib.SGMLParser):
>          # Parse the ID's out of the HTML-formatted page that PubMed
> @@ -246,7 +254,7 @@
>      parser = ResultParser()
>      if type(pmid) is type([]):
>          pmid = string.join(pmid, ',')
> -    h = NCBI.elink(dbfrom='pubmed', id=pmid)
> +    h = NCBI.elink(dbfrom='pubmed', id=pmid, **keywds)
>      parser.feed(h.read())
>      return parser.ids
>
>
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev




More information about the Biopython-dev mailing list