[Biopython-dev] Improving the Alignment object

Michiel de Hoon mdehoon at c2b2.columbia.edu
Sat Jul 28 00:20:24 EDT 2007


Peter wrote:
>> For instance, the Alignment object should
>> support changing characters in the alignment without a need of copying 
>> it (using  aln[a,x] = "D"). Can it be done now with Alignment which is 
>> a list of SeqRecord objects with sequences implemented as immutable Seq 
>> objects ?
> 
....
> 
> To me the obvious way to handle this is to have a MutableAlignment 
> sub-class, where editing individual elements with aln[r,c] = "D" would 
> be supported (possibly implemented using the MutableSeq class internally 
> rather than the immutable Seq class).
> 
I don't think we'd need a separate MutableAlignment for that. An 
Alignment is a list of sequences and is therefore mutable. If we add a 
__setitem__ method to the Alignment class, then this method can take 
care of constructing a new sequence and put it in the appropriate row.

--Michiel.


More information about the Biopython-dev mailing list