[BioPython] Alphabet Checking

Renato Alves rjalves at igc.gulbenkian.pt
Mon Jan 28 17:42:05 UTC 2008


/var/lib/python-support/python2.4/Bio/Translate.py in 
translate_to_stop(self, seq)
     34     def translate_to_stop(self, seq):
     35         # This doesn't have a stop encoding
---> 36         assert seq.alphabet == self.table.nucleotide_alphabet, \
     37                "cannot translate from given alphabet (have %s, 
need %s)" %\
     38                (seq.alphabet, self.table.nucleotide_alphabet)

AssertionError: cannot translate from given alphabet (have 
IUPACAmbiguousDNA(), need IUPACAmbiguousDNA())

Aren't those two exactly equal?

Matching references doesn't seem to work as expected :(

What I did:

from Bio.Alphabet.IUPAC import IUPACAmbiguousDNA
from Bio import Translate
from Bio import Seq

a=Seq.Seq("ATCGGATGA...ATGCAGT",alphabet=IUPACAmbiguousDNA())
b=Translate.ambiguous_dna_by_id[11]

b.translate_to_stop(a) ... error pops out

The only way around I was able to find is:

b.table.nucleotide_alphabet=a.alphabet

I guess this is a bad day :( it's the second clash with the Translate 
module in the same day :|

Should I report this as bug?



More information about the Biopython mailing list