[Biopython-dev] Bio.utils, Bio.PropertyManager, Bio.Encodings.IUPACEncoding, etc
Peter
biopython at maubp.freeserve.co.uk
Wed Sep 1 15:38:31 UTC 2010
On Wed, Sep 1, 2010 at 12:15 PM, Peter <biopython at maubp.freeserve.co.uk> wrote:
> Hi all,
>
> The following were deprecated in Biopython 1.52 (released 22 September 2009),
> so I think they can be removed ready for Biopython 1.56 now:
>
> Bio.EZRetrieve, Bio.NetCatch, Bio.File.SGMLHandle, Bio.FilteredReader
> Bio.AlignAce and Bio.MEME
>
> We also still need to look at Bio.Translate, Bio.Transcribe and linked modules:
> http://lists.open-bio.org/pipermail/biopython-dev/2010-August/008210.html
Bio.Translate and Bio.Transcribe were deprecated in Biopython 1.51, over
a year ago now.
The deprecated modules Bio.Translate and Bio.Transcribe are imported by
Bio.Encodings.IUPACEncoding, so trying to import that triggers deprecation
warnings. Effectively this means we can claim Bio.Encodings.IUPACEncoding
has already been deprecated (and this is the only code under Bio.Encodings).
Now, as far as I can tell, the point of IUPACEncoding is to attach properties
to the IUPAC alphabets using Bio.PropertyManager (which I assume predates
the inclusion of properties into the Python language). The only place this was
used (I think) was in Bio.utils, e.g. something like this:
>>> from Bio.utils import total_weight
>>> from Bio.Seq import Seq
>>> from Bio.Alphabet.IUPAC import IUPACAmbiguousDNA
>>> total_weight(Seq("ACGT", IUPACAmbiguousDNA()))
(deprecation warnings ignored)
1355.0
Since this triggers deprecation warnings from Bio.Transcribe and
Bio.Transcribe, we could argue that this function in Bio.utils (and all
similar ones using Bio.PropertyManager) have effectively been
labelled as deprecated for some time now.
Unfortunately this example would fail on Biopython 1.55 (which we
didn't spot since Bio.utils has no unit tests) due to this apparently
harmless change,
http://github.com/biopython/biopython/commit/8a08d553d367b9aa1c7f730f967bc11e1fca7a6e
It may have looked like a pointless import, but it had the (undocumented)
side effect of attaching properties like weight and translation tables to the
IUPAC alphabet objects. I have just reverted this:
http://github.com/biopython/biopython/commit/f9efb5e5ae5c58096addd398b7d50f1400d82ccc
For Biopython 1.55 we explicitly declared Bio.utils, Bio.PropertyManager,
and Bio.Encodings as obsolete. So, what do we do now? I'd like to declare
them deprecated in Biopython 1.56, and remove them (and Bio.Translate
and Bio.Transcribe) in Biopython 1.57. This is a quicker removal than usual,
but I'd argue anyone using these modules would have already been getting
deprecation warnings about Bio.Translate and Bio.Transcribe anyway.
[I suppose we could just remove it all now - but some explicit warning
seems safer!]
Comments? I think the only useful bit of functionality (which wasn't
documented, nor had unit tests) was to calculate the molecular weight
of sequences. That could be added under Bio.SeqUtils I think.
Peter
More information about the Biopython-dev
mailing list