Package Bio :: Module PubMed
[hide private]
[frames] | no frames]

Module PubMed

source code

This module provides code to work with PubMed from the NCBI. http://www.ncbi.nlm.nih.gov/PubMed/

Online documentation for linking to PubMed is available at: http://www.ncbi.nlm.nih.gov/PubMed/linking.html

Classes: Dictionary Access PubMed articles using a dictionary interface.

Functions: search_for Search PubMed. find_related Find related articles in PubMed. download_many Download many articles from PubMed in batch mode.

Classes [hide private]
  Dictionary
Access PubMed using a read-only dictionary interface.
Functions [hide private]
 
search_for(search, reldate=None, mindate=None, maxdate=None, batchsize=100, delay=2, callback_fn=None, start_id=0, max_ids=None)
search_for(search[, reldate][, mindate][, maxdate] [, batchsize][, delay][, callback_fn][, start_id][, max_ids]) -> ids
source code
ids
find_related(pmid)
Search PubMed for a list of citations related to pmid.
source code
 
download_many(ids, callback_fn, broken_fn=None, delay=120.0, faildelay=5.0, batchsize=500, parser=None)
download_many(ids, callback_fn[, broken_fn][, delay][, faildelay][, batchsize])
source code
Function Details [hide private]

search_for(search, reldate=None, mindate=None, maxdate=None, batchsize=100, delay=2, callback_fn=None, start_id=0, max_ids=None)

source code 

search_for(search[, reldate][, mindate][, maxdate] [, batchsize][, delay][, callback_fn][, start_id][, max_ids]) -> ids

Search PubMed and return a list of the PMID's that match the criteria. search is the search string used to search the database. reldate is the number of dates prior to the current date to restrict the search. mindate and maxdate are the dates to restrict the search, e.g. 2002/01/01. batchsize specifies the number of ids to return at one time. By default, it is set to 10000, the maximum. delay is the number of seconds to wait between queries (default 2). callback_fn is an optional callback function that will be called as passed a PMID as results are retrieved. start_id specifies the index of the first id to retrieve and max_ids specifies the maximum number of id's to retrieve.

XXX The date parameters don't seem to be working with NCBI's script. Please let me know if you can get it to work.

find_related(pmid)

source code 

Search PubMed for a list of citations related to pmid. pmid can be a PubMed ID, a MEDLINE UID, or a list of those.

Returns: ids

download_many(ids, callback_fn, broken_fn=None, delay=120.0, faildelay=5.0, batchsize=500, parser=None)

source code 

download_many(ids, callback_fn[, broken_fn][, delay][, faildelay][, batchsize])

Download many records from PubMed. ids is a list of either the Medline Unique ID or the PubMed ID's of the articles. Each time a record is downloaded, callback_fn is called with the text of the record. broken_fn is an optional function that is called with the id of records that were not able to be downloaded. delay is the number of seconds to wait between requests. batchsize is the number of records to request each time.