/usr/share/perl5/Bio/Tools/Est2Genome.pm is in libbio-perl-perl 1.6.923-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | #
# BioPerl module for Bio::Tools::Est2Genome
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Jason Stajich <jason-at-bioperl.org>
#
# Copyright Jason Stajich
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::Est2Genome - Parse est2genome output, makes simple Bio::SeqFeature::Generic objects
=head1 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
}
=head1 DESCRIPTION
This module is a parser for C<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.
=head1 FEEDBACK
=head2 Mailing Lists
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
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<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.
=head2 Reporting Bugs
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/
=head1 AUTHOR - Jason Stajich
Email jason-at-bioperl.org
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
# Let the code begin...
package Bio::Tools::Est2Genome;
use strict;
# Object preamble - inherits from Bio::Root::Root
use Bio::Root::Root;
use Bio::SeqFeature::Gene::Exon;
use Bio::SeqFeature::Gene::Transcript;
use Bio::SeqFeature::Gene::Intron;
use Bio::SeqFeature::Gene::GeneStructure;
use Bio::SeqFeature::SimilarityPair;
use base qw(Bio::Tools::AnalysisResult);
=head2 new
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)
=cut
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");
}
=head2 analysis_method
Usage : $sim4->analysis_method();
Purpose : Inherited method. Overridden to ensure that the name matches
/est2genome/i.
Returns : String
Argument : n/a
=cut
#-------------
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);
}
=head2 parse_next_gene
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
=cut
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;
}
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;
}
=head2 next_feature
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
=cut
sub next_feature {
my ($self) = shift;
$self->throw("We haven't really done this right, yet, use parse_next_gene");
}
1;
|