[Biopython] Alphabet question

Sebastian Bassi sbassi at gmail.com
Tue May 11 23:11:24 UTC 2010


I tried this:

>>> from Bio.Seq import Seq
>>> from Bio.Alphabet import IUPAC
>>> seq_1 = Seq('GATCGATGGGCCTATATAGGA', IUPAC.unambiguous_dna)
>>> seq_1
Seq('GATCGATGGGCCTATATAGGA', IUPACUnambiguousDNA())

I wonder why the alphabet argument is entered as IUPAC.unambiguous_dna
but when I see the object, this argument is printed as
IUPACUnambiguousDNA().
The problem with this is that I was expecting to do:

seq_2 = Seq('GATCGATGGGCCTATATAGGA', IUPACUnambiguousDNA())

Since:

>>> seq_1
Seq('GATCGATGGGCCTATATAGGA', IUPACUnambiguousDNA())

But when I try to do it, I get this:

>>> seq_2 = Seq('GATCGATGGGCCTATATAGGA', IUPACUnambiguousDNA())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'IUPACUnambiguousDNA' is not defined

I see how it happens, but I don't understand why the repr doesn't
allow me to generate the object. Maybe is a problem of my
expectations.

Best,
SB.



More information about the Biopython mailing list