Permalink
Browse files

Declaring Bio.PubMed and the online parts of Bio.GenBank as OBSOLETE,…

… and likely to be deprecated after the next release
  • Loading branch information...
1 parent 0e3a239 commit 81015eb4809307add6c59b94966000b9d57d59c5 @peterjc peterjc committed Aug 18, 2008
Showing with 68 additions and 32 deletions.
  1. +35 −20 Bio/GenBank/__init__.py
  2. +22 −12 Bio/PubMed.py
  3. +11 −0 DEPRECATED
View
@@ -6,13 +6,26 @@
"""Code to work with GenBank formatted files.
+Rather than using Bio.GenBank, you are now encouraged to use Bio.SeqIO with
+the "genbank" or "embl" format names to parse GenBank or EMBL files into
+SeqRecord and SeqFeature objects (see the Biopython tutorial for details).
+
+Also, rather than using Bio.GenBank to search or download files from the NCBI,
+you are now encouraged to use Bio.Entrez instead (again, see the Biopython
+tutorial for details).
+
+Currently the ONLY reason to use Bio.GenBank directly is for the RecordParser
+which turns a GenBank file into GenBank-specific Record objects. This is a
+much closer representation to the raw file contents that the SeqRecord
+alternative from the FeatureParser (used in Bio.SeqIO).
+
Classes:
Iterator Iterate through a file of GenBank entries
Dictionary Access a GenBank file using a dictionary interface.
ErrorFeatureParser Catch errors caused during parsing.
-FeatureParser Parse GenBank data in Seq and SeqFeature objects.
+FeatureParser Parse GenBank data in SeqRecord and SeqFeature objects.
RecordParser Parse GenBank data into a Record object.
-NCBIDictionary Access GenBank using a dictionary interface.
+NCBIDictionary Access GenBank using a dictionary interface (OBSOLETE).
_BaseGenBankConsumer A base class for GenBank consumer that implements
some helpful functions that are in common between
@@ -28,8 +41,8 @@
location parser.
Functions:
-search_for Do a query against GenBank.
-download_many Download many GenBank records.
+search_for Do a query against GenBank (OBSOLETE).
+download_many Download many GenBank records (OBSOLETE).
"""
import cStringIO
@@ -1167,7 +1180,10 @@ def record_end(self, content):
class NCBIDictionary:
- """Access GenBank using a read-only dictionary interface.
+ """Access GenBank using a read-only dictionary interface (OBSOLETE).
+
+ This object is considered obsolete and likely to be deprecated
+ in the next release of Biopython. Please use Bio.Entrez instead.
"""
VALID_DATABASES = ['nucleotide', 'protein', 'genome']
VALID_FORMATS = ['genbank', 'fasta']
@@ -1242,8 +1258,10 @@ def __getitem__(self, id):
def search_for(search, database='nucleotide',
reldate=None, mindate=None, maxdate=None,
start_id = 0, max_ids = 50000000):
- """search_for(search[, reldate][, mindate][, maxdate]
- [, batchsize][, delay][, callback_fn][, start_id][, max_ids]) -> ids
+ """Do an online search at the NCBI, returns a list of IDs (OBSOLETE).
+
+ This function is obsolete and likely to be deprecated in the next
+ release of Biopython. Please use Bio.Entrez instead.
Search GenBank and return a list of the GenBank identifiers (gi's)
that match the criteria. search is the search string used to
@@ -1271,24 +1289,21 @@ def search_for(search, database='nucleotide',
"%s is not in YYYY/MM/DD format (month and "
"day are optional): %r" % errinfo)
- #If Entrez.esearch etc could automatically ignore arguments which
- #are None this could be much simpler...
- #handle = Entrez.esearch(database, search, retmode="xml",
- # retstart=start_id, retmax=max_ids,
- # mindate=mindate, maxdate=maxdate,
- # reldate=reldate)
- variables = {"retmode":"xml", "retstart":start_id, "retmax": max_ids}
- if reldate is not None : variables["reldate"] = reldate
- if mindate is not None : variables["mindate"] = mindate
- if maxdate is not None : variables["maxdate"] = maxdate
- handle = Entrez.esearch(database, search, None, **variables)
+ #Bio.Entrez can now ignore None arguments automatically
+ handle = Entrez.esearch(database, search, retmode="xml",
+ retstart=start_id, retmax=max_ids,
+ mindate=mindate, maxdate=maxdate,
+ reldate=reldate)
return Entrez.read(handle)["IdList"]
def download_many(ids, database = 'nucleotide'):
- """download_many(ids, database) -> handle of results
+ """Download multiple NCBI GenBank records, returned as a handle (OBSOLETE).
+
+ This function is obsolete and likely to be deprecated in the next
+ release of Biopython. Please use Bio.Entrez instead.
Download many records from GenBank. ids is a list of gis or
- accessions.
+ accessions.
"""
if database in ['nucleotide']:
format = 'gb'
View
@@ -4,7 +4,12 @@
# as part of this package.
"""
-This module provides code to work with PubMed from the NCBI.
+This module provides code to work with PubMed from the NCBI (OBSOLETE).
+
+This module is considered obsolete and is likely to be deprecated in the next
+release of Biopython. Please use Bio.Entrez instead.
+
+See also:
http://www.ncbi.nlm.nih.gov/PubMed/
Online documentation for linking to PubMed is available at:
@@ -29,10 +34,10 @@
from Bio import Medline
class Dictionary:
- """Access PubMed using a read-only dictionary interface.
+ """Access PubMed using a read-only dictionary interface (OBSOLETE).
- Methods:
-
+ This object is considered obsolete and likely to be deprecated
+ in the next release of Biopython. Please use Bio.Entrez instead.
"""
def __init__(self, parser=None):
"""Dictionary(parser=None)
@@ -99,8 +104,10 @@ def __getitem__(self, id):
def search_for(search, reldate=None, mindate=None, maxdate=None,
batchsize=100, callback_fn=None, start_id=0, max_ids=None):
- """search_for(search[, reldate][, mindate][, maxdate]
- [, batchsize][, callback_fn][, start_id][, max_ids]) -> ids
+ """Search PubMed, returns a list of IDs (OBSOLETE).
+
+ This function is obsolete and likely to be deprecated in the next
+ release of Biopython. Please use Bio.Entrez instead.
Search PubMed and return a list of the PMID's that match the
criteria. search is the search string used to search the
@@ -156,9 +163,7 @@ def handle_data(self, data):
'mindate' : mindate,
'maxdate' : maxdate
}
- for k, v in params.items():
- if v is None:
- del params[k]
+ #Note that Bio.Entrez can now cope with None arguments (it ignores them)
ids = []
while max_ids is None or len(ids) < max_ids:
@@ -183,11 +188,13 @@ def handle_data(self, data):
return ids
def find_related(pmid):
- """find_related(pmid) -> ids
+ """Find related articles in PubMed, returns an ID list (OBSOLETE).
+
+ This function is obsolete and likely to be deprecated in the next
+ release of Biopython. Please use Bio.Entrez instead.
Search PubMed for a list of citations related to pmid. pmid can
be a PubMed ID, a MEDLINE UID, or a list of those.
-
"""
class ResultParser(sgmllib.SGMLParser):
# Parse the ID's out of the HTML-formatted page that PubMed
@@ -235,7 +242,10 @@ def handle_data(self, data):
def download_many(ids, callback_fn, broken_fn=None,
batchsize=500, parser=None):
- """download_many(ids, callback_fn[, broken_fn][, batchsize])
+ """Download multiple PubMed records, no return value (OBSOLETE).
+
+ This function is obsolete and likely to be deprecated in the next
+ release of Biopython. Please use Bio.Entrez instead.
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
View
@@ -2,6 +2,17 @@ This file provides documentation for modules in Biopython that have been moved
or deprecated in favor of other modules. This provides some quick and easy
to find documentation about how to update your code to work again.
+Bio.GenBank
+===========
+The online functionality (search_for, download_many, and NCBIDictionary) was
+declared obsolete in Release 1.48, with the intention of an official deprecation
+in the following release. Please use Bio.Entrez instead.
+
+Bio.PubMed
+==========
+Declared obsolete in Release 1.48, with the intention of an official deprecation
+in the following release. Please use Bio.Entrez instead.
+
Bio.EUtils
==========
Deprecated in favor of Bio.Entrez in Release 1.48

0 comments on commit 81015eb

Please sign in to comment.