Bio::Tools
ESTScan
Toolbar
Summary
Bio::Tools::ESTScan - Results of one ESTScan run
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
$estscan = Bio::Tools::ESTScan->new(-file => 'result.estscan');
# filehandle:
$estscan = Bio::Tools::ESTScan->new( -fh => \*INPUT );
# parse the results
# note: this class is-a Bio::Tools::AnalysisResult which implements
# Bio::SeqAnalysisParserI, i.e., $genscan->next_feature() is the same
while($gene = $estscan->next_prediction()) {
# $gene is an instance of Bio::Tools::Prediction::Gene
foreach my $orf ($gene->exons()) {
# $orf is an instance of Bio::Tools::Prediction::Exon
$cds_str = $orf->predicted_cds();
}
}
# essential if you gave a filename at initialization (otherwise the file
# will stay open)
$estscan->close();
Description
Methods
Methods description
Title : _fasta_stream Usage : $result->_fasta_stream() Function: Gets/Sets the FASTA sequence IO stream for reading the contents of the file associated with this MZEF result object.
If called for the first time, creates the stream from the filehandle
if necessary.
Example :
Returns :
Args : |
Usage : $estscan->analysis_method(); Purpose : Inherited method. Overridden to ensure that the name matches /estscan/i. Returns : String Argument : n/a |
Title : close Usage : $result->close() Function: Closes the file handle associated with this result file. Inherited method, overridden. Example : Returns : Args : |
Title : next_feature Usage : while($orf = $estscan->next_feature()) { # do something } Function: Returns the next gene structure prediction of the ESTScan result file. Call this method repeatedly until FALSE is returned.
The returned object is actually a SeqFeatureI implementing object.
This method is required for classes implementing the
SeqAnalysisParserI interface, and is merely an alias for
next_prediction() at present.
Example :
Returns : A Bio::Tools::Prediction::Gene object.
Args : |
Title : next_prediction Usage : while($gene = $estscan->next_prediction()) { # do something } Function: Returns the next gene structure prediction of the ESTScan result file. Call this method repeatedly until FALSE is returned.
So far, this method DOES NOT work for reverse strand predictions,
even though the code looks like.
Example :
Returns : A Bio::Tools::Prediction::Gene object.
Args : |
Methods code
sub _fasta_stream
{ my ($self, $stream) = @_;
if($stream || (! exists($self->{'_fastastream'}))) {
if(! $stream) {
$stream = Bio::SeqIO->new('-fh' => $self->_fh(),
'-format' => "fasta");
}
$self->{'_fastastream'} = $stream;
}
return $self->{'_fastastream'};
}
1; } |
sub _initialize_state
{ my ($self,@args) = @_;
my $make = $self->SUPER::_initialize_state(@args);
if(! $self->analysis_method()) {
$self->analysis_method('ESTScan');
} } |
sub analysis_method
{ my ($self, $method) = @_;
if($method && ($method !~ /estscan/i)) {
$self->throw("method $method not supported in " . ref($self));
}
return $self->SUPER::analysis_method($method); } |
sub close
{ my ($self, @args) = @_;
delete($self->{'_fastastream'});
$self->SUPER::close(@args); } |
sub next_feature
{ my ($self,@args) = @_;
return $self->next_prediction(@args); } |
sub next_prediction
{ my ($self) = @_;
my ($gene, $seq, $cds, $predobj);
my $numins = 0;
$seq = $self->_fasta_stream()->next_seq();
return unless $seq;
$gene = Bio::Tools::Prediction::Gene->new('-primary' => "ORFprediction",
'-source' => "ESTScan");
$seq->desc() =~ /^([\d.]+)\s*(.*)/ or
$self->throw("unexpected format of description: no score in " .
$seq->desc());
$gene->score($1);
$seq->desc($2);
if($seq->desc() =~ /(.*)minus strand$/) {
my $desc = $1;
$desc =~ s/;\s+$//;
$seq->desc($desc);
$gene->strand(-1);
} else {
$gene->strand(1);
}
if($seq->desc() =~ /^(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s*(.*)/) {
$seq->desc($5);
$predobj = Bio::Tools::Prediction::Exon->new('-source' => "ESTScan",
'-start' => $3,
'-end' => $4);
$predobj->strand($gene->strand());
$predobj->score($gene->score()); $predobj->primary_tag("InternalExon");
$predobj->seq_id($seq->display_id());
$gene->add_exon($predobj);
$cds = $seq->seq();
$cds =~ s/[a-z]//g; $cds = Bio::PrimarySeq->new('-seq' => $cds,
'-display_id' => $seq->display_id(),
'-desc' => $seq->desc(),
'-alphabet' => "dna");
$gene->predicted_cds($cds);
$predobj->predicted_cds($cds);
if($gene->strand() == -1) {
$self->warn("reverse strand ORF, but unable to reverse coordinates!");
}
} else {
if($gene->strand() == -1) {
$seq = $seq->revcom();
}
my $seqstr = $seq->seq();
while($seqstr =~ /^([a-z]*)([A-Z].*)$/) {
my $utr5 = $1;
my $exonseq = $2;
if($exonseq =~ s/([a-z]{2,}.*)$//) {
$seqstr = $1;
} else {
$seqstr = "";
}
my $start = CORE::length($utr5) + 1;
if($predobj) {
$start += $predobj->end() + $numins;
}
$cds = $exonseq;
$cds =~ s/[X]//g;
my $end = $start + CORE::length($cds) - 1;
$predobj = Bio::Tools::Prediction::Exon->new('-start' => $start,
'-end' => $end);
$predobj->source_tag("ESTScan");
$predobj->primary_tag("InternalExon");
$predobj->seq_id($seq->display_id());
$predobj->strand($gene->strand());
$predobj->score($gene->score());
$gene->add_exon($predobj);
$cds = $exonseq;
$cds =~ s/[a-z]//g; $cds = Bio::PrimarySeq->new('-seq' => $cds,
'-display_id' => $seq->display_id(),
'-desc' => $seq->desc(),
'-alphabet' => "dna");
$gene->predicted_cds($cds) unless $gene->predicted_cds();
$predobj->predicted_cds($cds);
my $fea = undef;
while($exonseq =~ /([a-zX])/g) {
my $indel = $1;
if($fea) {
$start = $fea->start()+$numins;
$start -= 1 if($fea->primary_tag() eq 'insertion');
} else {
$start = $predobj->start()+$numins-1;
}
$start = index($seq->seq(), $indel, $start) + 1 - $numins;
$fea = Bio::SeqFeature::Generic->new('-start' => $start,
'-end' => $start);
$fea->source_tag("ESTScan");
$fea->seq_id($seq->display_id());
$fea->strand($predobj->strand());
if($indel eq 'X') {
$fea->primary_tag("insertion");
$numins++;
} else {
$fea->primary_tag("deletion");
$fea->add_tag_value('base', $indel);
}
$predobj->add_sub_SeqFeature($fea);
}
}
}
return $gene; } |
General documentation
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bio.perl.org/MailList.html - About the mailing lists
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via email
or the web:
bioperl-bugs@bio.perl.org
http://bugzilla.bioperl.org/
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _