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

Michael Hoffman grouse at mail.utexas.edu
Wed May 21 16:39:29 EDT 2003


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
 





More information about the Biopython-dev mailing list