Skip to content

Commit

Permalink
Tiding up some warnings, and deprecating Bio.utils.ungap() function
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjc committed Nov 23, 2009
1 parent a8dea70 commit 3e28b88
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions Bio/utils.py
Expand Up @@ -14,10 +14,10 @@
def translate(seq, id = None):
"""Translate a sequence (DEPRECATED)."""
import warnings
warnings.warn("Bio.utils.translate() has been deprecated, and we" \
+" intend to remove it in a future release of Biopython."\
+" Please use the translate method or function in Bio.Seq"\
+" instead, as described in the Tutorial.",
warnings.warn("Bio.utils.translate() has been deprecated, and we"
" intend to remove it in a future release of Biopython."
" Please use the translate method or function in Bio.Seq"
" instead, as described in the Tutorial.",
DeprecationWarning)
if id is None:
s = "translator"
Expand All @@ -29,10 +29,10 @@ def translate(seq, id = None):
def translate_to_stop(seq, id = None):
"""Translate a sequence up to the first in frame stop codon (DEPRECATED)."""
import warnings
warnings.warn("Bio.utils.translate_to_stop() has been deprecated, and we" \
+" intend to remove it in a future release of Biopython."\
+" Please use the translate method or function in Bio.Seq"\
+" instead, as described in the Tutorial.",
warnings.warn("Bio.utils.translate_to_stop() has been deprecated, and we"
" intend to remove it in a future release of Biopython."
" Please use the translate method or function in Bio.Seq"
" instead, as described in the Tutorial.",
DeprecationWarning)
if id is None:
s = "translator"
Expand All @@ -44,9 +44,9 @@ def translate_to_stop(seq, id = None):
def back_translate(seq, id = None):
"""Back-translate a sequence (DEPRECATED)."""
import warnings
warnings.warn("Bio.utils.back_translate() has been deprecated, and we" \
+" intend to remove it in a future release of Biopython."\
+" If you use it, please tell us on the mailing list.",
warnings.warn("Bio.utils.back_translate() has been deprecated, and we"
" intend to remove it in a future release of Biopython."
" If you use it, please tell us on the mailing list.",
DeprecationWarning)
if id is None:
s = "translator"
Expand All @@ -59,10 +59,10 @@ def back_translate(seq, id = None):
def transcribe(seq):
"""Transcribe a sequence (DEPRECATED)."""
import warnings
warnings.warn("Bio.utils.transcribe() has been deprecated, and we" \
+" intend to remove it in a future release of Biopython."\
+" Please use the transcribe method or function in"\
+" Bio.Seq instead, as described in the Tutorial.",
warnings.warn("Bio.utils.transcribe() has been deprecated, and we"
" intend to remove it in a future release of Biopython."
" Please use the transcribe method or function in"
" Bio.Seq instead, as described in the Tutorial.",
DeprecationWarning)
transcriber = default_manager.resolve(seq.alphabet, "transcriber")
return transcriber.transcribe(seq)
Expand All @@ -71,9 +71,9 @@ def back_transcribe(seq):
"""Back-transcribe a sequence (DEPRECATED)."""
import warnings
warnings.warn("Bio.utils.back_transcribe() has been deprecated, and we" \
+" intend to remove it in a future release of Biopython."\
+" Please use the back_transcribe method or function in"\
+" Bio.Seq instead, as described in the Tutorial.",
" intend to remove it in a future release of Biopython."\
" Please use the back_transcribe method or function in"\
" Bio.Seq instead, as described in the Tutorial.",
DeprecationWarning)
transcriber = default_manager.resolve(seq.alphabet, "transcriber")
return transcriber.back_transcribe(seq)
Expand All @@ -82,6 +82,12 @@ def ungap(seq):
"""given a sequence with gap encoding, return the ungapped sequence"""
#TODO - Fix this? It currently assumes the outmost AlphabetEncoder
#is for the gap. Consider HasStopCodon(Gapped(Protein())) as a test case.
import warnings
warnings.warn("Bio.utils.ungap() has been deprecated, and we"
" intend to remove it in a future release of Biopython."
" Instead, please use the ungap method of the Seq object "
" (added in Biopython 1.53).",
DeprecationWarning)
gap = seq.gap_char
letters = []
for c in seq.data:
Expand Down

0 comments on commit 3e28b88

Please sign in to comment.