52
52
# sequences may have a species
54
54
if( defined $seq->species ) {
55
print "Sequence is from ",$species->binomial_name," [",$species->common_name,"]\n";
55
print "Sequence is from ",$species->binomial," [",$species->common_name,"]\n";
58
58
# annotation objects are Bio::AnnotationCollectionI's
91
91
In Bioperl we have 3 main players that people are going to use frequently
93
93
Bio::PrimarySeq - just the sequence and its names, nothing else.
94
Bio::SeqFeatureI - a location on a sequence, potentially with a sequence
94
Bio::SeqFeatureI - a feature on a sequence, potentially with a sequence
95
and a location and annotation.
96
96
Bio::Seq - A sequence and a collection of sequence features
97
97
(an aggregate) with its own annotation.
412
412
Bioperl modules. Send your comments and suggestions preferably to one
413
413
of the Bioperl mailing lists. Your participation is much appreciated.
415
bioperl-l@bioperl.org - General discussion
416
http://bio.perl.org/MailList.html - About the mailing lists
415
bioperl-l@bioperl.org - General discussion
416
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
418
418
=head2 Reporting Bugs
420
420
Report bugs to the Bioperl bug tracking system to help us keep track
421
the bugs and their resolution. Bug reports can be submitted via email
421
the bugs and their resolution. Bug reports can be submitted via the
424
bioperl-bugs@bioperl.org
425
http://bugzilla.bioperl.org/
424
http://bugzilla.open-bio.org/
427
426
=head1 AUTHOR - Ewan Birney, inspired by Ian Korf objects
447
446
package Bio::Seq;
452
# Object preamble - inherits from Bio::Root::Object
456
449
use Bio::Annotation::Collection;
457
450
use Bio::PrimarySeq;
458
use Bio::IdentifiableI;
459
use Bio::DescribableI;
460
use Bio::AnnotatableI;
461
use Bio::FeatureHolderI;
464
@ISA = qw(Bio::Root::Root Bio::SeqI
465
Bio::IdentifiableI Bio::DescribableI
466
Bio::AnnotatableI Bio::FeatureHolderI);
452
use base qw(Bio::Root::Root Bio::SeqI Bio::IdentifiableI Bio::DescribableI Bio::AnnotatableI Bio::FeatureHolderI);
583
569
lead to an exception if passed to seq().
585
571
The implementation provided here does not take alphabet() into
586
account. Allowed are all letters (A-Z) and '-','.', and '*'.
572
account. Allowed are all letters (A-Z), '-','.','*','=', and '~'.
589
575
Returns : 1 if the supplied sequence string is valid for the object, and
722
708
For sequences with no natural id, this method should return
723
709
a stringified memory location.
725
Can also be used to set the primary_id.
727
Also notice that this method is not delegated to the
728
internal Bio::PrimarySeq object
711
Can also be used to set the primary_id (or unset to undef).
730
713
[Note this method name is likely to change in 1.3]
732
715
Example : $id = $seq->primary_id or $seq->primary_id($id)
733
716
Returns : A string
717
Args : None or an id, or undef to unset the primary id.
740
my ($obj,$value) = @_;
742
if( defined $value) {
743
$obj->{'primary_id'} = $value;
745
if( ! exists $obj->{'primary_id'} ) {
748
return $obj->{'primary_id'};
723
# Note: this used to not delegate to the primary seq. This is
724
# really bad in very subtle ways. E.g., if you created the object
725
# with a primary id given to the constructor and then later you
726
# change the primary id, if this method wouldn't delegate you'd
727
# have different values for primary id in the PrimarySeq object
728
# compared to this instance. Not good.
730
# I can't remember why not delegating was ever deemed
731
# advantageous, but I hereby claim that its problems far outweigh
732
# its advantages, if there are any. Convince me otherwise if you
733
# disagree. HL 2004/08/05
735
return shift->primary_seq->primary_id(@_);
751
738
=head2 can_call_new
782
769
Usage : if ( $obj->alphabet eq 'dna' ) { /Do Something/ }
783
Function: Returns the type of sequence being one of
770
Function: Get/Set the type of sequence being one of
784
771
'dna', 'rna' or 'protein'. This is case sensitive.
786
773
This is not called <type> because this would cause
938
925
=head2 annotation
940
927
Title : annotation
941
Usage : $ann = $seq->annotation or $seq->annotation($annotation)
928
Usage : $ann = $seq->annotation or
929
$seq->annotation($ann)
942
930
Function: Gets or sets the annotation
943
Returns : L<Bio::AnnotationCollectionI> object
944
Args : None or L<Bio::AnnotationCollectionI> object
931
Returns : Bio::AnnotationCollectionI object
932
Args : None or Bio::AnnotationCollectionI object
946
934
See L<Bio::AnnotationCollectionI> and L<Bio::Annotation::Collection>
947
935
for more information