Bio::S...llHitI(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ NAME ✨

okay so bestie, welcome to Bio::Search::Hit::PullHitI(3pm) β€” it lives in the User Contributed Perl Documentation section, and honestly? iconic.

Bio::Search::Hit::PullHitI β€” it's the Bio::Search::Hit::HitI interface, but make it pull. πŸ’…


🌈 SYNOPSIS 🌈

so like, real talk: this is an interface, you literally cannot instantiate it. periodt.

# This is an interface and cannot be instantiated

# typically one gets HitI objects from a SearchIO stream via a ResultI
use Bio::SearchIO;
my $parser = Bio::SearchIO->new(-format => 'hmmer_pull',
                               -file => 't/data/hmmpfam.out');

my $result = $parser->next_result;
my $hit    = $result->next_hit;

$hit_name = $hit->name();

$desc = $hit->description();

$len = $hit->length

$alg = $hit->algorithm();

$score = $hit->raw_score();

$significance = $hit->significance();

$rank = $hit->rank(); # the Nth hit for a specific query

while( $hsp = $obj->next_hsp()) { ... } # process in iterator fashion

for my $hsp ( $obj->hsps()()) { ... } # process in list fashion

πŸ’… DESCRIPTION πŸ’…

This object is the one holding down all the hit data that comes out of a database sequence search. 🧚

PullHitI is for the fast girlies β€” the implementations that only bother doing the parsing work on the hit data at the exact moment you actually ask for info by calling one of the HitI methods. lazy in the best way fr fr. πŸ¦‹

A bunch of the HitI methods are implemented here in a way that's suitable for classes inheriting from it that use Bio::PullParserI. and lowkey, it only really makes sense for PullHit modules to be created by PullResult modules (and to have one as a -parent).

So besides the usual -chunk and -parent, -hit_data is literally all you should be supplying when you make a PullHit object. It'll store that data and make it reachable via _raw_hit_data, which you can grab in your subclass. and ngl, it would be best to just hand the data over as the input -chunk instead, if the raw data is big enough. πŸ’–


🫢 FEEDBACK 🫢

πŸ’Œ Mailing Lists

User feedback is a whole integral part of the evolution of this and other Bioperl modules, no cap. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is so 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 sliding into the module maintainer's DMs directly. There are lots of experienced and reponsive experts who 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 so we can keep track the bugs and their resolution. Bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues

πŸ‘‘ AUTHOR - Sendu Bala πŸ‘‘

Email bix@sendu.me.uk


Copyright (c) 2006 Sendu Bala. All Rights Reserved.


⚠️ DISCLAIMER ⚠️

This software is provided "as is" without warranty of any kind.

fr fr, take that seriously β€” no warranty, none, zero. 😭

πŸ“– APPENDIX πŸ“–

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _.


πŸ”§ _setup

  • Title : _setup
  • Usage : $self->_setup(@args)
  • Function: Implementers should call this to setup common fields and deal with common arguments to new().
  • Returns : n/a
  • Args : @args received in new().

🌸 name

  • Title : name
  • Usage : $hit_name = $hit->name();
  • Function: returns the name of the Hit sequence
  • Returns : a scalar string
  • Args : none

The name of a hit is unique within a Result or within an Iteration. πŸ‘‘


πŸ’œ description

  • Title : description
  • Usage : $desc = $hit->description();
  • Function: Retrieve the description for the hit
  • Returns : a scalar string
  • Args : none

πŸŽ€ accession

  • Title : accession
  • Usage : $acc = $hit->accession();
  • Function: Retrieve the accession (if available) for the hit
  • Returns : a scalar string (empty string if not set)
  • Args : none

πŸ¦‹ locus

  • Title : locus
  • Usage : $acc = $hit->locus();
  • Function: Retrieve the locus(if available) for the hit
  • Returns : a scalar string (empty string if not set)
  • Args : none

πŸ“ length

  • Title : length
  • Usage : my $len = $hit->length
  • Function: Returns the length of the hit
  • Returns : integer
  • Args : none

🧬 algorithm

  • Title : algorithm
  • Usage : $alg = $hit->algorithm();
  • Function: Gets the algorithm specification that was used to obtain the hit. For BLAST, the algorithm denotes what type of sequence was aligned against what (BLASTN: dna-dna, BLASTP prt-prt, BLASTX translated dna-prt, TBLASTN prt-translated dna, TBLASTX translated dna-translated dna).
  • Returns : a scalar string
  • Args : none

πŸ”₯ raw_score

  • Title : raw_score
  • Usage : $score = $hit->raw_score();
  • Function: Gets the "raw score" generated by the algorithm. What this score is exactly will vary from algorithm to algorithm, returning undef if unavailable.
  • Returns : a scalar value
  • Args : none

🫢 score

Equivalent to raw_score()


πŸ“Š significance

  • Title : significance
  • Usage : $significance = $hit->significance();
  • Function: Used to obtain the E or P value of a hit, i.e. the probability that this particular hit was obtained purely by random chance. If information is not available (nor calculatable from other information sources), return undef.
  • Returns : a scalar value or undef if unavailable
  • Args : none

⭐ bits

  • Usage : $hit_object->bits();
  • Purpose : Gets the bit score of the best HSP for the current hit.
  • Example : $bits = $hit_object->bits();
  • Returns : Integer or double for FASTA reports
  • Argument : n/a
  • Comments : For BLAST1, the non-bit score is listed in the summary line.
  • See Also : score()

πŸ” next_hsp

  • Title : next_hsp
  • Usage : while( $hsp = $obj->next_hsp()) { ... }
  • Function : Returns the next available High Scoring Pair
  • Example :
  • Returns : Bio::Search::HSP::HSPI object or null if finished
  • Args : none

🌈 hsps

  • Usage : $hit_object->hsps();
  • Purpose : Get a list containing all HSP objects. Get the numbers of HSPs for the current hit.
  • Example : @hsps = $hit_object->hsps(); $num = $hit_object->hsps(); # alternatively, use num_hsps()
  • Returns :
    • Array context : list of Bio::Search::HSP::BlastHSP objects.
    • Scalar context: integer (number of HSPs). (Equivalent to num_hsps()).
  • Argument : n/a. Relies on wantarray
  • Throws : Exception if the HSPs have not been collected.
  • See Also : hsp(), num_hsps()

πŸ”’ num_hsps

  • Usage : $hit_object->num_hsps();
  • Purpose : Get the number of HSPs for the present Blast hit.
  • Example : $nhsps = $hit_object->num_hsps();
  • Returns : Integer
  • Argument : n/a
  • Throws : Exception if the HSPs have not been collected.
  • See Also : hsps()

🧚 seq_inds

  • Usage : $hit->seq_inds( seq_type, class, collapse );
  • Purpose : Get a list of residue positions (indices) across all HSPs for identical or conserved residues in the query or sbjct sequence.
  • Example : @s_ind = $hit->seq_inds('query', 'identical'); @h_ind = $hit->seq_inds('hit', 'conserved'); @h_ind = $hit->seq_inds('hit', 'conserved', 1);
  • Returns : Array of integers. May include ranges if collapse is non-zero.
  • Argument :
    • [0] seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')
    • [1] class = 'identical' or 'conserved' or 'nomatch' or 'gap' (default = 'identical') (can be shortened to 'id' or 'cons'). Note that 'conserved' includes identical unless you use 'conserved-not-identical'
    • [2] collapse = boolean, if non-zero, consecutive positions are merged using a range notation, e.g., "1 2 3 4 5 7 9 10 11" collapses to "1-5 7 9-11". This is useful for consolidating long lists. Default = no collapse.
  • Throws : n/a.
  • See Also : Bio::Search::HSP::HSPI::seq_inds()

βͺ rewind

  • Title : rewind
  • Usage : $hit->rewind;
  • Function: Allow one to reset the HSP iterator to the beginning if possible
  • Returns : none
  • Args : none

πŸ’€ overlap

  • Usage : $hit_object->overlap( [integer] );
  • Purpose : Gets/Sets the allowable amount overlap between different HSP sequences.
  • Example : $hit_object->overlap(5); $overlap = $hit_object->overlap;
  • Returns : Integer.
  • Argument : integer.
  • Throws : n/a
  • Status : Deprecated
  • Comments : This value isn't used for anything
deprecated AND useless?? it's giving ghost of methods past. don't build your whole personality on this one bestie. πŸ’€

πŸ”’ n

  • Usage : $hit_object->n();
  • Purpose : Gets the N number for the current Blast hit. This is the number of HSPs in the set which was ascribed the lowest P-value (listed on the description line). This number is not the same as the total number of HSPs. To get the total number of HSPs, use num_hsps().
  • Example : $n = $hit_object->n();
  • Returns : Integer
  • Argument : n/a
  • Throws : Exception if HSPs have not been set (BLAST2 reports).
  • Comments : Note that the N parameter is not reported in gapped BLAST2. Calling n() on such reports will result in a call to num_hsps(). The num_hsps() method will count the actual number of HSPs in the alignment listing, which may exceed N in some cases.
  • See Also : num_hsps()

🌸 p

Usage:

$hit_object->p( [format] );

Purpose: get the P-value for the best HSP of this BLAST hit. quick disclaimer bestie: P-values are not provided with NCBI Blast2 reports, so don't be shocked when there's nothing there.

Example:

$p =  $sbjct->p;
$p =  $sbjct->p('exp');  # get exponent only.
($num, $exp) =  $sbjct->p('parts'); # split sci notation into parts

Returns:

  • Float or scientific notation number (the raw P-value, DEFAULT).
  • Integer if format == 'exp' (the magnitude of the base 10 exponent).
  • 2-element list (float, int) if format == 'parts' and the P-value is in scientific notation (See Comments).

Argument: format: string of 'raw' | 'exp' | 'parts'

  • 'raw' returns value given in report. Default. (1.2e-34)
  • 'exp' returns exponent value only (34)
  • 'parts' returns the decimal and exponent as a 2-element list (1.2, -34) (See Comments).

Throws: Warns if no P-value is defined. Uses expect instead. (sneaky little substitution, iykyk)

Comments: lowkey do not use the 'parts' argument, it's not recommended β€” it will not work as expected if the P-value isn't already in scientific notation. That is, floats are <em>not</em> converted into sci notation before splitting into parts. πŸ’€

See Also: expect(), signif(), Bio::Search::BlastUtils::get_exponent()


✨ hsp

Usage:

$hit_object->hsp( [string] );

Purpose: grab a single HSPI object for the HitI object you've got right now.

Example:

$hspObj  = $hit_object->hsp;  # same as 'best'
$hspObj  = $hit_object->hsp('best');
$hspObj  = $hit_object->hsp('worst');

Returns: Object reference for a Bio::Search::HSP::HSPI object.

Argument: String (or no argument).

  • No argument (default) = highest scoring HSP (same as 'best').
  • 'best' = highest scoring HSP.
  • 'worst' = lowest scoring HSP.

Throws: Exception if an unrecognized argument is used. read the options bestie

See Also: hsps(), num_hsps()


πŸ¦‹ logical_length

Usage:

$hit_object->logical_length( [seq_type] );
(mostly intended for internal use).

Purpose: get the logical length of the hit sequence. If the Blast is a TBLASTN or TBLASTX, the length you get back is the length of the would-be amino acid sequence (length/3). For every other BLAST flavor, this function is literally just the same as length().

Example:

$len    = $hit_object->logical_length();

Returns: Integer

Argument: seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')

Throws: n/a

Comments: this matters for functions like frac_aligned_query() which need to operate in amino acid coordinate space when dealing with [T]BLAST[NX] type reports. science ✨

See Also: length(), frac_aligned_query(), frac_aligned_hit()


πŸ’œ rank

Title: rank

Usage: $obj->rank($newval)

Function: Get/Set the rank of this Hit in the Query search list β€” i.e. this is the Nth hit for a specific query.

Returns: value of rank

Args: newvalue (optional)


πŸŽ€ each_accession_number

Title: each_accession_number

Usage: $obj->each_accession_number

Function: get each accession number listed in the description of the hit. If there are no alternatives, then only the primary accession will be given (if there is one).

Returns: list of all accession numbers in the description

Args: none


πŸ‘‘ tiled_hsps

Usage:

$hit_object->tiled_hsps( [integer] );

Purpose: Gets/Sets an indicator for whether or not the HSPs in this Hit have been tiled.

Example:

$hit_object->tiled_hsps(1);
if( $hit_object->tiled_hsps ) { # do something }

Returns: Boolean (1 or 0)

Argument: integer (optional)

Throws: n/a

Status: Deprecated πŸ™ˆ

Notes: This value is not used for anything. fr fr, it does nothing


🌈 strand

Usage:

$sbjct->strand( [seq_type] );

Purpose: gets the strand(s) for the query, sbjct, or both sequences in the best HSP of the BlastHit object after HSP tiling. Only valid for BLASTN, TBLASTX, BLASTX-query, TBLASTN-hit.

Example:

$qstrand = $sbjct->strand('query');
$sstrand = $sbjct->strand('hit');
($qstrand, $sstrand) = $sbjct->strand();

Returns:

  • scalar context: integer '1', '-1', or '0'
  • array context without args: list of two strings (queryStrand, sbjctStrand)
  • Array context can be "induced" by providing an argument of 'list' or 'array'.

Argument: In scalar context: seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')

Throws: n/a

Comments: this method requires that all HSPs be tiled. If they haven't already been tiled, they will be tiled first, automatically, no asking. πŸ’…

If you don't want the tiled data, iterate through each HSP calling strand() on each (use hsps() to get all HSPs).

Formerly (prior to 10/21/02), this method would return the string "-1/1" for hits with HSPs on both strands. But now that strand and frame is properly being accounted for during HSP tiling, it makes way more sense for strand() to return the strand data for the best HSP after tiling.

If you really want to know about hits on opposite strands, you should be iterating through the HSPs using methods on the HSP objects.

A possible use case where knowing whether a hit has HSPs on both strands would be when filtering via SearchIO for hits with this property. However, in this case it would be better to have a dedicated method such as $hit->hsps_on_both_strands(). Similarly for frame. This could be provided if there is interest. (hint hint, manifest it)

See Also: Bio::Search::HSP::HSPI::strand()


🧚 frame

Usage:

$hit_object->frame();

Purpose: gets the reading frame for the best HSP after HSP tiling. This is only valid for BLASTX and TBLASTN/X type reports.

Example:

$frame = $hit_object->frame();

Returns: Integer (-2 .. +2)

Argument: n/a

Throws: Exception if HSPs have not been set.

Comments: this method requires that all HSPs be tiled. If they haven't already been tiled, they will be tiled first, automatically, bestie. ✨

If you don't want the tiled data, iterate through each HSP calling frame() on each (use hsps() to get all HSPs).

See Also: hsps()


πŸ“ length_aln

Usage:

$hit_object->length_aln( [seq_type] );

Purpose: get the total length of the aligned region for the query or sbjct seq. This number will include all HSPs, and excludes gaps.

Example:

$len    = $hit_object->length_aln(); # default = query
$lenAln = $hit_object->length_aln('query');

Returns: Integer

Argument: seq_Type = 'query' or 'hit' or 'sbjct' (Default = 'query') ('sbjct' is synonymous with 'hit')

Throws: Exception if the argument is not recognized.

Comments: this method will report the logical length of the alignment, meaning that for TBLAST[NX] reports, the length is reported using amino acid coordinate space (i.e., nucleotides / 3). math slay

See Also: length(), frac_aligned_query(), frac_aligned_hit(), gaps(), Bio::Search::SearchUtils::tile_hsps(), Bio::Search::HSP::BlastHSP::length()


πŸ’– gaps

Usage:

$hit_object->gaps( [seq_type] );

Purpose: get the number of gaps in the aligned query, hit, or both sequences. Data is summed across all HSPs.

Example:

$qgaps = $hit_object->gaps('query');
$hgaps = $hit_object->gaps('hit');
$tgaps = $hit_object->gaps();    # default = total (query + hit)

Returns:

  • scalar context: integer
  • array context without args: two-element list of integers (queryGaps, hitGaps)
  • Array context can be forced by providing an argument of 'list' or 'array'.
⚠️ CAUTION: Calling this method within printf or sprintf is array context. So this function may not give you what you expect. For example: printf "Total gaps: %d", $hit->gaps(); Actually returns a two-element array, so what gets printed is the number of gaps in the query, not the total. πŸ’€ bestie be careful

Argument: seq_type: 'query' | 'hit' or 'sbjct' | 'total' | 'list' (default = 'total') ('sbjct' is synonymous with 'hit')

Comments: if you need data for each HSP, use hsps() and then iterate through each HSP object.


⭐ matches

Usage:

$hit_object->matches( [class] );

Purpose: get the total number of identical or conserved matches (or both) across all HSPs. (Note: 'conservative' matches are indicated as 'positives' in BLAST reports.)

Example:

($id,$cons) = $hit_object->matches(); # no argument
$id = $hit_object->matches('id');
$cons = $hit_object->matches('cons');

Returns: Integer or a 2-element array of integers

Argument:

  • [0] class = 'id' | 'cons' OR none.
  • [1] seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')

If no argument is provided, both identical and conservative numbers are returned in a two element list.

(Other terms can be used to refer to the conservative matches, e.g., 'positive'. All that is checked is whether or not the supplied string starts with 'id'. If not, the conservative matches are returned.) that's the whole vibe check right there

πŸŽ€ start πŸŽ€

  • Usage: $sbjct->start( [seq_type] );
  • Purpose: grabs the start coordinate for the query, the sbjct, or literally both sequences in the object. And if there's more than one HSP? You get the lowest start value out of all of them. bestie behaviour honestly.
  • Example:
$qbeg = $sbjct->start('query');
$sbeg = $sbjct->start('hit');
($qbeg, $sbeg) = $sbjct->start();
  • Returns: in scalar context, an integer. In array context with no args, a list of two integers (queryStart, sbjctStart). Array context can also be "induced" if you pass an argument of 'list' or 'array' πŸ‘‘
  • Argument: 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')

πŸ¦‹ end πŸ¦‹

  • Usage: $sbjct->end( [seq_type] );
  • Purpose: gets the end coordinate for the query, sbjct, or both sequences in the object. If there's more than one HSP, the largest end value of all HSPs is what comes back. no cap.
  • Example:
$qend = $sbjct->end('query');
$send = $sbjct->end('hit');
($qend, $send) = $sbjct->end();
  • Returns: scalar context β†’ integer. Array context with no args β†’ list of two integers (queryEnd, sbjctEnd). Array context can be "induced" by providing an argument of 'list' or 'array' ✨
  • Argument: 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')

🌈 range 🌈

  • Usage: $sbjct->range( [seq_type] );
  • Purpose: gets the (start, end) coordinates for the query or sbjct sequence in the HSP alignment. it's giving "both numbers, one call" πŸ’…
  • Example:
($qbeg, $qend) = $sbjct->range('query');
($sbeg, $send) = $sbjct->range('hit');
  • Returns: two-element array of integers
  • Argument: seq_type = string, 'query' or 'hit' or 'sbjct' (default = 'query') ('sbjct' is synonymous with 'hit')
  • Throws: n/a
  • See Also: start(), end()

πŸ“ frac_identical πŸ“

  • Usage: $hit_object->frac_identical( [seq_type] );
  • Purpose: gets the overall fraction of identical positions across all HSPs. Heads up tho β€” this number only refers to the aligned regions and does not account for unaligned regions in between the HSPs, if any πŸ™ˆ
  • Example: $frac_iden = $hit_object->frac_identical('query');
  • Returns: Float (2-decimal precision, e.g., 0.75).
  • Argument: seq_type: 'query' | 'hit' or 'sbjct' | 'total', default = 'query' (but see comments below). ('sbjct' is synonymous with 'hit')

🌸 frac_conserved 🌸

  • Usage: $hit_object->frac_conserved( [seq_type] );
  • Purpose: gets the overall fraction of conserved positions across all HSPs. Same deal as before: the number refers to only the aligned regions and does not account for unaligned regions in between the HSPs, if any πŸ’–
  • Example: $frac_cons = $hit_object->frac_conserved('hit');
  • Returns: Float (2-decimal precision, e.g., 0.75).
  • Argument: seq_type: 'query' | 'hit' or 'sbjct' | 'total', default = 'query' (but see comments below). ('sbjct' is synonymous with 'hit')

🧚 frac_aligned_query 🧚

  • Usage: $hit_object->frac_aligned_query();
  • Purpose: gets the fraction of the query sequence which has been aligned across all HSPs β€” and nope, that does not include the intervals between non-overlapping HSPs, bestie.
  • Example: $frac_alnq = $hit_object->frac_aligned_query();
  • Returns: Float (2-decimal precision, e.g., 0.75).
  • Argument: none
  • Comments: if you need data for each HSP, use hsps() and then interate through the HSP objects.

πŸ’œ frac_aligned_hit πŸ’œ

  • Usage: $hit_object->frac_aligned_hit();
  • Purpose: gets the fraction of the hit (sbjct) sequence which has been aligned across all HSPs β€” again, not including the intervals between non-overlapping HSPs ✨
  • Example: $frac_alnq = $hit_object->frac_aligned_hit();
  • Returns: Float (2-decimal precision, e.g., 0.75).
  • Argument: none
  • Comments: if you need data for each HSP, use hsps() and then interate through the HSP objects.

πŸ”₯ num_unaligned_hit πŸ”₯

  • Usage: $hit_object->num_unaligned_hit();
  • Purpose: gets the number of the unaligned residues in the hit sequence. Sums across all all HSPs. πŸ‘‘
  • Example: $num_unaln = $hit_object->num_unaligned_hit();
  • Returns: Integer
  • Argument: none
  • Comments: if you need data for each HSP, use hsps() and then interate through the HSP objects.

⭐ num_unaligned_query ⭐

  • Usage: $hit_object->num_unaligned_query();
  • Purpose: gets the number of the unaligned residues in the query sequence. Sums across all all HSPs. periodt.
  • Example: $num_unaln = $hit_object->num_unaligned_query();
  • Returns: Integer
  • Argument: none
  • Comments: if you need data for each HSP, use hsps() and then interate through the HSP objects.

and that's the whole page, bestie!! 🫢 you made it all the way to the end, which is honestly main character energy.

this icon of a doc is perl v5.32.1, dated 2021-08-15, and it lives under Bio::S...llHitI(3pm) β€” go forth and align something, iykyk πŸ’–

πŸ“¦ where this page comes from