[BioPython] pickling and assertions in Translate

Brad Chapman chapmanb@arches.uga.edu
Sat, 13 May 2000 17:44:13 -0400


Hello all;      
    I've been playing around with Bio/Tools/Translate and am 
translating some sequences which I'm getting through a remote 
connection. Everything works snazzy when I retrieve the objects and 
translate them. Great :-)
    Okay, but then I am also pickling the sequence objects, so that I 
don't have to retrieve them from the remote connection everytime I run 
the script. However, if I run the script again and use unPickled 
objects instead of freshly fetched objects,  I get the following 
(slightly distrubing :) assertion error from Translate:

File "/usr/local/lib/python1.5/site-packages/Bio/Tools/Translate.py", 
line 33, in translate_to_stop
    assert seq.alphabet == self.table.nucleotide_alphabet, \
AssertionError: cannot translate from given alphabet 
(have IUPACUnambiguousDNA(), need IUPACUnambiguousDNA())

It seems like the Sequence objects are picking and unpickling without 
a problem, since I can deal with them in other ways (ie. slices). Can 
anyone offer any thoughts why the IUPACUnambiguousDNA classes are 
failing to test as equivalent with == after a pickle? Thanks much :-)

Brad