[BioPython] Rethinking Seq objects

Gavin Crooks GECrooks at lbl.gov
Thu May 5 14:35:19 EDT 2005



On May 5, 2005, at 00:30, Michiel Jan Laurens de Hoon wrote:

>
>> 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.
>
> There may be performance issues with this approach, if a Seq object is 
> mutated often. So let's wait and see if any of our users actually want 
> to mutate a sequence object, and if so, if the performance is 
> critical.

Performance would be no worse than for string manipulation in standard 
python. The Way of The Python is not to use MutableString's (Which are 
in the standard library, but not really canonical) but to split string 
into lists or arrays, do whatever manipulations are necessary and then 
join the string back together. Is there any reason why Seq's can't be 
mutated analogously?


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