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
;
94 use Bio
::Tools
::Prediction
::Gene
;
95 use Bio
::Tools
::Prediction
::Exon
;
97 use base
qw(Bio::Tools::AnalysisResult);
99 sub _initialize_state
{
100 my($self,@args) = @_;
102 # first call the inherited method!
103 my $make = $self->SUPER::_initialize_state
(@args);
105 # handle our own parameters
107 # our private state variables
108 $self->{'_preds_parsed'} = 0;
109 #array of Bio::SeqFeatures
110 $self->{'_flist'} =[];
113 =head2 analysis_method
115 Usage : $mzef->analysis_method();
116 Purpose : Inherited method. Overridden to ensure that the name matches
124 sub analysis_method
{
126 my ($self, $method) = @_;
127 if($method && ($method !~ /epo/i)) {
128 $self->throw("method $method not supported in " . ref($self));
130 return $self->SUPER::analysis_method
($method);
136 Usage : while($gene = $mzef->next_feature()) {
139 Function: Returns the next gene structure prediction of the MZEF result
140 file. Call this method repeatedly until FALSE is returned.
142 The returned object is actually a SeqFeatureI implementing object.
143 This method is required for classes implementing the
144 SeqAnalysisParserI interface, and is merely an alias for
145 next_prediction() at present.
147 Note that with the present version of MZEF there will only be one
148 object returned, because MZEF does not predict individual genes
149 but just potential internal exons.
151 Returns : A Bio::Tools::Prediction::Gene object.
157 my ($self,@args) = @_;
158 # even though next_prediction doesn't expect any args (and this method
159 # does neither), we pass on args in order to be prepared if this changes
161 return $self->next_prediction(@args);
164 =head2 next_prediction
166 Title : next_prediction
167 Usage : while($gene = $mzef->next_prediction()) {
170 Function: Returns the next gene structure prediction of the MZEF result
171 file. Call this method repeatedly until FALSE is returned.
173 Note that with the present version of MZEF there will only be one
174 object returned, because MZEF does not predict individual genes
175 but just potential internal exons.
177 Returns : A Bio::Tools::Prediction::Gene object.
182 sub next_prediction
{
186 # if the prediction section hasn't been parsed yet, we do this now
187 $self->_parse_predictions() unless $self->_predictions_parsed();
189 # return the next gene structure (transcript)
190 return $self->_prediction();
193 =head2 _parse_predictions
195 Title : _parse_predictions()
196 Usage : $obj->_parse_predictions()
197 Function: Parses the prediction section. Automatically called by
198 next_prediction() if not yet done.
204 sub _parse_predictions
{
207 while(defined($_ = $self->_readline())) {
208 if (! /^\#/){ #ignore introductory lines
212 $feature {name
} = $element[0];
213 $feature {score
} = $element[5];
214 $feature {start
} = $element[3];
215 $feature {end
} = $element[4];
216 $feature {strand
} = $element[6];
217 $feature {source
}= 'Eponine';
218 $feature {primary
}= 'TSS';
219 $feature {program
} = 'eponine-scan';
220 $feature {program_version
} = '2';
222 $self->create_feature(\
%feature);
227 $self->_predictions_parsed(1);
230 =head2 create_feature
232 Title : create_feature
233 Usage : obj->create_feature($feature)
234 Function: Returns an array of features
235 Returns : Returns an array of features
241 my ($self, $feat) = @_;
242 #create and fill Bio::EnsEMBL::Seqfeature object
244 my $tss = Bio
::SeqFeature
::Generic
->new
245 ( -seq_id
=> $feat->{'name'},
246 -start
=> $feat->{'start'},
247 -end
=> $feat->{'end'},
248 -strand
=> $feat->{'strand'},
249 -score
=> $feat->{'score'},
250 -source_tag
=> $feat->{'source'},
251 -primary_tag
=> $feat->{'primary'});
257 push(@
{$self->{'_flist'}}, $tss);
260 #print $tss->gff_string;
270 Title : _prediction()
271 Usage : $gene = $obj->_prediction()
281 return unless(exists($self->{'_flist'}) && @
{$self->{'_flist'}});
282 return shift(@
{$self->{'_flist'}});
285 =head2 _predictions_parsed
287 Title : _predictions_parsed
288 Usage : $obj->_predictions_parsed
291 Returns : TRUE or FALSE
295 sub _predictions_parsed
{
296 my ($self, $val) = @_;
298 $self->{'_preds_parsed'} = $val if $val;
299 # array of pre-parsed predictions
300 if(! exists($self->{'_preds_parsed'})) {
301 $self->{'_preds_parsed'} = 0;
303 return $self->{'_preds_parsed'};