[Biopython-dev] [BioPython] about the SeqRecord slicing

Peter biopython at maubp.freeserve.co.uk
Fri Mar 27 09:57:30 EDT 2009


On Fri, Mar 27, 2009 at 1:31 PM, Sebastian Bassi wrote:
> I think is up to the user to keep updated the id/name/descripption
> field when slicing a sequence.

If you make a new SeqRecord by first slicing a Seq object (which is
how you have to do it with Biopython 1.49 or older), then dealing
with ALL the annotation is explicitly in the hands of the user.

Or are you saying when slicing a SeqRecord you wouldn't expect
the id/name/description to be preserved for the sub-record?

> .....
>> I would be OK with dropping the contents of the annotations
>> dictionary and description is order to avoid ambiguity, but
>> this would prevent certain tasks.
>
> Another option is to make this behavior optional (I mean, select to
> keep or to drop the annotations, but default I would drop them).

How would you make it optional?  As an extra non-standard argument
to __getitem__?  e.g.something like my_record[10:50, annotation=False]?
That seems nasty.

I am sympathetic to dropping the annotations dictionary when creating
a "child" SeqRecord when slicing its parent.  There is also the database
cross reference list (which i forgot on my last email).  Again, I wouldn't
object to dropping this for a sliced sub-record.

If we did drop the annotations and dbxrefs when slicing, the user can
manually choose to explicitly copy them from the parent object if the
do want them.

Peter


More information about the Biopython-dev mailing list