3 # BioPerl module for Bio::SeqI
5 # Cared for by Ewan Birney <birney@ebi.ac.uk>
7 # Copyright Ewan Birney
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::SeqI [Developers] - Abstract Interface of Sequence (with features)
19 # Bio::SeqI is the interface class for sequences.
21 # If you are a newcomer to bioperl, you should
22 # start with Bio::Seq documentation. This
23 # documentation is mainly for developers using
26 # Bio::SeqI implements Bio::PrimarySeqI
27 $seq = $seqobj->seq(); # actual sequence as a string
28 $seqstr = $seqobj->subseq(10,50);
30 # Bio::SeqI has annotationcollections
32 $ann = $seqobj->annotation(); # annotation object
34 # Bio::SeqI has sequence features
35 # features must implement Bio::SeqFeatureI
37 @features = $seqobj->get_SeqFeatures(); # just top level
38 @features = $seqobj->get_all_SeqFeatures(); # descend into sub features
44 Bio::SeqI is the abstract interface of annotated Sequences. These
45 methods are those which you can be guarenteed to get for any Bio::SeqI
46 - for most users of the package the documentation (and methods) in
47 this class are not at useful - this is a developers only class which
48 defines what methods have to be implmented by other Perl objects to
49 comply to the Bio::SeqI interface. Go "perldoc Bio::Seq" or "man
50 Bio::Seq" for more information.
53 There aren't many here, because too many complicated functions here
54 prevent implementations which are just wrappers around a database or
55 similar delayed mechanisms.
57 Most of the clever stuff happens inside the SeqFeatureI system.
59 A good reference implementation is Bio::Seq which is a pure perl
60 implementation of this class with alot of extra pieces for extra
61 manipulation. However, if you want to be able to use any sequence
62 object in your analysis, if you can do it just using these methods,
63 then you know you will be future proof and compatible with other
64 implementations of Seq.
70 User feedback is an integral part of the evolution of this and other
71 Bioperl modules. Send your comments and suggestions preferably to one
72 of the Bioperl mailing lists. Your participation is much appreciated.
74 bioperl-l@bioperl.org - General discussion
75 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
79 Report bugs to the Bioperl bug tracking system to help us keep track
80 the bugs and their resolution. Bug reports can be submitted via the
83 http://bugzilla.open-bio.org/
85 =head1 AUTHOR - Ewan Birney
87 Email birney@ebi.ac.uk
92 The rest of the documentation details each of the object
93 methods. Internal methods are usually preceded with a _
98 # Let the code begin...
105 # Object preamble - inheriets from Bio::PrimarySeqI
107 use base
qw(Bio::PrimarySeqI Bio::AnnotatableI Bio::FeatureHolderI);
109 =head2 get_SeqFeatures
111 Title : get_SeqFeatures
112 Usage : my @feats = $seq->get_SeqFeatures();
113 Function: retrieve just the toplevel sequence features attached to this seq
114 Returns : array of Bio::SeqFeatureI objects
117 This method comes through extension of Bio::FeatureHolderI. See
118 L<Bio::FeatureHolderI> and L<Bio::SeqFeatureI> for more information.
122 =head2 get_all_SeqFeatures
124 Title : get_all_SeqFeatures
125 Usage : @features = $annseq->get_all_SeqFeatures()
126 Function: returns all SeqFeatures, included sub SeqFeatures
127 Returns : an array of Bio::SeqFeatureI objects
130 This method comes through extension of Bio::FeatureHolderI. See
131 L<Bio::FeatureHolderI> and L<Bio::SeqFeatureI> for more information.
137 Title : feature_count
138 Usage : $seq->feature_count()
139 Function: Return the number of SeqFeatures attached to a sequence
140 Returns : integer representing the number of SeqFeatures
143 This method comes through extension of Bio::FeatureHolderI. See
144 L<Bio::FeatureHolderI> for more information.
151 Usage : my $string = $seq->seq();
152 Function: Retrieves the sequence string for the sequence object
161 $self->throw_not_implemented();
167 Usage : $seq->write_GFF(\*FILEHANDLE);
168 Function: Convience method to write out all the sequence features
169 in GFF format to the provided filehandle (STDOUT by default)
171 Args : [optional] filehandle to write to (default is STDOUT)
179 $fh || do { $fh = \
*STDOUT
; };
181 foreach my $sf ( $self->get_all_SeqFeatures() ) {
182 print $fh $sf->gff_string, "\n";
190 Usage : $obj->annotation($seq_obj)
191 Function: retrieve the attached annotation object
192 Returns : Bio::AnnotationCollectionI or none;
194 See L<Bio::AnnotationCollectionI> and L<Bio::Annotation::Collection>
195 for more information. This method comes through extension from
196 L<Bio::AnnotatableI>.
204 Function: Gets or sets the species
205 Example : $species = $self->species();
206 Returns : Bio::Species object
207 Args : Bio::Species object or none;
209 See L<Bio::Species> for more information
215 $self->throw_not_implemented();
221 Usage : $obj->primary_seq($newval)
222 Function: Retrieve the underlying Bio::PrimarySeqI object if available.
223 This is in the event one has a sequence with lots of features
224 but want to be able to narrow the object to just one with
225 the basics of a sequence (no features or annotations).
226 Returns : Bio::PrimarySeqI
227 Args : Bio::PrimarySeqI or none;
229 See L<Bio::PrimarySeqI> for more information
235 $self->throw_not_implemented;