Re: Subclassing Seq objects from a string

Peter Cock <[email protected]> Wed, 24 May 2017 10:28:00 +0100
Newsgroups gmane.comp.python.bio.devel
Message-ID <CAKVJ-_6dCZY-UW9xPOCxAyfx81nBynsx6pWEkHwaNAB=HLOH1A@mail.gmail.com>
Hi Michiel,

I think we'd need to work on making the API more string like before it
would be practical to considering subclassing.

Would anyone like to make a list of all the string methods which we do not
currently implement, starting with replace (where dealing with the alphabet
is tricky if new letters are introduced)?

Then there is the translate method where we deliberately did not follow the
Python string method behaviour, but it would be possible to match it as a
special case where currently we issue an exception:

https://github.com/biopython/biopython/blob/biopython-169/Bio/Seq.py#L985

Peter




On Tue, May 23, 2017 at 2:32 AM, Michiel de Hoon <[email protected]>
wrote:

> Dear all,
>
> Ten years ago we talked about subclassing Seq objects from a string:
>
> [BioPython] Making the Seq object act more like a string
> <http://lists.open-bio.org/pipermail/biopython/2007-August/009867.html>
>
> [BioPython] Making the Seq object act more like a string
> <http://lists.open-bio.org/pipermail/biopython/2007-August/009867.html>
>
>
> Can we move forward?
> As the Seq documentation says, a Seq object is essentially a string with
> an alphabet.
> Then, following the object oriented programming paradigm, Seq objects
> should inherit from a string object.
>
> This would help with C extensions that take Seq or string objects as
> arguments (as both can then be treated as strings).
>
> Best,
> -Michiel
>
> _______________________________________________
> Biopython-dev mailing list
> [email protected]
> http://mailman.open-bio.org/mailman/listinfo/biopython-dev
>

_______________________________________________
Biopython-dev mailing list
[email protected]
http://mailman.open-bio.org/mailman/listinfo/biopython-dev