[Biopython-dev] syntax of indices for future Alignment object

Jan Kosinski kosa at genesilico.pl
Fri Jul 27 10:13:24 EDT 2007


Hi,

Ok, I agree that [A:B][X:Y] syntax is not possible here. [A:B,X:Y] is 
fine. However, I would recommend not using [A:B:C,X:Y:Z] since it is not 
clear while the [A:B][X:Y] syntax is clear and sufficient.

We had another discussion in the lab about that Alignment object should 
not store records in the list but rather in a dictionary (but keeping 
information about sequence order ) or so.  What is you reasoning for 
making Alignment object a list of SeqRecord objects?
One should carefully think about design of the Alignment class since it 
will influence all further steps. As now the class is in its infancy 
there is a very good moment for thinking what the Alignment class is for 
and what it should support. 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 ?

Cheers,
Jan Kosinski


Peter wrote:
> Jan Kosinski wrote:
>> Hi,
>>
>>  From the viewpoint of the enduser we would like python Alignment object
>> to behave outside as an array so we could get slices, columns,
>> sequences, their fragments, whatever we want etc. The most intuitive and
>> clear (certainly much better than not very clear indexes like
>> [xxx:yyy:zzz]) for the  user is the following.
>>
>> [A:B][X:Y] - general syntax of indices. This supports almost everything.
>
> I think Michiel and I were suggesting [A:B,X:Y] or rather 
> [A:B:C,X:Y:Z] to be fully general, rather than [A:B][X:Y] or 
> [A:B:C][X:Y:Z]
>
> i.e. [arg1, arg2] rather than [arg1][arg2]
>
> This is an important point, as in the first case the __getitem__ 
> method of the alignment is called once (with both arguments). In the 
> second case, the __getitem__ method is called with arg1, and may 
> return a SeqRecord or an alignment - and this object's __getitem__ 
> method is called with arg2.
>
> As written, many of your cases appear to be impossible - but using the 
> [arg1,arg2] we can get close.
>
> I've got a working bit of code put together now which I'll attached to 
> bug 1944 soon.
>
> http://bugzilla.open-bio.org/show_bug.cgi?id=1944
>
> Peter
>
>
> :.
>


:.



More information about the Biopython-dev mailing list