[Biopython-dev] Subclassing Seq objects from a string

Peter Cock p.j.a.cock at googlemail.com
Wed May 24 09:28:00 UTC 2017


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 <mjldehoon at yahoo.com>
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
> Biopython-dev at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython-dev/attachments/20170524/19950952/attachment.html>


More information about the Biopython-dev mailing list