[BioPython] Rethinking Seq objects

Gavin Crooks GECrooks at lbl.gov
Wed May 4 12:37:18 EDT 2005


On May 2, 2005, at 23:45, Michiel Jan Laurens de Hoon wrote:
> 1) Make Seq objects mutable, and get rid of MutableSeq. The Seq class 
> and the MutableSeq class basically describe the same thing, except 
> that one is read-only and the other one is not. If desired, we can add 
> a readonly flag to the class to describe if it is mutable or not. 
> (Given that e.g. Numerical Python arrays don't have such a flag, my 
> feeling is that it is not really needed for Seq objects either). For 
> performance reasons, the new Seq class will be implemented in C.
>

Although I agree that we don't need a Seq and a MutableSeq class, I 
don't follow why we need a mutable sequence class at all. What's the 
use case?

If, in the alternative, Seq was a simple immutable object then it could 
be implemented as a light weight subclass of str, with an alphabet 
attribute that is also a subclass of str. You'd edit it like you would 
edit any string in python;  split it into a list, do whatever 
manipulations are necessary, and then join the list back together into 
a new Seq.



Gavin Crooks


--
Gavin E. Crooks
Divisional Fellow                    tel:  (510) 486-7721
Physical Biosciences                 aim:notastring
Lawrence Berkeley Natl. Lab          http://threeplusone.com/
Berkeley, CA 94720, USA              GECrooks at lbl.gov



More information about the BioPython mailing list