[BioPython] Cannot __add__ two DBSeq objects

Cymon Cox cy at cymon.org
Tue Nov 11 12:39:05 UTC 2008


Hi All,

Two DBSeq objects cannot be concatenated, although the DBSeq object inherits
__add__ from Seq. It tries to init a new DBSeq object rather than returning
a Seq object as would be expected.

>>> s1
DBSeq('CTAAGCCATTCTACGACGTAGAATGAGCGTGTCACTGTATTTACGTCTCTTTCG...GGT',
DNAAlphabet())
>>> s2
DBSeq('ACTCAAGGGTGAAGTATTTCCAATCGAAATAGGTGCTTCTATACCGGAAATAAT...CAT',
DNAAlphabet())
>>> s1 + s2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.5/site-packages/Bio/Seq.py", line 144, in
__add__
    return self.__class__(str(self) + str(other), a)
TypeError: __init__() takes exactly 6 arguments (3 given)

Presumably, DBSeq needs to overide Seq.__add__

(Using CVS as of yesterday...)

Cheers, C.

--



More information about the Biopython mailing list