FAST/Bio/SeqI.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 30 SCAR 6.9
CC
1
Cov
0%
seq
2.0
write_GFF
2.0
species
2.0
CRAP 2.0
1 #
2 # BioPerl module for FAST::Bio::SeqI
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Ewan Birney <birney@ebi.ac.uk>
7 #
8 # Copyright Ewan Birney
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 =head1 NAME
15  
16 FAST::Bio::SeqI - [Developers] Abstract Interface of Sequence (with features)
17  
18 =head1 SYNOPSIS
19  
20 # FAST::Bio::SeqI is the interface class for sequences.
21  
22 # If you are a newcomer to bioperl, you should
23 # start with FAST::Bio::Seq documentation. This
24 # documentation is mainly for developers using
25 # Bioperl.
26  
27 # FAST::Bio::SeqI implements FAST::Bio::PrimarySeqI
28 $seq = $seqobj->seq(); # actual sequence as a string
29 $seqstr = $seqobj->subseq(10,50);
30  
31 # FAST::Bio::SeqI has annotationcollections
32  
33 $ann = $seqobj->annotation(); # annotation object
34  
35 # FAST::Bio::SeqI has sequence features
36 # features must implement FAST::Bio::SeqFeatureI
37  
38 @features = $seqobj->get_SeqFeatures(); # just top level
39 @features = $seqobj->get_all_SeqFeatures(); # descend into sub features
40  
41  
42  
43 =head1 DESCRIPTION
44  
45 FAST::Bio::SeqI is the abstract interface of annotated Sequences. These
46 methods are those which you can be guarenteed to get for any FAST::Bio::SeqI
47 - for most users of the package the documentation (and methods) in
48 this class are not at useful - this is a developers only class which
49 defines what methods have to be implmented by other Perl objects to
50 comply to the FAST::Bio::SeqI interface. Go "perldoc FAST::Bio::Seq" or "man
51 FAST::Bio::Seq" for more information.
52  
53  
54 There aren't many here, because too many complicated functions here
55 prevent implementations which are just wrappers around a database or
56 similar delayed mechanisms.
57  
58 Most of the clever stuff happens inside the SeqFeatureI system.
59  
60 A good reference implementation is FAST::Bio::Seq which is a pure perl
61 implementation of this class with a lot of extra pieces for extra
62 manipulation. However, if you want to be able to use any sequence
63 object in your analysis, if you can do it just using these methods,
64 then you know you will be future proof and compatible with other
65 implementations of Seq.
66  
67 =head1 FEEDBACK
68  
69 =head2 Mailing Lists
70  
71 User feedback is an integral part of the evolution of this and other
72 Bioperl modules. Send your comments and suggestions preferably to one
73 of the Bioperl mailing lists. Your participation is much appreciated.
74  
75 bioperl-l@bioperl.org - General discussion
76 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
77  
78 =head2 Support
79  
80 Please direct usage questions or support issues to the mailing list:
81  
82 I<bioperl-l@bioperl.org>
83  
84 rather than to the module maintainer directly. Many experienced and
85 reponsive experts will be able look at the problem and quickly
86 address it. Please include a thorough description of the problem
87 with code and data examples if at all possible.
88  
89 =head2 Reporting Bugs
90  
91 Report bugs to the Bioperl bug tracking system to help us keep track
92 the bugs and their resolution. Bug reports can be submitted via the
93 web:
94  
95 https://redmine.open-bio.org/projects/bioperl/
96  
97 =head1 AUTHOR - Ewan Birney
98  
99 Email birney@ebi.ac.uk
100  
101  
102 =head1 APPENDIX
103  
104 The rest of the documentation details each of the object
105 methods. Internal methods are usually preceded with a _
106  
107 =cut
108  
109 #'
110 # Let the code begin...
111  
112  
113 package FAST::Bio::SeqI;
114 use strict;
115  
116  
117 # Object preamble - inheriets from FAST::Bio::PrimarySeqI
118  
119 use base qw(FAST::Bio::PrimarySeqI FAST::Bio::AnnotatableI FAST::Bio::FeatureHolderI);
120  
121 =head2 get_SeqFeatures
122  
123 Title : get_SeqFeatures
124 Usage : my @feats = $seq->get_SeqFeatures();
125 Function: retrieve just the toplevel sequence features attached to this seq
126 Returns : array of FAST::Bio::SeqFeatureI objects
127 Args : none
128  
129 This method comes through extension of FAST::Bio::FeatureHolderI. See
130 L<FAST::Bio::FeatureHolderI> and L<FAST::Bio::SeqFeatureI> for more information.
131  
132 =cut
133  
134 =head2 get_all_SeqFeatures
135  
136 Title : get_all_SeqFeatures
137 Usage : @features = $annseq->get_all_SeqFeatures()
138 Function: returns all SeqFeatures, included sub SeqFeatures
139 Returns : an array of FAST::Bio::SeqFeatureI objects
140 Args : none
141  
142 This method comes through extension of FAST::Bio::FeatureHolderI. See
143 L<FAST::Bio::FeatureHolderI> and L<FAST::Bio::SeqFeatureI> for more information.
144  
145 =cut
146  
147 =head2 feature_count
148  
149 Title : feature_count
150 Usage : $seq->feature_count()
151 Function: Return the number of SeqFeatures attached to a sequence
152 Returns : integer representing the number of SeqFeatures
153 Args : none
154  
155 This method comes through extension of FAST::Bio::FeatureHolderI. See
156 L<FAST::Bio::FeatureHolderI> for more information.
157  
158 =cut
159  
160 =head2 seq
161  
162 Title : seq
163 Usage : my $string = $seq->seq();
164 Function: Retrieves the sequence string for the sequence object
165 Returns : string
166 Args : none
167  
168  
169 =cut
170  
171 sub seq{
172 my ($self) = @_;
173 $self->throw_not_implemented();
174 }
175  
176 =head2 write_GFF
177  
178 Title : write_GFF
179 Usage : $seq->write_GFF(\*FILEHANDLE);
180 Function: Convience method to write out all the sequence features
181 in GFF format to the provided filehandle (STDOUT by default)
182 Returns : none
183 Args : [optional] filehandle to write to (default is STDOUT)
184  
185  
186 =cut
187  
188 sub write_GFF{
189 my ($self,$fh) = @_;
190  
191 $fh || do { $fh = \*STDOUT; };
192  
193 foreach my $sf ( $self->get_all_SeqFeatures() ) {
194 print $fh $sf->gff_string, "\n";
195 }
196  
197 }
198  
199 =head2 annotation
200  
201 Title : annotation
202 Usage : $obj->annotation($seq_obj)
203 Function: retrieve the attached annotation object
204 Returns : FAST::Bio::AnnotationCollectionI or none;
205  
206 See L<FAST::Bio::AnnotationCollectionI> and L<FAST::Bio::Annotation::Collection>
207 for more information. This method comes through extension from
208 L<FAST::Bio::AnnotatableI>.
209  
210 =cut
211  
212 =head2 species
213  
214 Title : species
215 Usage :
216 Function: Gets or sets the species
217 Example : $species = $self->species();
218 Returns : FAST::Bio::Species object
219 Args : FAST::Bio::Species object or none;
220  
221 See L<FAST::Bio::Species> for more information
222  
223 =cut
224  
225 sub species {
226 my ($self) = @_;
227 $self->throw_not_implemented();
228 }
229  
230 =head2 primary_seq
231  
232 Title : primary_seq
233 Usage : $obj->primary_seq($newval)
234 Function: Retrieve the underlying FAST::Bio::PrimarySeqI object if available.
235 This is in the event one has a sequence with lots of features
236 but want to be able to narrow the object to just one with
237 the basics of a sequence (no features or annotations).
238 Returns : FAST::Bio::PrimarySeqI
239 Args : FAST::Bio::PrimarySeqI or none;
240  
241 See L<FAST::Bio::PrimarySeqI> for more information
242  
243 =cut
244  
245 sub primary_seq {
246 my ($self) = @_;
247 $self->throw_not_implemented;
248 }
249  
250 1;