NAME
Bio::Search::Result::GenericResult - Generic Implementation of Bio::Search::Result::ResultI interface applicable to most search results.
SYNOPSIS
# typically one gets Results from a SearchIO stream
use Bio::SearchIO;
my $io = Bio::SearchIO->new(-format => 'blast',
-file => 't/data/HUMBETGLOA.tblastx');
while( my $result = $io->next_result ) {
# process all search results within the input stream
while( my $hit = $result->next_hit ) {
# insert code here for hit processing
}
}
use Bio::Search::Result::GenericResult;
my @hits = (); # would be a list of Bio::Search::Hit::HitI objects
# typically these are created from a Bio::SearchIO stream
my $result = Bio::Search::Result::GenericResult->new
( -query_name => 'HUMBETGLOA',
-query_accession => ''
-query_description => 'Human haplotype C4 beta-globin gene, complete cds.'
-query_length => 3002
-database_name => 'ecoli.aa'
-database_letters => 4662239,
-database_entries => 400,
-parameters => { 'e' => '0.001' },
-statistics => { 'kappa' => 0.731 },
-algorithm => 'blastp',
-algorithm_version => '2.1.2',
);
my $id = $result->query_name();
my $desc = $result->query_description();
my $name = $result->database_name();
my $size = $result->database_letters();
my $num_entries = $result->database_entries();
my $gap_ext = $result->get_parameter('e');
my @params = $result->available_parameters;
my $kappa = $result->get_statistic('kappa');
my @statnames = $result->available_statistics;
# TODO: Show how to configure a SearchIO stream so that it generates # GenericResult objects.
DESCRIPTION
This object is an implementation of the Bio::Search::Result::ResultI interface and provides a generic place to store results from a sequence database search.
Unless you're writing a parser, you won't ever need to create a GenericResult or any other ResultI-implementing object. If you use the SearchIO system, ResultI objects are created automatically from a SearchIO stream which returns Bio::Search::Result::ResultI objects.
For documentation on what you can do with GenericResult (and other ResultI objects), please see the API documentation in Bio::Search::Result::ResultI.
FEEDBACK
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
Support
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 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 via the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Jason Stajich and Steve Chervitz
Email jason@bioperl.org Email sac@bioperl.org
CONTRIBUTORS
Sendu Bala, bix@sendu.me.uk
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : new
Usage : my $obj = Bio::Search::Result::GenericResult->new();
Function: Builds a new Bio::Search::Result::GenericResult object
Returns : Bio::Search::Result::GenericResult
Args : -query_name => Name of query Sequence
-query_accession => Query accession number (if available)
-query_description => Description of query sequence
-query_length => Length of query sequence
-database_name => Name of database
-database_letters => Number of residues in database
-database_entries => Number of entries in database
-hits => array ref of Bio::Search::Hit::HitI objects
-parameters => hash ref of search parameters (key => value)
-statistics => hash ref of search statistics (key => value)
-algorithm => program name (blastx)
-algorithm_version => version of the algorithm (2.1.2)
-algorithm_reference => literature reference string for this algorithm
-rid => value of the BLAST Request ID (eg. RID: ZABJ4EA7014)
-hit_factory => Bio::Factory::ObjectFactoryI capable of making
Bio::Search::Hit::HitI objects
algorithm
Title : algorithm
Usage : my $r_type = $hsp->algorithm
Function: Obtain the name of the algorithm used to obtain the Result
Returns : string (e.g., BLASTP)
Args : [optional] scalar string to set value
algorithm_version
Title : algorithm_version
Usage : my $r_version = $hsp->algorithm_version
Function: Obtain the version of the algorithm used to obtain the Result
Returns : string (e.g., 2.1.2)
Args : [optional] scalar string to set algorithm version value
Bio::Search::Result::ResultI interface methods
Bio::Search::Result::ResultI implementation
next_hit
Title : next_hit
Usage : while( $hit = $result->next_hit()) { ... }
Function: Returns the next available Hit object, representing potential
matches between the query and various entities from the database.
Returns : a Bio::Search::Hit::HitI object or undef if there are no more.
Args : none
query_name
Title : query_name
Usage : $id = $result->query_name();
Function: Get the string identifier of the query used by the
algorithm that performed the search.
Returns : a string.
Args : [optional] new string value for query name
query_accession
Title : query_accession
Usage : $id = $result->query_accession();
Function: Get the accession (if available) for the query sequence
Returns : a string
Args : [optional] new string value for accession
query_gi
Title : query_gi
Usage : $acc = $hit->query_gi();
Function: Retrieve the NCBI Unique ID (aka the GI #),
if available, for the query
Returns : a scalar string (empty string if not set)
Args : none
query_length
Title : query_length
Usage : $id = $result->query_length();
Function: Get the length of the query sequence
used in the search.
Returns : a number
Args : [optional] new integer value for query length
query_description
Title : query_description
Usage : $id = $result->query_description();
Function: Get the description of the query sequence
used in the search.
Returns : a string
Args : [optional] new string for the query description
database_name
Title : database_name
Usage : $name = $result->database_name()
Function: Used to obtain the name of the database that the query was searched
against by the algorithm.
Returns : a scalar string
Args : [optional] new string for the db name
database_letters
Title : database_letters
Usage : $size = $result->database_letters()
Function: Used to obtain the size of database that was searched against.
Returns : a scalar integer (units specific to algorithm, but probably the
total number of residues in the database, if available) or undef if
the information was not available to the Processor object.
Args : [optional] new scalar integer for number of letters in db
database_entries
Title : database_entries
Usage : $num_entries = $result->database_entries()
Function: Used to obtain the number of entries contained in the database.
Returns : a scalar integer representing the number of entities in the database
or undef if the information was not available.
Args : [optional] new integer for the number of sequence entries in the db
get_parameter
Title : get_parameter
Usage : my $gap_ext = $report->get_parameter('gapext')
Function: Returns the value for a specific parameter used
when running this report
Returns : string
Args : name of parameter (string)
available_parameters
Title : available_parameters
Usage : my @params = $report->available_paramters
Function: Returns the names of the available parameters
Returns : Return list of available parameters used for this report
Args : none
get_statistic
Title : get_statistic
Usage : my $gap_ext = $report->get_statistic('kappa')
Function: Returns the value for a specific statistic available
from this report
Returns : string
Args : name of statistic (string)
available_statistics
Title : available_statistics
Usage : my @statnames = $report->available_statistics
Function: Returns the names of the available statistics
Returns : Return list of available statistics used for this report
Args : none
Bio::Search::Report
Bio::Search::Result::GenericResult specific methods
add_hit
Title : add_hit
Usage : $report->add_hit($hit)
Function: Adds a HitI to the stored list of hits
Returns : Number of HitI currently stored
Args : Bio::Search::Hit::HitI
hit_factory
Title : hit_factory
Usage : $hit->hit_factory($hit_factory)
Function: Get/set the factory used to build HitI objects if necessary.
Returns : Bio::Factory::ObjectFactoryI
Args : Bio::Factory::ObjectFactoryI
rewind
Title : rewind
Usage : $result->rewind;
Function: Allow one to reset the Hit iterator to the beginning
Since this is an in-memory implementation
Returns : none
Args : none
_nexthitindex
Title : _nexthitindex
Usage : private
add_parameter
Title : add_parameter
Usage : $report->add_parameter('gapext', 11);
Function: Adds a parameter
Returns : none
Args : key - key value name for this parama
value - value for this parameter
add_statistic
Title : add_statistic
Usage : $report->add_statistic('lambda', 2.3);
Function: Adds a parameter
Returns : none
Args : key - key value name for this parama
value - value for this parameter
num_hits
Title : num_hits
Usage : my $hitcount= $result->num_hits
Function: returns the number of hits for this query result
Returns : integer
Args : none
hits
Title : hits
Usage : my @hits = $result->hits
Function: Returns the available hits for this Result
Returns : Array of L<Bio::Search::Hit::HitI> objects
Args : none
algorithm_reference
Title : algorithm_reference
Usage : $obj->algorithm_reference($newval)
Function:
Returns : string containing literature reference for the algorithm
Args : newvalue string (optional)
Comments: Formerly named program_reference(), which is still supported
for backwards compatibility.
program_reference
Title : program_reference
Usage : $obj->program_reference()
Function:
Returns : string containing literature reference for the algorithm
Args :
Comments: Deprecated - use algorithm_reference() instead.
rid
Title : rid
Usage : $obj->rid($newval)
Function:
Returns : value of the BLAST Request ID (eg. RID: ZABJ4EA7014)
Args : newvalue (optional)
Comments: The default implementation in ResultI returns an empty string
rather than throwing a NotImplemented exception, since
the RID may not always be available and is not critical.
See: (1) https://www.ncbi.nlm.nih.gov/Class/MLACourse/Modules/BLAST/rid.html
(2) https://www.ncbi.nlm.nih.gov/staff/tao/URLAPI/new/node63.html
no_hits_found
See documentation in Bio::Search::Result::ResultI::no_hits_found()
set_no_hits_found
See documentation in Bio::Search::Result::ResultI::set_no_hits_found()
to_string
Title : to_string
Usage : print $blast->to_string;
Function: Returns a string representation for the Blast result.
Primarily intended for debugging purposes.
Example : see usage
Returns : A string of the form:
[GenericResult] <analysis_method> query=<name> <description> db=<database
e.g.:
[GenericResult] BLASTP query=YEL060C vacuolar protease B, db=PDBUNIQ
Args : None