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

Malcolm Cook Malcolm.Cook@ppgx.com
Thu, 10 May 2001 09:27:02 -0700

Hilmar & Ewan,

I'm converted.  Thanks for the discussion.

If I wanted a new Bio::Seq identical in all respects to one at hand, say
held in $oldseq, would I write:

	my $newseq = $oldseq->new;

Or do I have to create it as:
	my $newseq = Bio::Seq->new;
and then copy attributes one at a time from $oldseq, as:
	$newseq->source = $oldseq->source;


And, does flush_SeqFeature simply become the following?

=head2 flush_SeqFeature

 Usage   : $seq->flush_SeqFeature();

 Function: Removes all features from the sequence

 Example :
 Returns : TRUE on success
 Args    : none


sub Bio::Seq::flush_SeqFeature {
  my ($self) = @_;
  $self->{'_as_feat'} = [];
  return 1;



>-----Original Message-----
>From: bioperl-l-admin@bioperl.org [mailto:bioperl-l-admin@bioperl.org]On
>Behalf Of Hilmar Lapp
>Sent: Thursday, May 10, 2001 12:15 AM
>To: Malcolm Cook
>Cc: Ewan Birney; Bioperl
>Subject: Re: [Bioperl-l] Bio::Seq->delete_SeqFeature missing?
>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->add_SeqFeature((grep { $_->primary_tag() eq "some_tag"; }
>	Hilmar
>Hilmar Lapp                              email: hilmarl@yahoo.com
>GNF, San Diego, Ca. 92122                phone: +1 858 812 1757
>Bioperl-l mailing list