[Bioperl-l] Bio::Seq->delete_SeqFeature missing?

Hilmar Lapp hilmarl@yahoo.com
Thu, 10 May 2001 00:15:12 -0700


Malcolm Cook wrote:
> 
> Ewan, before I got your advice, I wrote, modelled on add_SeqFeature, the
> following:
> 
> =head2 delete_SeqFeature
> 
>  Title   : delete_SeqFeature - THIS METHOD SEEMS MISSING FROM BIO::SEQ!
>  Usage   : $seq->delete_SeqFeature($feat);
>            $seq->delete_SeqFeature(@feat);
> 
>  Function: Deletes the given feature object (or each of an array of feature
>  objects) from the feature array of this sequence. The object passed is
>  required to implement the Bio::SeqFeatureI interface.
> 

I agree with Ewan. The implementation works, but it needs to pull
out every feature anyway and also rebuilds the array. If you have
your own way of screening features by some property, this is even
inefficient. I think the easiest and as compared to other modules
most 'standard' way is to flush them all using flush_SeqFeature()
(which has to be added) and then re-add as you want. So, e.g. if
you're screening for primary tag, the code becomes

my @feat = $seq->all_SeqFeature();
$seq->flush_SeqFeature();
$seq->add_SeqFeature((grep { $_->primary_tag() eq "some_tag"; }
@feat));

	Hilmar

-- 
-----------------------------------------------------------------
Hilmar Lapp                              email: hilmarl@yahoo.com
GNF, San Diego, Ca. 92122                phone: +1 858 812 1757
-----------------------------------------------------------------