Bio::Tools Est2Genome
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::Tools::Est2Genome - Parse est2genome output, makes simple Bio::SeqFeature::Generic objects
Package variables
No package variables defined.
Included modules
Bio::Root::Root
Bio::SeqFeature::Gene::Exon
Bio::SeqFeature::Gene::GeneStructure
Bio::SeqFeature::Gene::Intron
Bio::SeqFeature::Gene::Transcript
Bio::SeqFeature::SimilarityPair
Inherit
Bio::Tools::AnalysisResult
Synopsis
  use Bio::Tools::Est2Genome;
my $featureiter = Bio::Tools::Est2Genome->new(-file => 'output.est2genome'); # This is going to be fixed to use the SeqAnalysisI next_feature # Method eventually when we have the objects to put the data in # properly while( my $f = $featureiter->parse_next_gene ) { # process Bio::SeqFeature::Generic objects here }
Description
This module is a parser for est2genome [EMBOSS] alignments of est/cdna
sequence to genomic DNA. This is generally accepted as the best
program for predicting splice sites based on est/dnas (as far as I know).
This module currently does not try pull out the ungapped alignments
(Segment) but may in the future.
Methods
_initialize_state
No description
Code
analysis_methodDescriptionCode
parse_next_geneDescriptionCode
_parse_gene_struct
No description
Code
next_featureDescriptionCode
Methods description
analysis_methodcode    nextTop
 Usage     : $sim4->analysis_method();
Purpose : Inherited method. Overridden to ensure that the name matches
/est2genome/i.
Returns : String
Argument : n/a
parse_next_genecodeprevnextTop
 Title   : parse_next_gene
Usage : @gene = $est2genome_result->parse_next_gene;
foreach $exon (@exons) {
# do something
}
Function: Parses the next alignments of the est2genome result file and returns the found exons as an array of Bio::SeqFeature::SimilarityPair objects. Call this method repeatedly until an empty array is returned to get the results for all alignments. The $exon->seq_id() attribute will be set to the identifier of the respective sequence for both sequences. The length is accessible via the seqlength() attribute of $exon->query() and $exon->est_hit(). Returns : An array (or array reference) of Bio::SeqFeature::SimilarityPair and Bio::SeqFeature::Generic objects or Bio::SeqFeature::Gene::GeneStructure Args : flag(1/0) indicating to return Bio::SeqFeature::Gene::GeneStructure or Bio::SeqFeature::SimilarityPair defaults to 0
next_featurecodeprevnextTop
 Title   : next_feature
