[Bioperl-l] Adapt source method in Bio::SeqFeature::Annotated

Allen Day allenday at ucla.edu
Mon Nov 1 13:17:45 EST 2004


are you a cvs user now?  if so, you can commit this in directly.

-allen


On Mon, 1 Nov 2004, Steffen Grossmann wrote:

> Dear all,
> 
> as a follow up to my last message (http://bioperl.org/pipermail/bioperl-l/2004-October/017178.html), I propose to adapt the 'source' method 
> in Bio::SeqFeature:.Annotated on order to make it use the annotation system. This is merely for convenience, but also helps avoiding trouble 
> by using different places to store a 'source' annotation.
> 
> I provide a patch below.
> 
> Steffen
> 
> 
> 
> Bio_SeqFeature_Annotated.diff
> ---8<---8<---8<---8<---8<---8<---8<---8<---cut here
> *** bioperl-live/Bio/SeqFeature/Annotated.pm    Mon Oct 25 11:08:25 2004
> --- modified_bioperl-live/Bio/SeqFeature/Annotated.pm   Mon Nov  1 09:06:09 2004
> ***************
> *** 347,355 ****
> 
>    sub source {
>      my $self = shift;
> 
> !   return $self->{'source'} = shift if @_;
> !   return $self->{'source'};
>    }
> 
> 
> --- 347,367 ----
> 
>    sub source {
>      my $self = shift;
> +   my $source = shift;
> 
> !   if ($source) {
> !       $self->annotation->remove_Annotations('source');
> !       $self->annotation->add_Annotation(Bio::Annotation::SimpleValue->new(-value => $source,
> !                                                                         -tagname => 'source')
> !                                      );
> !   } else {
> !       if (my ($sa) = $self->annotation->get_Annotations('source')) {
> !         $source = $sa->value;
> !       } else {
> !         $source = "";
> !       }
> !   }
> !   return $source;
>    }
> 
> 
> ---8<---8<---8<---8<---8<---8<---8<---8<---cut here
> 
> 
> 


More information about the Bioperl-l mailing list