[BioPython] Cannot __add__ two DBSeq objects

Peter biopython at maubp.freeserve.co.uk
Tue Nov 11 14:53:32 UTC 2008


On Tue, Nov 11, 2008 at 1:02 PM, Peter <biopython at maubp.freeserve.co.uk> wrote:
> On Tue, Nov 11, 2008 at 12:39 PM, Cymon Cox <cy at cymon.org> wrote:
>> Hi All,
>>
>> Two DBSeq objects cannot be concatenated, although the DBSeq object inherits
>> __add__ from Seq.
>
> Interesting point - not something I'd considered (nor anyone else until now!)
>
>> It tries to init a new DBSeq object rather than returning a Seq object as would be expected.
>> ...
>> Presumably, DBSeq needs to overide Seq.__add__
>> (Using CVS as of yesterday...)
>
> Clearly we can't create a new DBSeq object (there wouldn't be any
> suitable sequence in the database to point to), and returning a Seq
> object is sensible.  We should probably continue this discussion on
> the dev mailing list (CC'd).

Fixed in CVS by implementing the __add__ and __radd__ methods in the
DBSeq object, and having these simply off load the work to the Seq
class.

See:
BioSQL/BioSeq.py revision: 1.28
Tests/test_BioSQL.py revision: 1.26
Tests/output/test_BioSQL revision: 1.2

Peter



More information about the Biopython mailing list