/usr/share/perl5/Bio/Tools/AnalysisResult.pm is in libbio-perl-perl 1.6.924-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 | #
# BioPerl module for Bio::Tools::AnalysisResult
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Hilmar Lapp <hlapp-at-gmx.net>
#
# Copyright Hilmar Lapp
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::AnalysisResult - Base class for analysis result objects and parsers
=head1 SYNOPSIS
# obtain a AnalysisResult derived object somehow
print "Method ", $result->analysis_method(),
", version ", $result->analysis_method_version(),
", performed on ", $result->analysis_date(), "\n";
# annotate a sequence utilizing SeqAnalysisParserI methods
while($feat = $result->next_feature()) {
$seq->add_SeqFeature($feat);
}
$result->close();
# query object, e.g. a Bio::SeqI implementing object
$queryseq = $result->analysis_query();
# Subject of the analysis -- may be undefined. Refer to derived module
# to find out what is returned.
$subject = $result->analysis_subject();
=head1 DESCRIPTION
The AnalysisResult module is supposed to be the base class for modules
encapsulating parsers and interpreters for the result of a analysis
that was carried out with a query sequence.
The notion of an analysis represented by this base class is that of a
unary or binary operator, taking either one query or a query and a
subject and producing a result. The query is e.g. a sequence, and a
subject is either a sequence, too, or a database of sequences.
This module also implements the Bio::SeqAnalysisParserI interface, and
thus can be used wherever such an object fits. See
L<Bio::SeqAnalysisParserI>. Developers will
find a ready-to-use B<parse()> method, but need to implement
B<next_feature()> in an inheriting class. Support for initialization
with input file names and reading from streams is also ready to use.
Note that this module does not provide support for B<running> an
analysis. Rather, it is positioned in the subsequent parsing step
(concerned with turning raw results into BioPerl objects).
=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 - Hilmar Lapp
Email hlapp-at-gmx.net
=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::AnalysisResult;
use strict;
use base qw(Bio::Root::Root Bio::SeqAnalysisParserI Bio::AnalysisResultI Bio::Root::IO);
sub new {
my ($class, @args) = @_;
my $self = $class->SUPER::new(@args);
$self->_initialize(@args);
return $self;
}
sub _initialize {
my($self,@args) = @_;
my $make = $self->SUPER::_initialize(@args);
$self->_initialize_state(@args);
return $make; # success - we hope!
}
=head2 _initialize_state
Title : _initialize_state
Usage : n/a; usually called by _initialize()
Function: This method is for BioPerl B<developers> only, as indicated by the
leading underscore in its name.
Performs initialization or reset of the state of this object. The
difference to _initialize() is that it may be called at any time,
and repeatedly within the lifetime of this object. B<Note>, however,
that this is potentially dangerous in a multi-threading
environment. In general, calling this method twice is discouraged
for this reason.
This method is supposed to reset the state such that any 'history'
is lost. State information that does not change during object
lifetime is not considered as history, e.g. parent, name, etc shall
not be reset. An inheriting object should only be concerned with
state information it introduces itself, and for everything else
call SUPER::_initialize_state(@args).
An example is parsing an input file: a state reset implies
discarding any unread input, and the actual input itself, followed
by setting the new input.
The argument syntax is the same as for L<new()|new> and L<_initialize()|_initialize>,
i.e., named parameters following the -name=>$value convention.
The following parameters are dealt with by the implementation
provided here:
-INPUT, -FH, -FILE
(tags are case-insensitive).
Example :
Returns :
Args :
=cut
sub _initialize_state {
my ($self,@args) = @_;
$self->close();
$self->_initialize_io(@args);
$self->{'_analysis_sbjct'} = undef;
$self->{'_analysis_query'} = undef;
$self->{'_analysis_prog'} = undef;
$self->{'_analysis_progVersion'} = undef;
$self->{'_analysis_date'} = undef;
return 1;
}
# =head2 parse
#
# Title : parse
# Usage : $obj->parse(-input=>$inputobj, [ -params=>[@params] ],
# [ -method => $method ] )
# Function: Sets up parsing for feature retrieval from an analysis file,
# or object.
#
# This method was originally required by SeqAnalysisParserI, but
# is now discouraged due to potential problems in a multi-
# threading environment (CORBA!). If called only once, it doesn't
# add any functionality to calling new() with the same
# parameters.
#
# The implementation provided here calls automatically
# _initialize_state() and passes on -input=>$inputobj and
# @params as final arguments.
# Example :
# Returns : void
# Args : B<input> - object/file where analysis are coming from
# B<params> - parameter to use when parsing/running analysis
# B<method> - method of analysis
#
# =cut
sub parse {
my ($self, @args) = @_;
my ($input, $params, $method) =
$self->_rearrange([qw(INPUT
PARAMS
METHOD
)],
@args);
# initialize with new input
if($params) {
$self->_initialize_state('-input' => $input, @$params);
} else {
$self->_initialize_state('-input' => $input);
}
$self->analysis_method($method) if $method;
}
=head2 analysis_query
Usage : $query_obj = $result->analysis_query();
Purpose : Set/Get the name of the query used to generate the result, that
is, the entity on which the analysis was performed. Will mostly
be a sequence object (Bio::PrimarySeq compatible).
Argument :
Returns : The object set before. Mostly a Bio::PrimarySeq compatible object.
=cut
#--------
sub analysis_query {
my ($self, $obj) = @_;
if($obj) {
$self->{'_analysis_query'} = $obj;
}
return $self->{'_analysis_query'};
}
#--------
=head2 analysis_subject
Usage : $result->analyis_subject();
Purpose : Set/Get the subject of the analysis against which it was
performed. For similarity searches it will probably be a database,
and for sequence feature predictions (exons, promoters, etc) it
may be a collection of models or homologous sequences that were
used, or undefined.
Returns : The object that was set before, or undef.
Argument :
=cut
#---------------
sub analysis_subject {
#---------------
my ($self, $sbjct_obj) = @_;
if($sbjct_obj) {
$self->{'_analysis_sbjct'} = $sbjct_obj;
}
return $self->{'_analysis_sbjct'};
}
=head2 analysis_date
Usage : $result->analysis_date();
Purpose : Set/Get the date on which the analysis was performed.
Returns : String
Argument :
Comments :
=cut
#----------
sub analysis_date {
my ($self, $date) = @_;
if($date) {
$self->{'_analysis_date'} = $date;
}
return $self->{'_analysis_date'};
}
#----------
=head2 analysis_method
Usage : $result->analysis_method();
Purpose : Set/Get the name of the sequence analysis method that was used
to produce this result (BLASTP, FASTA, etc.). May also be the
actual name of a program.
Returns : String
Argument : n/a
=cut
#-------------
sub analysis_method {
#-------------
my ($self, $method) = @_;
if($method) {
$self->{'_analysis_prog'} = $method;
}
return $self->{'_analysis_prog'};
}
=head2 analysis_method_version
Usage : $result->analysis_method_version();
Purpose : Set/Get the version string of the analysis program.
: (e.g., 1.4.9MP, 2.0a19MP-WashU).
Returns : String
Argument : n/a
=cut
#---------------------
sub analysis_method_version {
#---------------------
my ($self, $version) = @_;
if($version) {
$self->{'_analysis_progVersion'} = $version;
}
return $self->{'_analysis_progVersion'};
}
1;
|