Permalink
Browse files

Replacing PendingDeprecationWarnings with BiopythonDeprecationWarnings

  • Loading branch information...
1 parent 4c5f28d commit 855675b67066438f809ad2023696db1f9cb6592e Michiel de Hoon committed Dec 21, 2010
Showing with 39 additions and 21 deletions.
  1. +8 −6 Bio/Align/Generic.py
  2. +12 −8 Bio/Align/__init__.py
  3. +4 −4 Bio/File.py
  4. +15 −3 DEPRECATED
View
@@ -19,14 +19,14 @@
from Bio import Alphabet
class Alignment:
- """Represent a set of alignments (OBSOLETE?).
+ """Represent a set of alignments (DEPRECATED).
This is a base class to represent alignments, which can be subclassed
to deal with an alignment in a specific format.
With the introduction of the MultipleSeqAlignment class in Bio.Align,
- this base class is effectively obsolete and will likely be deprecated and
- later removed in future releases of Biopython.
+ this base class is deprecated and is likely to be removed in future
+ releases of Biopython.
"""
def __init__(self, alphabet):
"""Initialize a new Alignment object.
@@ -48,7 +48,8 @@ def __init__(self, alphabet):
ACTGCTAGATAG Gamma
"""
import warnings
- warnings.warn("With the introduction of the MultipleSeqAlignment class in Bio.Align, this base class is effectively obsolete and will likely be deprecated and later removed in future releases of Biopython.", PendingDeprecationWarning)
+ import Bio
+ warnings.warn("With the introduction of the MultipleSeqAlignment class in Bio.Align, this base class is deprecated and is likely to be removed in a future release of Biopython.", Bio.BiopythonDeprecationWarning)
if not (isinstance(alphabet, Alphabet.Alphabet) \
or isinstance(alphabet, Alphabet.AlphabetEncoder)):
raise ValueError("Invalid alphabet argument")
@@ -215,7 +216,7 @@ def __iter__(self):
return iter(self._records)
def get_seq_by_num(self, number):
- """Retrieve a sequence by row number (OBSOLETE).
+ """Retrieve a sequence by row number (DEPRECATED).
Returns:
o A Seq object for the requested sequence.
@@ -234,7 +235,8 @@ def get_seq_by_num(self, number):
last_record = alignment[-1]
"""
import warnings
- warnings.warn("This is a legacy method. In new code where you need to access the rows of the alignment (i.e. the sequences) consider iterating over them or accessing them as SeqRecord objects.", PendingDeprecationWarning)
+ import Bio
+ warnings.warn("This is a legacy method and is likely to be removed in a future release of Biopython. In new code where you need to access the rows of the alignment (i.e. the sequences) consider iterating over them or accessing them as SeqRecord objects.", Bio.BiopythonDeprecationWarning)
return self._records[number].seq
def __len__(self):
View
@@ -539,27 +539,31 @@ def sort(self):
self._records.sort(key = lambda r: r.id)
def get_column(self, col):
- """Returns a string containing a given column (OBSOLETE).
+ """Returns a string containing a given column (DEPRECATED).
This is a method provided for backwards compatibility with the old
- Bio.Align.Generic.Alignment object. You are encouraged to use the
- slice notation instead.
+ Bio.Align.Generic.Alignment object. Please use the slice notation
+ instead, since get_column is likely to be removed in a future release
+ of Biopython..
"""
import warnings
- warnings.warn("This is a method provided for backwards compatibility with the old Bio.Align.Generic.Alignment object. You are encouraged to use the slice notation instead.", PendingDeprecationWarning)
+ import Bio
+ warnings.warn("This method is deprecated and is provided for backwards compatibility with the old Bio.Align.Generic.Alignment object. Please use the slice notation instead, as get_column is likely to be removed in a future release of Biopython.", Bio.BiopythonDeprecationWarning)
return _Alignment.get_column(self, col)
def add_sequence(self, descriptor, sequence, start = None, end = None,
weight = 1.0):
- """Add a sequence to the alignment (OBSOLETE).
+ """Add a sequence to the alignment (DEPRECATED).
The start, end, and weight arguments are not supported! This method
only provides limited backwards compatibility with the old
- Bio.Align.Generic.Alignment object. You are encouraged to use the
- append method with a SeqRecord instead.
+ Bio.Align.Generic.Alignment object. Please use the append method with
+ a SeqRecord instead, since add_sequence is likely to be removed in a
+ future release of Biopython.
"""
import warnings
- warnings.warn("The start, end, and weight arguments are not supported! This method only provides limited backwards compatibility with the old Bio.Align.Generic.Alignment object. You are encouraged to use the append method with a SeqRecord instead.", PendingDeprecationWarning)
+ import Bio
+ warnings.warn("The start, end, and weight arguments are not supported! This method only provides limited backwards compatibility with the old Bio.Align.Generic.Alignment object. Please use the append method with a SeqRecord instead, as the add_sequence method is likely to be removed in a future release of Biopython.", Bio.BiopythonDeprecationWarning)
#Should we handle start/end/strand information somehow? What for?
#TODO - Should we handle weights somehow? See also AlignInfo code...
if start is not None or end is not None or weight != 1.0:
View
@@ -12,9 +12,8 @@
StringHandle Wraps a file object around a string.
-SGMLStripper Object that strips SGML. This is now considered OBSOLETE, and
- is likely to be deprecated in a future release of Biopython,
- and later removed.
+SGMLStripper Object that strips SGML. This is now DEPRECATED, and is likely
+ to be removed in a future release of Biopython.
"""
import StringIO
@@ -124,7 +123,8 @@ def handle_data(self, data):
def __init__(self):
import warnings
- warnings.warn("This class is obsolete, and likely to be deprecated and later removed in a future version of Biopython", PendingDeprecationWarning)
+ import Bio
+ warnings.warn("This class is deprecated, and is likely to be removed in a future version of Biopython", Bio.BiopythonDeprecationWarning)
self._parser = SGMLStripper.MyParser()
def strip(self, str):
View
@@ -116,11 +116,17 @@ Declared obsolete in Release 1.50, deprecated in Release 1.53, and removed in
Release 1.57. Most of the functionality has moved to Bio.ExPASy.Prosite and
Bio.ExPASy.Enzyme, respectively.
-Bio.EZRetrieve, Bio.NetCatch, Bio.File.SGMLHandle, Bio.FilteredReader
-=====================================================================
-Declared obsolete in Release 1.50, deprecated in Release 1.52, removed in
+Bio.EZRetrieve, Bio.NetCatch, Bio.FilteredReader
+================================================
+Declared obsolete in Release 1.50, deprecated in Release 1.52, and removed in
Release 1.56.
+Bio.File
+========
+Bio.File.SGMLHandle was declared obsolete in Release 1.50, deprecated in
+Release 1.52, and removed in Release 1.56. Bio.File.SGMLStripper was deprecated
+in Release 1.57.
+
Bio.Graphics.GenomeDiagram and colour/color, centre/center
==========================================================
GenomeDiagram originally used colour and centre (UK spelling of color and
@@ -476,3 +482,9 @@ Bio.SubsMat
===========
The methods letter_sum and all_letters_sum were removed from the SeqMat class in
Bio.SubsMat in Release 1.57.
+
+Bio.Align
+=========
+The methods get_column and add_sequence of the MultipleSeqAlignment class were
+deprecated in Release 1.57. The Alignment class in Bio.Align.Generic and its
+method get_seq_by_num were deprecated in Release 1.57.

0 comments on commit 855675b

Please sign in to comment.