Permalink
Browse files

Deprecating already obsolete function Bio.SeqIO.to_alignment()

  • Loading branch information...
peterjc committed Mar 1, 2010
1 parent 89f3221 commit 497ae00f0cde988e7a133d55e1ae308cb45993b4
Showing with 16 additions and 6 deletions.
  1. +5 −1 Bio/SeqIO/__init__.py
  2. +6 −0 DEPRECATED
  3. +5 −5 Tests/test_SeqIO.py
View
@@ -731,7 +731,7 @@ def index(filename, format, alphabet=None, key_function=None):
return indexer(filename, alphabet, key_function)
def to_alignment(sequences, alphabet=None, strict=True):
- """Returns a multiple sequence alignment (OBSOLETE).
+ """Returns a multiple sequence alignment (DEPRECATED).
- sequences -An iterator that returns SeqRecord objects,
or simply a list of SeqRecord objects. All
@@ -753,6 +753,10 @@ def to_alignment(sequences, alphabet=None, strict=True):
>>> filename = "Clustalw/protein.aln"
>>> alignment = AlignIO.read(filename, "clustal")
"""
+ import warnings
+ warnings.warn("The Bio.SeqIO.to_alignment(...) function is deprecated. "
+ "Please use the Bio.Align.MultipleSeqAlignment(...) object "
+ "directly instead.", DeprecationWarning)
return MultipleSeqAlignment(sequences, alphabet)
def convert(in_file, in_format, out_file, out_format, alphabet=None):
View
@@ -222,6 +222,12 @@ You can still use the "phylip", "clustal", "nexus" and "stockholm" formats
in Bio.SeqIO, however these are now supported via Bio.AlignIO, with the
old code deprecated in Releases 1.46 or 1.47, and removed in Release 1.49.
+Bio.SeqIO.to_alignment()
+========================
+This function was made obsolete with the introduction of Bio.AlignIO,
+and deprecated in Release 1.54. Use either the Bio.AlignIO functions,
+or the Bio.Align.MultipleSeqAlignment class directly instead.
+
Bio.ECell
=========
Deprecated as of Release 1.47, as it appears to have no users, and the code
View
@@ -11,6 +11,7 @@
from Bio.Seq import Seq, UnknownSeq
from StringIO import StringIO
from Bio import Alphabet
+from Bio.Align import MultipleSeqAlignment
import warnings
def send_warnings_to_stdout(message, category, filename, lineno,
@@ -166,7 +167,7 @@ def send_warnings_to_stdout(message, category, filename, lineno,
("ig", False, 'IntelliGenetics/TAT_mase_nuc.txt', 17),
("ig", True, 'IntelliGenetics/VIF_mase-pro.txt', 16),
#This next file is a MASE alignment but sequence O_ANT70 is shorter than
- #the others (so the to_alignment() call will fail). Perhaps MASE doesn't
+ #the others (so as an alignment will fail). Perhaps MASE doesn't
#write trailing gaps?
("ig", False, 'IntelliGenetics/vpu_nucaligned.txt', 9),
#Following NBRD-PIR files are used in test_nbrf.py
@@ -549,17 +550,16 @@ def check_simple_write_read(records, indent=" "):
print "Testing reading %s format file %s as an alignment" \
% (t_format, t_filename)
- #Using SeqIO.to_alignment(SeqIO.parse(...))
- alignment = SeqIO.to_alignment(SeqIO.parse( \
+ alignment = MultipleSeqAlignment(SeqIO.parse( \
handle=open(t_filename,mode), format=t_format))
- assert len(alignment.get_all_seqs()) == t_count
+ assert len(alignment) == t_count
alignment_len = alignment.get_alignment_length()
#Check the record order agrees, and double check the
#sequence lengths all agree too.
for i in range(t_count):
- assert compare_record(records[i], alignment.get_all_seqs()[i])
+ assert compare_record(records[i], alignment[i])
assert len(records[i].seq) == alignment_len
print alignment_summary(alignment)

0 comments on commit 497ae00

Please sign in to comment.