Bio::S...Result(3pm)
π Bio::Search::Result::GenericResult β the manual, bestie edition π
User Contributed Perl Documentation Β· Bio::S...Result(3pm)
okay so. you found the manual page for Bio::Search::Result::GenericResult and honestly? iconic of you. grab a strawberry π and let's get into it.
β¨ NAME β¨
Bio::Search::Result::GenericResult β a Generic Implementation of the Bio::Search::Result::ResultI interface that's applicable to most search results. she's the general-purpose girlie. she fits basically everywhere. π
πΈ SYNOPSIS πΈ
here's the whole vibe, verbatim, no notes:
# 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.
(and yes, that last line is a TODO that lives in the source, we're keeping it fr fr β someone's gonna get to it. someday. π)
π¦ DESCRIPTION π¦
so what is this thing? GenericResult is an implementation of the Bio::Search::Result::ResultI interface, and it gives you a generic place to store results from a sequence database search. a little home for your search output. a cozy lil apartment for data. π β¨
here's the tea though β unless you're literally writing a parser, you will never need to create a GenericResult or any other ResultI-implementing object yourself. like, never ever. π if you're using the SearchIO system, ResultI objects just appear, auto-magically, created from a SearchIO stream which returns Bio::Search::Result::ResultI objects. the stream does the work, you do the vibing. π
and if you wanna know what you can actually do with a GenericResult (or any other ResultI object), the API documentation lives over in Bio::Search::Result::ResultI. go read that one, bestie, it's the real main character. ππ
π FEEDBACK π
π¬ Mailing Lists
user feedback is an integral part of the evolution of this and other Bioperl modules β like, genuinely, the whole thing grows because people talk to each other. 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
okay important, pls read this part: direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
...and not to the module maintainer directly. (respect the maintainer's peace, bestie. π) there are many experienced and reponsive experts on the list who'll be able to look at the problem and quickly address it. and if you can, include a thorough description of the problem with code and data examples β the more detail the better, it helps so much. β¨
π Reporting Bugs
report bugs to the Bioperl bug tracking system so we can keep track of the bugs and their resolution β that's the whole point, we wanna know what got fixed. 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
to be continued, bestie... π
πΈ APPENDIX πΈ
okay so this is the deep-lore part π the rest of the docs break down every single object method, one by one, no skips. Internal methods are the shy ones β they usually start with an underscore, _. iykyk π
β¨ new
- Title β new
- Usage β
my $obj = Bio::Search::Result::GenericResult->new(); - Function β builds you a shiny new
Bio::Search::Result::GenericResultobject - Returns β
Bio::Search::Result::GenericResult - Args β all of these cuties, and yes they're exact:
-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 β hands you the name of the algorithm that was used to obtain the Result
- Returns β a string, like
BLASTP - Args β
[optional]scalar string if you wanna set the value
π§ algorithm_version
- Title β algorithm_version
- Usage β
my $r_version = $hsp->algorithm_version - Function β hands you the version of the algorithm that was used to obtain the Result
- Returns β a string, like
2.1.2 - Args β
[optional]scalar string to set the algorithm version value
π Bio::Search::Result::ResultI interface methods
Bio::Search::Result::ResultI implementation β this is the interface flex, periodt.
π« next_hit
- Title β next_hit
- Usage β
while( $hit = $result->next_hit()) { ... } - Function β returns the next available Hit object, aka potential matches between the query and all the various entities from the database
- Returns β a
Bio::Search::Hit::HitIobject, orundefif there are no more (rip π«Ά) - 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 it's not set)
- Args β none
π« query_length
- Title β query_length
- Usage β
$id = $result->query_length(); - Function β get the length of the query sequence that was 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 that was 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 the database that was searched against
- Returns β a scalar integer (units are algorithm-specific, but it's probably the total number of residues in the database, if available) or
undefif the information wasn't 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
undefif the information wasn't 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 that was 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
not me pointing out that the usage line above literally says available_paramters π that's the original spelling, bestie, we keep it exactly as-is, no editing the lore.
π« 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 β the house-specific ones, main character energy only.
π add_hit
- Title β add_hit
- Usage β
$report->add_hit($hit) - Function β adds a
HitIto the stored list of hits - Returns β number of
HitIcurrently 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
HitIobjects if necessary - Returns β
Bio::Factory::ObjectFactoryI - Args β
Bio::Factory::ObjectFactoryI
π rewind
- Title β rewind
- Usage β
$result->rewind; - Function β lets you reset the Hit iterator back to the beginning, since this is an in-memory implementation
- Returns β none
- Args β none
π _nexthitindex
- Title β
_nexthitindex - Usage β private π (that's it, that's the whole entry)
π add_parameter
- Title β add_parameter
- Usage β
$report->add_parameter('gapext', 11); - Function β adds a parameter
- Returns β none
- Args β
keyβ key value name for this paramavalueβ 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 paramavalueβ 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 β (left blank in the original, bestie, we do not invent lore)
- Returns β string containing the 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 β (blank in the original, no cap)
- Returns β string containing the literature reference for the algorithm
- Args β (blank)
- Comments β Deprecated β use
algorithm_reference()instead. π
π rid
- Title β rid
- Usage β
$obj->rid($newval) - Function β (blank in the original)
- Returns β value of the BLAST Request ID (eg.
RID: ZABJ4EA7014) - Args β newvalue (optional)
- Comments β the default implementation in
ResultIreturns an empty string rather than throwing aNotImplementedexception, 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
and that's the whole page, bestie π no details dropped, everyTitle,Usage,Function,Returns,Args, andCommentssurvived the vibe check intact.
this edition was perl v5.32.1, dated 2021-08-15, and it's the Bio::S...Result(3pm) page β go forth and next_hit() responsibly π
β¨
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms