[Biopython-dev] [Biopython] Subclassing Seq and SeqRecord

Peter biopython at maubp.freeserve.co.uk
Wed Nov 25 11:22:05 UTC 2009


On Wed, Nov 25, 2009 at 8:31 AM, Jose Blanca <jblanca at btc.upv.es> wrote:
>
>> The point is while your proposed change will make some tasks
>> easier (e.g. writing an extended Seq subclass that adds a new
>> method or changes an existing method), it will make other tasks
>> much harder (e.g. the DBSeq class).
>
> That's a fair point. You're right in either case some methods would
> have to be reimplemented.

That is unavoidable :(

> I don't know if the current situation is the most convenient because
> the actual implementations have a mixed behaviour. Some methods
> like the Seq's __add__ use __class__ and some others like
> __getitem__ use Seq(). Is there a reason for that?

Historical accident I think.

If you want to pursue this change (using __class__ in the methods),
you'll also need to update the BioSQL DBSeq and DBSeqRecord
subclasses.

Comments from other people who have written Seq (or SeqRecord)
subclasses would be very valuable here.

Peter



More information about the Biopython-dev mailing list