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

Steffen Grossmann grossman at molgen.mpg.de
Mon Nov 1 03:19:11 EST 2004


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


-- 
%---------------------------------------------%
%            Steffen Grossmann                %
%                                             %
% Max Planck Institute for Molecular Genetics %
%      Computational Molecular Biology        %
%---------------------------------------------%
%              Ihnestrasse 73                 %
%               14195 Berlin                  %
%                 Germany                     %
%---------------------------------------------%
%         Tel: (++49 +30) 8413-1167           %
%         Fax: (++49 +30) 8413-1152           %
%---------------------------------------------%




_______________________________________________
Bioperl-l mailing list
Bioperl-l at portal.open-bio.org
http://portal.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list