Skip to content

Commit

Permalink
Bio::SimpleAlign compliance with Bio::FeatureHolderI
Browse files Browse the repository at this point in the history
  • Loading branch information
fangly committed Mar 7, 2012
1 parent a5bebe0 commit 29e0449
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions Bio/SimpleAlign.pm
Expand Up @@ -3046,29 +3046,43 @@ sub get_SeqFeatures {
return @{$self->{'_as_feat'}};
}


=head2 add_SeqFeature
Usage : $aln->add_SeqFeature($subfeat);
Function: adds a SeqFeature into the SeqFeature array.
Function: Adds a SeqFeature into the SeqFeature array. The 'EXPAND' qualifier
(see L<Bio::FeatureHolderI>) is supported, but has no effect.
Example :
Returns : true on success
Args : a Bio::SeqFeatureI object
Note : This implementation is not compliant
with Bio::FeatureHolderI
=cut

sub add_SeqFeature {
my ($self,@feat) = @_;
my ($self, @feat) = @_;

$self->{'_as_feat'} = [] unless $self->{'_as_feat'};

foreach my $feat ( @feat ) {
if (scalar @feat > 1) {
$self->deprecated(
-message => 'Providing an array of features to Bio::SimpleAlign add_SeqFeature()'.
' is deprecated and will be removed in a future version. '.
'Add a single feature at a time instead.',
### -warn_version => 1.007,
### -throw_version => 1.009,
-throw_version => 1.005,
);
}

for my $feat ( @feat ) {

next if $feat eq 'EXPAND'; # Need to support it for FeatureHolderI compliance

if( !$feat->isa("Bio::SeqFeatureI") ) {
$self->throw("$feat is not a SeqFeatureI and that's what we expect...");
$self->throw("Expected a Bio::SeqFeatureI object, but got a $feat.");
}

push(@{$self->{'_as_feat'}},$feat);
push @{$self->{'_as_feat'}}, $feat;
}
return 1;
}
Expand Down

0 comments on commit 29e0449

Please sign in to comment.