Usage : $seqfeature = $obj->next_feature();
Function: Returns the next feature available in the analysis result, or
undef if there are no more features.
Example :
Returns : A Bio::SeqFeatureI implementing object, or undef if there are no
more features.
Args : none
Methods code
_initialize_statedescriptionprevnextTop
sub _initialize_state {
    my($self,@args) = @_;

    # call the inherited method first
my $make = $self->SUPER::_initialize_state(@args); my ($genome_is_first) = $self->_rearrange([qw(GENOMEFIRST)], @args); delete($self->{'_genome_is_first'}); $self->{'_genome_is_first'} = $genome_is_first if(defined($genome_is_first)); $self->analysis_method("est2genome");
}
analysis_methoddescriptionprevnextTop
sub analysis_method {
#-------------
my ($self, $method) = @_; if($method && ($method !~ /est2genome/i)) { $self->throw("method $method not supported in " . ref($self)); } return $self->SUPER::analysis_method($method);
}
parse_next_genedescriptionprevnextTop
sub parse_next_gene {
   my ($self,$return_gene) = @_;
   return $self->_parse_gene_struct if $return_gene;
   my $seensegment = 0;
   my @features;
   my ($qstrand,$hstrand) = (1,1);
   my $lasthseqname;
   while( defined($_ = $self->_readline) ) {
       if( /Note Best alignment is between (reversed|forward) est and (reversed|forward) genome, (but|and) splice\s+sites imply\s+(forward gene|REVERSED GENE)/) {
	   if( $seensegment ) {
	       $self->_pushback($_);
	       return wantarray ? @features :\@ features;
	   }
	   $hstrand = -1 if $1 eq 'reversed';
	   $qstrand = -1 if $4 eq 'REVERSED GENE';
	   #$self->debug( "1=$1, 2=$2, 4=$4\n");
} elsif( /^Exon/ ) { my ($name,$score,$perc_ident,$qstart,$qend,$qseqname, $hstart,$hend, $hseqname) = split; $lasthseqname = $hseqname; my $query = Bio::SeqFeature::Similarity->new(-primary => $name, -source => $self->analysis_method, -seq_id => $qseqname, # FIXME WHEN WE REDO THE GENERIC NAME CHANGE
-start => $qstart, -end => $qend, -strand => $qstrand, -score => $score, -tag => { # 'Location' => "$hstart..$hend",
'Sequence' => "$hseqname", 'identity' => $perc_ident, } ); my $hit = Bio::SeqFeature::Similarity->new(-primary => 'exon_hit', -source => $self->analysis_method, -seq_id => $hseqname, -start => $hstart, -end => $hend, -strand => $hstrand, -score => $score, -tag => { # 'Location' => "$qstart..$qend",
'Sequence' => "$qseqname", 'identity' => $perc_ident, } ); push @features, Bio::SeqFeature::SimilarityPair->new (-query => $query, -hit => $hit, -source => $self->analysis_method); } elsif( /^([\-\+\?])(Intron)/) { my ($name,$score,$perc_ident,$qstart,$qend,$qseqname) = split; push @features, Bio::SeqFeature::Generic->new(-primary => $2, -source => $self->analysis_method, -start => $qstart, -end => $qend, -strand => $qstrand, -score => $score, -seq_id => $qseqname, -tag => { 'identity' => $perc_ident, 'Sequence' => $lasthseqname}); } elsif( /^Span/ ) { } elsif( /^Segment/ ) { $seensegment = 1; } elsif( /^\s+$/ ) { # do nothing
} else { $self->warn( "unknown line $_\n"); } } return unless( @features ); return wantarray ? @features :\@ features;
}
_parse_gene_structdescriptionprevnextTop
sub _parse_gene_struct {
   my ($self) = @_;
   my $seensegment = 0;
   my @features;
   my ($qstrand,$hstrand) = (1,1);
   my $lasthseqname;
   my $gene = Bio::SeqFeature::Gene::GeneStructure->new(-source => $self->analysis_method);
   my $transcript = Bio::SeqFeature::Gene::Transcript->new(-source => $self->analysis_method);
   my @suppf;
   my @exon;
   while( defined($_ = $self->_readline) ) {
       if( /Note Best alignment is between (reversed|forward) est and (reversed|forward) genome, (but|and) splice\s+sites imply\s+(forward gene|REVERSED GENE)/) {
	      if( $seensegment ) {
	       $self->_pushback($_);
	       return $gene;
	      }
    	   $hstrand = -1 if $1 eq 'reversed';
    	   $qstrand = -1 if $4 eq 'REVERSED GENE';
       }
       elsif( /^Exon/ ) {
    	   my ($name,$score,$perc_ident,$qstart,$qend,$qseqname,$hstart,$hend, $hseqname) = split;
    	   $lasthseqname = $hseqname;
    	   my $exon = Bio::SeqFeature::Gene::Exon->new(-primary => $name,
						       -source  => $self->analysis_method,
						       -seq_id => $qseqname, # FIXME WHEN WE REDO THE GENERIC NAME CHANGE
-start => $qstart, -end => $qend, -strand => $qstrand, -score => $score, -tag => { #'Location' => "$hstart..$hend",
'identity' => $perc_ident, 'Sequence' => "$hseqname", } ); $transcript->seq_id($qseqname) unless $transcript->seq_id; $exon->add_tag_value('phase',0); push @exon, $exon; } elsif( /^([\-\+\?])(Intron)/) { next; #intron auto matically built from exons..hope thats ok..
} elsif( /^Span/ ) { } elsif( /^Segment/ ) { my ($name,$score,$perc_ident,$qstart,$qend,$qseqname,$hstart,$hend, $hseqname) = split; my $query = Bio::SeqFeature::Similarity->new(-primary => $name, -source => $self->analysis_method, -seq_id => $qseqname, # FIXME WHEN WE REDO THE GENERIC NAME CHANGE
-start => $qstart, -end => $qend, -strand => $qstrand, -score => $score, -tag => { # 'Location' => "$hstart..$hend",
'Sequence' => "$hseqname", 'identity' => $perc_ident, } ); my $hit = Bio::SeqFeature::Similarity->new(-primary => 'exon_hit', -source => $self->analysis_method, -seq_id => $hseqname, -start => $hstart, -end => $hend, -strand => $hstrand, -score => $score, -tag => { # 'Location' => "$qstart..$qend",
'Sequence' => "$qseqname", 'identity' => $perc_ident, } ); my $support = Bio::SeqFeature::SimilarityPair->new(-query => $query, -hit => $hit, -source => $self->analysis_method); push @suppf, $support; } elsif( /^\s+$/ ) { # do nothing
} else { $self->warn( "unknown line $_\n"); } } return unless $#exon >=0; foreach my $e(@exon){ my @add; foreach my $sf(@suppf){ if($sf->overlaps($e)){ push @add,$sf; } } $e->add_tag_value('supporting_feature',@add); $transcript->add_exon($e); } $gene->add_transcript($transcript); $gene->seq_id($transcript->seq_id); return $gene;
}
next_featuredescriptionprevnextTop
sub next_feature {
    my ($self) = shift;
    $self->throw("We haven't really done this right, yet, use parse_next_gene");
}


1;
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
  bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support Top
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted the
web:
  https://redmine.open-bio.org/projects/bioperl/
AUTHOR - Jason StajichTop
Email jason-at-bioperl.org
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
newTop
 Title   : new
Usage : my $obj = Bio::Tools::Est2Genome->new();
Function: Builds a new Bio::Tools::Est2Genome object
Returns : an instance of Bio::Tools::Est2Genome
Args : -file => 'output.est2genome' or
-fh => \*EST2GENOMEOUTPUT
-genomefirst => 1 # genome was the first input (not standard)