Bio/Tools/Eponine.pm

filter: Statementstmt 23.3% 14 / 60 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 33.3% 4 / 12 Podpod 100% 4 / 4 totaltotal 21.5% 22 / 102 CC 11 SCAR 20.8
CC
11
Cov
17%
analysis_method
12.0
_parse_predictions
12.0
_prediction
12.0
CRAP 8.0
« Bio/AlignIO/selex.pm ↑ Summary Bio/Seq/PrimaryQual.pm »
1 #
2 # BioPerl module for Bio::Tools::Eponine
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Tania Oh <gisoht@nus.edu.sg>
7 #
8 # Copyright Tania Oh
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 Bio::Tools::Eponine - Results of one Eponine run
17  
18 =head1 SYNOPSIS
19  
20 use Bio::Tools::Eponine;
21 use strict;
22 my $seq = "/data/seq.fa";
23 my $threshold = "0.999";
24 my @params = ( -seq => $seq,
25 -threshold => $threshold);
26  
27 my $factory = Bio::Tools::Run::Eponine->new(@params);
28 # run eponine against fasta
29 my $r = $factory->run_eponine($seq);
30 my $parser = Bio::Tools::Eponine->new($r);
31  
32 while (my $feat = $parser->next_prediction){
33 #$feat contains array of SeqFeature
34 foreach my $orf($feat) {
35 print $orf->seq_id. "\n";
36 }
37 }
38  
39 =head1 DESCRIPTION
40  
41 Parser for Eponine, a probabilistic transcription start site detector
42 optimized for mammalian genomic sequence. This module inherits off
43 Bio::Tools::AnalysisResult and therefore implements
44 Bio::SeqAnalysisParserI (see L<Bio::Tools::AnalysisResult> and
45 L<Bio::SeqAnalysisParserI>).
46  
47 =head1 FEEDBACK
48  
49 =head2 Mailing Lists
50  
51 User feedback is an integral part of the evolution of this and other
52 Bioperl modules. Send your comments and suggestions preferably to one
53 of the Bioperl mailing lists. Your participation is much appreciated.
54  
55 bioperl-l@bioperl.org - General discussion
56 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
57  
58 =head2 Support
59  
60 Please direct usage questions or support issues to the mailing list:
61  
62 I<bioperl-l@bioperl.org>
63  
64 rather than to the module maintainer directly. Many experienced and
65 reponsive experts will be able look at the problem and quickly
66 address it. Please include a thorough description of the problem
67 with code and data examples if at all possible.
68  
69 =head2 Reporting Bugs
70  
71 Report bugs to the Bioperl bug tracking system to help us keep track
72 the bugs and their resolution. Bug reports can be submitted via the
73 web:
74  
75 https://github.com/bioperl/bioperl-live/issues
76  
77 =head1 AUTHOR - Tania Oh
78  
79 E<lt>gisoht-at-nus.edu.sgE<gt>
80  
81 =head1 APPENDIX
82  
83 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
84  
85 =cut
86  
87  
88 # Let the code begin...
89  
90  
91 package Bio::Tools::Eponine;
92 1 $Bio::Tools::Eponine::VERSION = '1.7.8';
93 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 1 ▶use Bio::Tools::Prediction::Gene;
Subroutine BEGIN: called CC=1 SCAR=0.0
96 1 ▶use Bio::Tools::Prediction::Exon;
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 1 ▶use base qw(Bio::Tools::AnalysisResult);
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 0 ▶sub _initialize_state {
Subroutine _initialize_state: not called CC=1 SCAR=6.9
101 0 my($self,@args) = @_;
102  
103 # first call the inherited method!
104 0 my $make = $self->SUPER::_initialize_state(@args);
105  
106 # handle our own parameters
107  
108 # our private state variables
109 0 $self->{'_preds_parsed'} = 0;
110 #array of Bio::SeqFeatures
111 0 $self->{'_flist'} =[];
112 }
113  
114 =head2 analysis_method
115  
116 Usage : $mzef->analysis_method();
117 Purpose : Inherited method. Overridden to ensure that the name matches
118 /mzef/i.
119 Returns : String
120 Argument : n/a
121  
122 =cut
123  
124 #-------------
125 0 ▶sub analysis_method {
Subroutine analysis_method: not called CC=3 SCAR=24.8
Pod documented
126 #-------------
127 0 my ($self, $method) = @_;
128 0 ▶ if($method && ($method !~ /epo/i)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method and not $method =~ /epo/i) 0 0 0
Condition0%0/3
$method and not $method =~ /epo/i
!ll&&!rl&&r
000
MC/DC0%0/2
$method and not $method =~ /epo/i
$method not $method =~ /epo/i
Truth table0%0/3
A and not(B)
A= $methodB= not $method =~ /epo/i
ABresult
0X0
100
111
129 0 $self->throw("method $method not supported in " . ref($self));
130 }
131 0 return $self->SUPER::analysis_method($method);
132 }
133  
134 =head2 next_feature
135  
136 Title : next_feature
137 Usage : while($gene = $mzef->next_feature()) {
138 # do something
139 }
140 Function: Returns the next gene structure prediction of the MZEF result
141 file. Call this method repeatedly until FALSE is returned.
142  
143 The returned object is actually a SeqFeatureI implementing object.
144 This method is required for classes implementing the
145 SeqAnalysisParserI interface, and is merely an alias for
146 next_prediction() at present.
147  
148 Note that with the present version of MZEF there will only be one
149 object returned, because MZEF does not predict individual genes
150 but just potential internal exons.
151 Example :
152 Returns : A Bio::Tools::Prediction::Gene object.
153 Args :
154  
155 =cut
156  
157 0 ▶sub next_feature {
Subroutine next_feature: not called CC=1 SCAR=6.9
Pod documented
158 0 my ($self,@args) = @_;
159 # even though next_prediction doesn't expect any args (and this method
160 # does neither), we pass on args in order to be prepared if this changes
161 # ever
162 0 return $self->next_prediction(@args);
163 }
164  
165 =head2 next_prediction
166  
167 Title : next_prediction
168 Usage : while($gene = $mzef->next_prediction()) {
169 # do something
170 }
171 Function: Returns the next gene structure prediction of the MZEF result
172 file. Call this method repeatedly until FALSE is returned.
173  
174 Note that with the present version of MZEF there will only be one
175 object returned, because MZEF does not predict individual genes
176 but just potential internal exons.
177 Example :
178 Returns : A Bio::Tools::Prediction::Gene object.
179 Args :
180  
181 =cut
182  
183 0 ▶sub next_prediction {
Subroutine next_prediction: not called CC=2 SCAR=17.9
Pod documented
184 0 my ($self) = @_;
185 0 my $gene;
186  
187 # if the prediction section hasn't been parsed yet, we do this now
188 0 ▶ $self->_parse_predictions() unless $self->_predictions_parsed();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_predictions_parsed 0 0 0
189  
190 # return the next gene structure (transcript)
191 0 return $self->_prediction();
192 }
193  
194 =head2 _parse_predictions
195  
196 Title : _parse_predictions()
197 Usage : $obj->_parse_predictions()
198 Function: Parses the prediction section. Automatically called by
199 next_prediction() if not yet done.
200 Example :
201 Returns :
202  
203 =cut
204  
205 0 ▶sub _parse_predictions {
Subroutine _parse_predictions: not called CC=3 SCAR=24.8
206 0 my ($self) = @_;
207  
208 0 ▶ while(defined($_ = $self->_readline())) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 0 0 0
209 0 ▶ if (! /^\#/){ #ignore introductory lines
Branch: 1 branch
BranchTrueFalseTotal
unless (/^\#/) 0 0 0
210  
211 0 my @element = split;
212 0 my (%feature);
213 0 $feature {name} = $element[0];
214 0 $feature {score} = $element[5];
215 0 $feature {start} = $element[3];
216 0 $feature {end} = $element[4];
217 0 $feature {strand} = $element[6];
218 0 $feature {source}= 'Eponine';
219 0 $feature {primary}= 'TSS';
220 0 $feature {program} = 'eponine-scan';
221 0 $feature {program_version} = '2';
222
223 0 $self->create_feature(\%feature);
224 0 next;
225  
226 }
227 }
228 0 $self->_predictions_parsed(1);
229 }
230  
231 =head2 create_feature
232  
233 Title : create_feature
234 Usage : obj->create_feature($feature)
235 Function: Returns an array of features
236 Returns : Returns an array of features
237 Args : none
238  
239 =cut
240  
241 0 ▶sub create_feature {
Subroutine create_feature: not called CC=2 SCAR=17.9
Pod documented
242 0 my ($self, $feat) = @_;
243 #create and fill Bio::EnsEMBL::Seqfeature object
244  
245 my $tss = Bio::SeqFeature::Generic->new
246 ( -seq_id => $feat->{'name'},
247 -start => $feat->{'start'},
248 -end => $feat->{'end'},
249 -strand => $feat->{'strand'},
250 -score => $feat->{'score'},
251 -source_tag => $feat->{'source'},
252 0 -primary_tag => $feat->{'primary'});
253  
254
255  
256 0 ▶ if ($tss) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tss) 0 0 0
257 # add to _flist
258 0 push(@{$self->{'_flist'}}, $tss);
259 }
260  
261 #print $tss->gff_string;
262 }
263
264  
265  
266  
267  
268  
269 =head2 _prediction
270  
271 Title : _prediction()
272 Usage : $gene = $obj->_prediction()
273 Function: internal
274 Example :
275 Returns :
276  
277 =cut
278  
279 0 ▶sub _prediction {
Subroutine _prediction: not called CC=3 SCAR=24.8
280 0 my ($self) = @_;
281  
282 0 ▶ return unless(exists($self->{'_flist'}) && @{$self->{'_flist'}});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"_flist"} and @{$self->{"_flist"};} 0 0 0
Condition0%0/3
exists $self->{"_flist"} and @{$self->{"_flist"};}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"_flist"} and @{$self->{"_flist"};}
exists $self->{"_flist"} @{$self->{"_flist"};}
Truth table0%0/3
A and B
A= exists $self->{"_flist"}B= @{$self->{"_flist"};}
ABresult
0X0
100
111
283 0 return shift(@{$self->{'_flist'}});
284 }
285  
286 =head2 _predictions_parsed
287  
288 Title : _predictions_parsed
289 Usage : $obj->_predictions_parsed
290 Function: internal
291 Example :
292 Returns : TRUE or FALSE
293  
294 =cut
295  
296 0 ▶sub _predictions_parsed {
Subroutine _predictions_parsed: not called CC=3 SCAR=24.8
297 0 my ($self, $val) = @_;
298  
299 0 ▶ $self->{'_preds_parsed'} = $val if $val;
Branch: 1 branch
BranchTrueFalseTotal
if $val 0 0 0
300 # array of pre-parsed predictions
301 0 ▶ if(! exists($self->{'_preds_parsed'})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"_preds_parsed"}) 0 0 0
302 0 $self->{'_preds_parsed'} = 0;
303 }
304 0 return $self->{'_preds_parsed'};
305 }
306  
307  
308 1 1;
« Bio/AlignIO/selex.pm ↑ Summary Bio/Seq/PrimaryQual.pm »