Bio::Seq RichSeq
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::Seq::RichSeq - Module implementing a sequence created from a rich
sequence database entry
Package variables
No package variables defined.
Included modules
Bio::Seq
Bio::Seq::RichSeqI
Inherit
Bio::Seq Bio::Seq::RichSeqI
Synopsis
See Bio::Seq::RichSeqI and documentation of methods.
Description
This module implements Bio::Seq::RichSeqI, an interface for sequences
created from or created for entries from/of rich sequence databanks,
like EMBL, GenBank, and SwissProt. Methods added to the Bio::SeqI
interface therefore focus on databank-specific information. Note that
not every rich databank format may use all of the properties provided.
Methods
newDescriptionCode
divisionDescriptionCode
moleculeDescriptionCode
add_dateDescriptionCode
get_datesDescriptionCode
pidDescriptionCode
accessionDescriptionCode
add_secondary_accessionDescriptionCode
get_secondary_accessionsDescriptionCode
seq_versionDescriptionCode
add_keywordDescriptionCode
get_keywordsDescriptionCode
_add_annotation_valueDescriptionCode
_get_annotation_valuesDescriptionCode
keywords
No description
Code
each_date
No description
Code
each_secondary_accession
No description
Code
sv
No description
Code
Methods description
newcode    nextTop
 Title   : new
 Usage   : $seq    = Bio::Seq::RichSeq->new( -seq => 'ATGGGGGTGGTGGTACCCT',
                                             -id  => 'human_id',
				             -accession_number => 'AL000012',
				            );

 Function: Returns a new seq object from
           basic constructors, being a string for the sequence
           and strings for id and accession_number
 Returns : a new Bio::Seq::RichSeq object
divisioncodeprevnextTop
 Title   : division
 Usage   : $obj->division($newval)
 Function: 
 Returns : value of division
 Args    : newvalue (optional)
moleculecodeprevnextTop
 Title   : molecule
 Usage   : $obj->molecule($newval)
 Function: 
 Returns : type of molecule (DNA, mRNA)
 Args    : newvalue (optional)
add_datecodeprevnextTop
 Title   : add_date
 Usage   : $self->add_date($datestr)
 Function: adds one or more dates

           This implementation stores dates as keyed annotation, the
           key being 'date_changed'. You can take advantage of this
           fact when accessing the annotation collection directly.

 Example :
 Returns : 
 Args    : a date string or an array of such strings
