/usr/share/perl5/Bio/Tools/Pseudowise.pm is in libbio-perl-perl 1.6.924-3.
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 | # BioPerl module for Bio::Tools::Pseudowise
#
#
# Copyright Jason Stajich, Fugu Team
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::Pseudowise - Results of one Pseudowise run
=head1 SYNOPSIS
use Bio::Tools::Pseudowise;
my $parser = Bio::Tools::Pseudowise->new(-file=>"pw.out");
while(my $feat = $parser->next_result){
push @feat, $feat;
}
=head1 DESCRIPTION
Pseudowise is a pseudogene prediction program written by Ewan Birney
as part of the Wise Package. This module is the parser for the output
of the program.
http://www.sanger.ac.uk/software/wise2
=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 one
of the Bioperl mailing lists. 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
the bugs and their resolution. Bug reports can be submitted via the
web:
https://github.com/bioperl/bioperl-live/issues
=head1 AUTHOR - Jason Stajich
Previous committed by the Fugu Team
Re-written by Jason Stajich jason-at-bioperl-dot-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::Pseudowise;
use strict;
use Symbol;
use Bio::Root::Root;
use Bio::SeqFeature::Generic;
use Bio::SeqFeature::Gene::Exon;
use Bio::SeqFeature::FeaturePair;
use Bio::SeqFeature::Gene::Transcript;
use Bio::SeqFeature::Gene::GeneStructure;
use base qw(Bio::Tools::AnalysisResult);
sub _initialize_state {
my ($self,@args) = @_;
# first call the inherited method!
$self->SUPER::_initialize_state(@args);
# our private state variables
$self->{'_preds_parsed'} = 0;
$self->{'_has_cds'} = 0;
# array of pre-parsed predictions
$self->{'_preds'} = [];
# seq stack
$self->{'_seqstack'} = [];
}
=head2 analysis_method
Usage : $pseudowise->analysis_method();
Purpose : Inherited method. Overridden to ensure that the name matches
/pseudowise/i.
Returns : String
Argument : n/a
=cut
#-------------
sub analysis_method {
#-------------
my ($self, $method) = @_;
if($method && ($method !~ /pseudowise/i)) {
$self->throw("method $method not supported in " . ref($self));
}
return $self->SUPER::analysis_method($method);
}
=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
See Also L<Bio::SeqFeatureI>
=cut
sub next_feature {
return shift->next_prediction(@_);
}
=head2 next_prediction
Title : next_prediction
Usage : while($gene = $pseudowise->next_prediction()) {
# do something
}
Function: Returns the gene of the Pseudowise result
file. Call this method repeatedly until FALSE is returned.
Example :
Returns : a Bio::SeqFeature::Generic
Args : none
See Also L<Bio::SeqFeature::Generic>
=cut
sub next_prediction {
my ($self) = @_;
# if the prediction section hasn't been parsed yet, we do this now
$self->_parse_predictions unless $self->_predictions_parsed;
# get next gene structure
return $self->_prediction();
}
=head2 _parse_predictions
Title : _parse_predictions()
Usage : $obj->_parse_predictions()
Function: Parses the prediction section. Automatically called by
next_prediction() if not yet done.
Example :
Returns :
=cut
sub _parse_predictions {
my ($self) = @_;
my $gene;
my @genes;
local $/= "\n";
local($_);
my %tags;
while (defined( $_ = $self->_readline)){
if( /^(Total codons|\S+)\s+:\s+(\S+)/ ) {
$tags{$1} = $2;
} elsif(m!^//! ) {
if( $gene ) {
$gene = undef;
%tags = ();
}
} elsif (/Gene\s+(\d+)\s*$/i) {
$gene = Bio::SeqFeature::Generic->new
( -primary => 'pseudogene',
-source => 'pseudowise',
-tag => \%tags);
push @genes, $gene;
} elsif( /Gene\s+(\d+)\s+(\d+)/i ) {
if( $1 < $2 ) {
$gene->start($1);
$gene->end($2);
$gene->strand(1);
} else {
$gene->start($2);
$gene->end($1);
$gene->strand(-1);
}
} elsif (/Exon\s+(\d+)\s+(\d+)\s+phase\s+(\S+)/i) {
my ($s,$e,$st) = ($1,$2,1);
if( $s > $e) {
($s,$e,$st)=($e,$s,-1);
}
my $exon = Bio::SeqFeature::Generic->new
( -start => $s,
-end => $e,
-strand => $st,
-primary => 'exon',
-source => 'pseudowise',
-tag => {'frame' => $3});
$gene->add_sub_SeqFeature($exon);
}
}
$self->_add_prediction(\@genes);
$self->_predictions_parsed(1);
}
=head1 _prediction
Title : _prediction()
Usage : $gene = $obj->_prediction()
Function: internal
Example :
Returns :
=cut
sub _prediction {
my ($self) = @_;
return shift(@{$self->{'_preds'} || []});
}
=head2 _add_prediction
Title : _add_prediction()
Usage : $obj->_add_prediction($gene)
Function: internal
Example :
Returns :
=cut
sub _add_prediction {
my ($self, $gene) = @_;
$self->{'_preds'} ||= [];
if( ref($gene) =~ /ARRAY/ ) {
push(@{$self->{'_preds'}}, @$gene);
} else {
push(@{$self->{'_preds'}}, $gene);
}
}
=head2 _predictions_parsed
Title : _predictions_parsed
Usage : $obj->_predictions_parsed
Function: internal
Example :
Returns : TRUE or FALSE
=cut
sub _predictions_parsed {
my ($self, $val) = @_;
$self->{'_preds_parsed'} = $val if $val;
if(! exists($self->{'_preds_parsed'})) {
$self->{'_preds_parsed'} = 0;
}
return $self->{'_preds_parsed'};
}
1;
|