3 # BioPerl module for Bio::Tools::Eponine
5 # Cared for by Tania Oh <gisoht@nus.edu.sg>
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Tools::Eponine - Results of one Eponine run
19 use Bio::Tools::Eponine;
21 my $seq = "/data/seq.fa";
22 my $threshold = "0.999";
23 my @params = ( -seq => $seq,
24 -threshold => $threshold);
26 my $factory = Bio::Tools::Run::Eponine->new(@params);
27 # run eponine against fasta
28 my $r = $factory->run_eponine($seq);
29 my $parser = Bio::Tools::Eponine->new($r);
31 while (my $feat = $parser->next_prediction){
32 #$feat contains array of SeqFeature
33 foreach my $orf($feat) {
34 print $orf->seq_id. "\n";
40 Parser for Eponine, a probabilistic transcription start site detector
41 optimized for mammalian genomic sequence. This module inherits off
42 Bio::Tools::AnalysisResult and therefore implements
43 Bio::SeqAnalysisParserI (see L<Bio::Tools::AnalysisResult> and
44 L<Bio::SeqAnalysisParserI>).
50 User feedback is an integral part of the evolution of this and other
51 Bioperl modules. Send your comments and suggestions preferably to one
52 of the Bioperl mailing lists. Your participation is much appreciated.
54 bioperl-l@bioperl.org - General discussion
55 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 the bugs and their resolution. Bug reports can be submitted via the
63 http://bugzilla.open-bio.org/
65 =head1 AUTHOR - Tania Oh
67 E<lt>gisoht-at-nus.edu.sgE<gt>
71 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
76 # Let the code begin...
79 package Bio
::Tools
::Eponine
;
82 use Bio
::Tools
::Prediction
::Gene
;
83 use Bio
::Tools
::Prediction
::Exon
;
85 use base
qw(Bio::Tools::AnalysisResult);
87 sub _initialize_state
{
90 # first call the inherited method!
91 my $make = $self->SUPER::_initialize_state
(@args);
93 # handle our own parameters
95 # our private state variables
96 $self->{'_preds_parsed'} = 0;
97 #array of Bio::SeqFeatures
98 $self->{'_flist'} =[];
101 =head2 analysis_method
103 Usage : $mzef->analysis_method();
104 Purpose : Inherited method. Overridden to ensure that the name matches
112 sub analysis_method
{
114 my ($self, $method) = @_;
115 if($method && ($method !~ /epo/i)) {
116 $self->throw("method $method not supported in " . ref($self));
118 return $self->SUPER::analysis_method
($method);
124 Usage : while($gene = $mzef->next_feature()) {
127 Function: Returns the next gene structure prediction of the MZEF result
128 file. Call this method repeatedly until FALSE is returned.
130 The returned object is actually a SeqFeatureI implementing object.
131 This method is required for classes implementing the
132 SeqAnalysisParserI interface, and is merely an alias for
133 next_prediction() at present.
135 Note that with the present version of MZEF there will only be one
136 object returned, because MZEF does not predict individual genes
137 but just potential internal exons.
139 Returns : A Bio::Tools::Prediction::Gene object.
145 my ($self,@args) = @_;
146 # even though next_prediction doesn't expect any args (and this method
147 # does neither), we pass on args in order to be prepared if this changes
149 return $self->next_prediction(@args);
152 =head2 next_prediction
154 Title : next_prediction
155 Usage : while($gene = $mzef->next_prediction()) {
158 Function: Returns the next gene structure prediction of the MZEF result
159 file. Call this method repeatedly until FALSE is returned.
161 Note that with the present version of MZEF there will only be one
162 object returned, because MZEF does not predict individual genes
163 but just potential internal exons.
165 Returns : A Bio::Tools::Prediction::Gene object.
170 sub next_prediction
{
174 # if the prediction section hasn't been parsed yet, we do this now
175 $self->_parse_predictions() unless $self->_predictions_parsed();
177 # return the next gene structure (transcript)
178 return $self->_prediction();
181 =head2 _parse_predictions
183 Title : _parse_predictions()
184 Usage : $obj->_parse_predictions()
185 Function: Parses the prediction section. Automatically called by
186 next_prediction() if not yet done.
192 sub _parse_predictions
{
195 while(defined($_ = $self->_readline())) {
196 if (! /^\#/){ #ignore introductory lines
200 $feature {name
} = $element[0];
201 $feature {score
} = $element[5];
202 $feature {start
} = $element[3];
203 $feature {end
} = $element[4];
204 $feature {strand
} = $element[6];
205 $feature {source
}= 'Eponine';
206 $feature {primary
}= 'TSS';
207 $feature {program
} = 'eponine-scan';
208 $feature {program_version
} = '2';
210 $self->create_feature(\
%feature);
215 $self->_predictions_parsed(1);
218 =head2 create_feature
220 Title : create_feature
221 Usage : obj->create_feature($feature)
222 Function: Returns an array of features
223 Returns : Returns an array of features
229 my ($self, $feat) = @_;
230 #create and fill Bio::EnsEMBL::Seqfeature object
232 my $tss = Bio
::SeqFeature
::Generic
->new
233 ( -seq_id
=> $feat->{'name'},
234 -start
=> $feat->{'start'},
235 -end
=> $feat->{'end'},
236 -strand
=> $feat->{'strand'},
237 -score
=> $feat->{'score'},
238 -source_tag
=> $feat->{'source'},
239 -primary_tag
=> $feat->{'primary'});
245 push(@
{$self->{'_flist'}}, $tss);
248 #print $tss->gff_string;
258 Title : _prediction()
259 Usage : $gene = $obj->_prediction()
269 return unless(exists($self->{'_flist'}) && @
{$self->{'_flist'}});
270 return shift(@
{$self->{'_flist'}});
273 =head2 _predictions_parsed
275 Title : _predictions_parsed
276 Usage : $obj->_predictions_parsed
279 Returns : TRUE or FALSE
283 sub _predictions_parsed
{
284 my ($self, $val) = @_;
286 $self->{'_preds_parsed'} = $val if $val;
287 # array of pre-parsed predictions
288 if(! exists($self->{'_preds_parsed'})) {
289 $self->{'_preds_parsed'} = 0;
291 return $self->{'_preds_parsed'};