get_datescodeprevnextTop
 Title   : get_dates
 Usage   : my @dates = $seq->get_dates;
 Function: Get the dates of the sequence (usually, when it was created and
           changed.
 Returns : an array of date strings
 Args    :
pidcodeprevnextTop
 Title   : pid
 Usage   : my $pid = $seq->pid();
 Function: Get (and set, depending on the implementation) the PID property
           for the sequence.
 Returns : a string
 Args    :
accessioncodeprevnextTop
 Title   : accession
 Usage   : $obj->accession($newval)
 Function: Whilst the underlying sequence object does not 
           have an accession, so we need one here.

           In this implementation this is merely a synonym for
           accession_number().
 Example : 
 Returns : value of accession
 Args    : newvalue (optional)
add_secondary_accessioncodeprevnextTop
 Title   : add_secondary_accession
 Usage   : $self->add_domment($ref)
 Function: adds a secondary_accession

           This implementation stores secondary accession numbers as
           keyed annotation, the key being 'secondary_accession'. You
           can take advantage of this fact when accessing the
           annotation collection directly.

 Example :
 Returns : 
 Args    : a string or an array of strings
get_secondary_accessionscodeprevnextTop
 Title   : get_secondary_accessions
 Usage   : my @acc = $seq->get_secondary_accessions();
 Function: Get the secondary accession numbers as strings.
 Returns : An array of strings
 Args    : none
seq_versioncodeprevnextTop
 Title   : seq_version
 Usage   : $obj->seq_version($newval)
 Function: Get/set the sequence version
 Returns : value of seq_version (a scalar)
 Args    : on set, new value (a scalar or undef, optional)
add_keywordcodeprevnextTop
 Title   : add_keyword
 Usage   : $obj->add_keyword($newval)
 Function: Add a new keyword to the annotation of the sequence.

           This implementation stores keywords as keyed annotation,
           the key being 'keyword'. You can take advantage of this
           fact when accessing the annotation collection directly.

 Returns : 
 Args    : value to be added (optional) (a string)
get_keywordscodeprevnextTop
 Title   : get_keywords
 Usage   : $obj->get_keywords($newval)
 Function: Get the keywords for this sequence as an array of strings.
 Returns : an array of strings
 Args    :
_add_annotation_valuecodeprevnextTop
 Title   : _add_annotation_value
 Usage   :
 Function: Adds a value to the annotation collection under the specified
           key. Note that this is not a public method.
 Returns : 
 Args    : key (a string), value(s) (one or more scalars)
_get_annotation_valuescodeprevnextTop
 Title   : _get_annotation_values
 Usage   :
 Function: Gets the values of a specific annotation as identified by the
           key from the annotation collection. Note that this is not a
           public method.
 Example :
 Returns : an array of strings
 Args    : the key (a string)
Methods code
newdescriptionprevnextTop
sub new {
    # standard new call..
my($caller,@args) = @_; my $self = $caller->SUPER::new(@args); $self->{'_dates'} = []; $self->{'_secondary_accession'} = []; my ($dates, $xtra, $sv, $keywords, $pid, $mol, $division ) = $self->_rearrange([qw(DATES SECONDARY_ACCESSIONS SEQ_VERSION KEYWORDS PID MOLECULE DIVISION )], @args); defined $division && $self->division($division); defined $mol && $self->molecule($mol); if(defined($keywords)) { if(ref($keywords) && (ref($keywords) eq "ARRAY")) { $self->add_keyword(@$keywords); } else { # got a string - use the old API
$self->keywords($keywords); } } defined $sv && $self->seq_version($sv); defined $pid && $self->pid($pid); if( defined $dates ) { if( ref($dates) eq "ARRAY" ) { foreach ( @$dates) { $self->add_date($_); } } else { $self->add_date($dates); } } if( defined $xtra ) { if( ref($xtra) eq "ARRAY" ) { foreach ( @$xtra) { $self->add_secondary_accession($_); } } else { $self->add_secondary_accession($xtra); } } return $self;
}
divisiondescriptionprevnextTop
sub division {
   my $obj = shift;
   if( @_ ) {
      my $value = shift;
      $obj->{'_division'} = $value;
    }
    return $obj->{'_division'};
}
moleculedescriptionprevnextTop
sub molecule {
   my $obj = shift;
   if( @_ ) {
      my $value = shift;
      $obj->{'_molecule'} = $value;
    }
    return $obj->{'_molecule'};
}
add_datedescriptionprevnextTop
sub add_date {
    return shift->_add_annotation_value('date_changed',@_);
}
get_datesdescriptionprevnextTop
sub get_dates {
    return shift->_get_annotation_values('date_changed');
}
piddescriptionprevnextTop
sub pid {
    my $self = shift;

    return $self->{'_pid'} = shift if @_;
    return $self->{'_pid'};
}
accessiondescriptionprevnextTop
sub accession {
   my ($obj,@args) = @_;
   return $obj->accession_number(@args);
}
add_secondary_accessiondescriptionprevnextTop
sub add_secondary_accession {
    return shift->_add_annotation_value('secondary_accession',@_);
}
get_secondary_accessionsdescriptionprevnextTop
sub get_secondary_accessions {
    return shift->_get_annotation_values('secondary_accession');
}
seq_versiondescriptionprevnextTop
sub seq_version {
    my $self = shift;

    return $self->{'_seq_version'} = shift if @_;
    return $self->{'_seq_version'};
}
add_keyworddescriptionprevnextTop
sub add_keyword {
    return shift->_add_annotation_value('keyword',@_);
}
get_keywordsdescriptionprevnextTop
sub get_keywords {
    return shift->_get_annotation_values('keyword');
}
_add_annotation_valuedescriptionprevnextTop
sub _add_annotation_value {
    my $self = shift;
    my $key  = shift;

    foreach my $val (@_) {
	$self->annotation->add_Annotation(
			Bio::Annotation::SimpleValue->new(-tagname => $key,
							  -value => $val)
					  );
    }
}
_get_annotation_valuesdescriptionprevnextTop
sub _get_annotation_values {
    my $self = shift;

    return map { $_->value(); } $self->annotation->get_Annotations(shift);
}
keywordsdescriptionprevnextTop
sub keywords {
    my $self = shift;

    # have we been called in set mode?
if(@_) { # yes; translate to the new API
foreach my $kwd (@_) { $self->add_keyword(split(/\s*;\s*/,$kwd)); } } else { # no; translate read-only to the new API
return join("; ",$self->get_keywords()); }
}
each_datedescriptionprevnextTop
sub each_date {
   my ($self) = @_;
   $self->warn("Deprecated method... please use get_dates");
   return $self->get_dates;
}
each_secondary_accessiondescriptionprevnextTop
sub each_secondary_accession {
   my ($self) = @_;
   $self->warn("each_secondary_accession - deprecated method. use get_secondary_accessions");
   return $self->get_secondary_accessions;
}
svdescriptionprevnextTop
sub sv {
   my ($obj,$value) = @_;
   $obj->warn("sv - deprecated method. use seq_version");
   $obj->seq_version($value);
}
General documentation
Implemented InterfacesTop
This class implementes the following interfaces.
    Bio::Seq::RichSeqI
    Note that this includes implementing Bio::PrimarySeqI and Bio::SeqI.
    Bio::IdentifiableI
    Bio::DescribableI
    Bio::AnnotatableI
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this
and other Bioperl modules. Send your comments and suggestions preferably
to one of the Bioperl mailing lists.
Your participation is much appreciated.
  bioperl-l@bioperl.org                 - General discussion
  http://bio.perl.org/MailList.html             - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution.
Bug reports can be submitted via email or the web:
  bioperl-bugs@bio.perl.org
  http://bugzilla.bioperl.org/
AUTHOR - Ewan BirneyTop
Email birney@ebi.ac.uk
Describe contact details here
APPENDIXTop
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
Private methods and synonyms for backward compatibilityTop