FAST/Bio/MySeqI.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 63 CC 1 SCAR 6.9
CC
1
Cov
0%
_abstractDeath
2.0
top_SeqFeatures
2.0
all_SeqFeatures
2.0
CRAP 2.0
1  
2 #
3 # BioPerl module for FAST::Bio::SeqI
4 #
5 # Cared for by Ewan Birney <birney@sanger.ac.uk>
6 #
7 # Copyright Ewan Birney
8 #
9 # You may distribute this module under the same terms as perl itself
10  
11 # POD documentation - main docs before the code
12  
13 =head1 NAME
14  
15 FAST::Bio::SeqI - Abstract Interface of Sequence (with features)
16  
17 =head1 SYNOPSIS
18  
19 # get a FAST::Bio::SeqI somehow, eg, via SeqIO. See SeqIO info
20 # for more information
21  
22 $seqio = FAST::Bio::SeqIO->new ( '-format' => 'Fasta' , -file => 'myfile.fasta');
23 $seqobj = $seqio->next_seq();
24  
25 # features must implement FAST::Bio::SeqFeatureI
26  
27 @features = $seqobj->top_SeqFeatures(); # just top level
28 @features = $seqobj->all_SeqFeatures(); # descend into sub features
29  
30 $seq = $seqobj->seq(); # actual sequence as a string
31 $seqstr = $seqobj->subseq(10,50);
32 $ann = $seqobj->annotation(); # annotation object
33  
34 =head1 DESCRIPTION
35  
36 SeqI is the abstract interface of annotated Sequence. These methods
37 are those which you can be guarenteed to get for any annseq. There aren't
38 many here, because too many complicated functions here prevent implementations
39 which are just wrappers around a database or similar delayed mechanisms.
40  
41 Most of the clever stuff happens inside the SeqFeatureI system.
42  
43 A good reference implementation is FAST::Bio::Seq which is a pure perl
44 implementation of this class with alot of extra pieces for extra
45 manipulation. However, if you want to be able to use any sequence
46 object in your analysis, if you can do it just using these methods,
47 then you know you will be future proof and compatible with other
48 implementations of Seq.
49  
50 =head1 FEEDBACK
51  
52 =head2 Mailing Lists
53  
54 User feedback is an integral part of the evolution of this and other
55 Bioperl modules. Send your comments and suggestions preferably to one
56 of the Bioperl mailing lists. Your participation is much appreciated.
57  
58 bioperl-l@bioperl.org - General discussion
59 http://bio.perl.org/MailList.html - About the mailing lists
60  
61 =head2 Reporting Bugs
62  
63 Report bugs to the Bioperl bug tracking system to help us keep track
64 the bugs and their resolution. Bug reports can be submitted via email
65 or the web:
66  
67 bioperl-bugs@bio.perl.org
68 http://bio.perl.org/bioperl-bugs/
69  
70 =head1 AUTHOR - Ewan Birney
71  
72 Email birney@sanger.ac.uk
73  
74  
75 =head1 APPENDIX
76  
77 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
78  
79 =cut
80  
81 #'
82 # Let the code begin...
83  
84 package FAST::Bio::MySeqI;
85 use vars qw(@ISA);
86 use FAST::Bio::MyPrimarySeqI;
87 use strict;
88 use Carp;
89  
90 # Object preamble - inheriets from FAST::Bio::Root::Object
91  
92 @ISA = qw(FAST::Bio::MyPrimarySeqI);
93  
94 sub _abstractDeath {
95 my $self = shift;
96 my $package = ref $self;
97 my $caller = (caller)[1];
98
99 confess "Abstract method '$caller' defined in interface FAST::Bio::SeqI not implemented by pacakge $package. Not your fault - author of $package should be blamed!";
100 }
101  
102 =head2 top_SeqFeatures
103  
104 Title : top_SeqFeatures
105 Usage :
106 Function:
107 Example :
108 Returns :
109 Args :
110  
111  
112 =cut
113  
114 sub top_SeqFeatures{
115 my ($self) = @_;
116  
117 $self->_abstractDeath();
118  
119 }
120  
121  
122 =head2 all_SeqFeatures
123  
124 Title : all_SeqFeatures
125 Usage : @features = $annseq->all_SeqFeatures()
126 Function: returns all SeqFeatures, included sub SeqFeatures
127 Returns : an array
128 Args : none
129  
130  
131 =cut
132  
133 sub all_SeqFeatures{
134 my ($self) = @_;
135
136 $self->_abstractDeath();
137  
138 }
139  
140 =head2 seq
141  
142 Title : seq
143 Usage :
144 Function:
145 Example :
146 Returns :
147 Args :
148  
149  
150 =cut
151  
152 sub seq{
153 my ($self) = @_;
154  
155 $self->_abstractDeath();
156  
157 }
158  
159 =head2 write_GFF
160  
161 Title : write_GFF
162 Usage :
163 Function:
164 Example :
165 Returns :
166 Args :
167  
168  
169 =cut
170  
171 sub write_GFF{
172 my ($self,$fh) = @_;
173  
174 $fh || do { $fh = \*STDOUT; };
175  
176 foreach my $sf ( $self->all_SeqFeatures() ) {
177 print $fh $sf->gff_string, "\n";
178 }
179  
180 }
181  
182 =head2 annotation
183  
184 Title : annotation
185 Usage : $obj->annotation($seq_obj)
186 Function:
187 Example :
188 Returns : value of annotation
189 Args : newvalue (optional)
190  
191  
192 =cut
193  
194 sub annotation {
195 my ($obj) = @_;
196 $obj->_abstractDeath();
197 }
198  
199 =head2 primary_seq
200  
201 Title : primary_seq
202 Usage : $obj->primary_seq($newval)
203 Function:
204 Example :
205 Returns : value of primary_seq
206 Args : newvalue (optional)
207  
208  
209 =cut
210  
211 sub primary_seq {
212 my ($obj) = @_;
213 $obj->_abstractDeath();
214 }
215  
216 =head2 feature_count
217  
218 Title : feature_count
219 Usage : $seq->feature_count()
220 Function: Return the number of SeqFeatures attached to a sequence
221 Example :
222 Returns : number of SeqFeatures
223 Args : none
224  
225  
226 =cut
227  
228 sub feature_count {
229 my ($obj) = @_;
230 $obj->_abstractDeath();
231 }
232  
233 =head2 species
234  
235 Title : species
236 Usage :
237 Function: Gets or sets the species
238 Example : $species = $self->species();
239 Returns : FAST::Bio::Species object
240 Args : FAST::Bio::Species object or none;
241  
242  
243 =cut
244  
245 sub species {
246 my ($self) = @_;
247 $self->_abstractDeath();
248 }
249  
250 1;