2 # BioPerl module for Bio::Tools::Eponine
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Tania Oh <gisoht@nus.edu.sg>
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Tools::Eponine - Results of one Eponine run
20 use Bio::Tools::Eponine;
22 my $seq = "/data/seq.fa";
23 my $threshold = "0.999";
24 my @params = ( -seq => $seq,
25 -threshold => $threshold);
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);
32 while (my $feat = $parser->next_prediction){
33 #$feat contains array of SeqFeature
34 foreach my $orf($feat) {
35 print $orf->seq_id. "\n";
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>).
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.
55 bioperl-l@bioperl.org - General discussion
56 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
60 Please direct usage questions or support issues to the mailing list:
62 I<bioperl-l@bioperl.org>
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.
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
75 https://github.com/bioperl/bioperl-live/issues
77 =head1 AUTHOR - Tania Oh
79 E<lt>gisoht-at-nus.edu.sgE<gt>
83 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
88 # Let the code begin...
91 package Bio
::Tools
::Eponine
;
95 use Bio
::Tools
::Prediction
::Gene
;
96 use Bio
::Tools
::Prediction
::Exon
;
98 use base
qw(Bio::Tools::AnalysisResult);
100 sub _initialize_state
{
101 my($self,@args) = @_;
103 # first call the inherited method!
104 my $make = $self->SUPER::_initialize_state
(@args);
106 # handle our own parameters
108 # our private state variables
109 $self->{'_preds_parsed'} = 0;
110 #array of Bio::SeqFeatures
111 $self->{'_flist'} =[];
114 =head2 analysis_method
116 Usage : $mzef->analysis_method();
117 Purpose : Inherited method. Overridden to ensure that the name matches
125 sub analysis_method
{
127 my ($self, $method) = @_;
128 if($method && ($method !~ /epo/i)) {
129 $self->throw("method $method not supported in " . ref($self));
131 return $self->SUPER::analysis_method
($method);
137 Usage : while($gene = $mzef->next_feature()) {
140 Function: Returns the next gene structure prediction of the MZEF result
141 file. Call this method repeatedly until FALSE is returned.
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.
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.
152 Returns : A Bio::Tools::Prediction::Gene object.
158 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
162 return $self->next_prediction(@args);
165 =head2 next_prediction
167 Title : next_prediction
168 Usage : while($gene = $mzef->next_prediction()) {
171 Function: Returns the next gene structure prediction of the MZEF result
172 file. Call this method repeatedly until FALSE is returned.
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.
178 Returns : A Bio::Tools::Prediction::Gene object.
183 sub next_prediction
{
187 # if the prediction section hasn't been parsed yet, we do this now
188 $self->_parse_predictions() unless $self->_predictions_parsed();
190 # return the next gene structure (transcript)
191 return $self->_prediction();
194 =head2 _parse_predictions
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.
205 sub _parse_predictions
{
208 while(defined($_ = $self->_readline())) {
209 if (! /^\#/){ #ignore introductory lines
213 $feature {name
} = $element[0];
214 $feature {score
} = $element[5];
215 $feature {start
} = $element[3];
216 $feature {end
} = $element[4];
217 $feature {strand
} = $element[6];
218 $feature {source
}= 'Eponine';
219 $feature {primary
}= 'TSS';
220 $feature {program
} = 'eponine-scan';
221 $feature {program_version
} = '2';
223 $self->create_feature(\
%feature);
228 $self->_predictions_parsed(1);
231 =head2 create_feature
233 Title : create_feature
234 Usage : obj->create_feature($feature)
235 Function: Returns an array of features
236 Returns : Returns an array of features
242 my ($self, $feat) = @_;
243 #create and fill Bio::EnsEMBL::Seqfeature object
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 -primary_tag
=> $feat->{'primary'});
258 push(@
{$self->{'_flist'}}, $tss);
261 #print $tss->gff_string;
271 Title : _prediction()
272 Usage : $gene = $obj->_prediction()
282 return unless(exists($self->{'_flist'}) && @
{$self->{'_flist'}});
283 return shift(@
{$self->{'_flist'}});
286 =head2 _predictions_parsed
288 Title : _predictions_parsed
289 Usage : $obj->_predictions_parsed
292 Returns : TRUE or FALSE
296 sub _predictions_parsed
{
297 my ($self, $val) = @_;
299 $self->{'_preds_parsed'} = $val if $val;
300 # array of pre-parsed predictions
301 if(! exists($self->{'_preds_parsed'})) {
302 $self->{'_preds_parsed'} = 0;
304 return $self->{'_preds_parsed'};