[BioPython] about the SeqRecord slicing

Jose Blanca jblanca at btc.upv.es
Thu Mar 26 11:48:02 UTC 2009


Hi:
I'm working with the SeqRecord slicing from cvs and I think that the behaviour 
could be sligthly changed. In fact that same opinion is written in the 
__getitem__ method:

        if isinstance(index, int) :
            #NOTE - The sequence level annotation like the id, name, etc
            #do not really apply to a single character.  However, should
            #we try and expose any per-letter-annotation here?  If so how?
            return self.seq[index]

I don't like the fact that the SeqRecord returns different classes depending 
on the index type. I think is better to return always a SeqRecord because:
- It simplifies the interface. It's easier to deal with the SeqRecord class if 
its behaviour is simple. Otherwise we have to check in the code that uses the 
SeqRecord if it's returning an str or a SeqRecord.
- It looses the per-letter-annotation. I'm working with qualities and I'm 
interested in keeping them.
- It's redundant because if we want to slice the seq property we can do it 
with: seqrec.seq[index]
Best regards,

-- 
Jose M. Blanca Postigo
Instituto Universitario de Conservacion y
Mejora de la Agrodiversidad Valenciana (COMAV)
Universidad Politecnica de Valencia (UPV)
Edificio CPI (Ciudad Politecnica de la Innovacion), 8E
46022 Valencia (SPAIN)
Tlf.:+34-96-3877000 (ext 88473)



More information about the Biopython mailing list