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

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

okay bestie, buckle up πŸ’– this is Bio::S...ricHit(3pm) from the Bioperl User Contributed Perl Documentation β€” the group chat has been begging for this one, and ngl it's a long one, so we're doing it in parts. Part one starts now. periodt. ✨


πŸŽ€ NAME πŸŽ€

Bio::Search::Hit::GenericHit β€” it's a generic implementation of the Bio::Search::Hit::HitI interface. that's the whole name. iconic behaviour honestly πŸ’…


✨ SYNOPSIS ✨

use Bio::Search::Hit::GenericHit;
my $hit = Bio::Search::Hit::GenericHit->new(-algorithm => 'blastp');

# typically one gets HitI objects from a SearchIO stream via a ResultI
use Bio::SearchIO;
my $parser = Bio::SearchIO->new(-format => 'blast', -file => 'result.bls');

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

# TODO: Describe how to configure a SearchIO stream so that it generates
#       GenericHit objects.

so you can make one by hand, but the typical main-character route is letting SearchIO hand you one through a ResultI. also shoutout to that TODO β€” it's still sitting there, unbothered, in the source. we respect the honesty 🫢


🌸 DESCRIPTION 🌸

This object handles the hit data from a Database Sequence Search such as FASTA or BLAST. like, that's its whole job. it's the hit-data girlie.

Unless you're writing a parser, you will never need to create a GenericHit or any other HitI-implementing object yourself. fr fr. If you're using the SearchIO system, HitI objects just materialise automatically from a SearchIO stream that returns Bio::Search::Hit::HitI objects. no assembly required, bestie πŸ¦‹

For docs on what you can actually do with GenericHit (and other HitI objects), go read the API documentation in Bio::Search::Hit::HitI. that's where the real lore lives πŸ‘‘


πŸ’Œ 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. yes, yours. they want you specifically. no pressure πŸ’–

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. why? because many experienced and responsive experts will be able to look at the problem and quickly address it. way better odds than DMing one person, lowkey genius.

Please include a thorough description of the problem with code and data examples if at all possible. the more receipts you bring, the faster someone can help πŸ”

πŸ› 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-at-bioperl-dot-org Email sac-at-bioperl-dot-org

legends. both of them. πŸ’œ


🌈 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 _. so if you see an underscore, that's the private business, don't touch it πŸ’…


πŸ†• new

  • Title: new
  • Usage: my $obj = Bio::Search::Hit::GenericHit->new();
  • Function: Builds a new Bio::Search::Hit::GenericHit object
  • Returns: Bio::Search::Hit::GenericHit
  • Args:
-name         => Name of Hit (required)
-description  => Description (optional)
-accession    => Accession number (optional)
-ncbi_gi      => NCBI GI UID (optional)
-length       => Length of the Hit (optional)
-score        => Raw Score for the Hit (optional)
-bits         => Bit Score for the Hit (optional)
-significance => Significance value for the Hit (optional)
-algorithm    => Algorithm used (BLASTP, FASTX, etc...)
-hsps         => Array ref of HSPs for this Hit.
-found_again  => boolean, true if hit appears in a
                 "previously found" section of a PSI-Blast report.
-hsp_factory  => Bio::Factory::ObjectFactoryI able to create HSPI
                 objects.
heads up bestie: -name is the required one. everything else is vibes-optional 🌸

βž• add_hsp

  • Title: add_hsp
  • Usage: $hit->add_hsp($hsp)
  • Function: Add a HSP to the collection of HSPs for a Hit
  • Returns: number of HSPs in the Hit
  • Args: Bio::Search::HSP::HSPI object, OR hash ref containing data suitable for creating a HSPI object (&hsp_factory must be set to get it back)

🏭 hsp_factory

  • Title: hsp_factory
  • Usage: $hit->hsp_factory($hsp_factory)
  • Function: Get/set the factory used to build HSPI objects if necessary.
  • Returns: Bio::Factory::ObjectFactoryI
  • Args: Bio::Factory::ObjectFactoryI

🧬 Bio::Search::Hit::HitI methods

Implementation of Bio::Search::Hit::HitI methods


🏷️ name

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

πŸ”‘ 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

πŸ“ description

  • Title: description
  • Usage: $desc = $hit->description();
  • Function: Retrieve the description for the hit
  • Returns: a scalar string
  • Args: [optional] scalar string to set the description

πŸ“ length

  • Title: length
  • Usage: my $len = $hit->length
  • Function: Returns the length of the hit
  • Returns: integer
  • Args: [optional] integer to set the length

βš™οΈ 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: [optional] scalar string to set the algorithm

πŸ’― 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: [optional] scalar value to set the raw score

🟰 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: [optional] scalar value to set the significance

πŸ₯‡ 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 undef if bit score is not set
  • 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: (none given β€” it's giving mysterious πŸ«₯)
  • 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.pm 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 hit.
  • Example: $nhsps = $hit_object->num_hsps();
  • Returns: Integer or '-' if HSPs have not been callected
  • Argument: n/a
  • See Also: hsps()
bestie that's literally how the original spells it β€” "callected" πŸ’€ we keep the facts, and we keep the typos, because the facts include the typos.

βͺ rewind

  • Title: rewind
  • Usage: $hit->rewind;
  • Function: Allow one to reset the HSP iterator to the beginning Since this is an in-memory implementation
  • Returns: none
  • Args: none

❓ ambiguous_aln

  • Usage: $ambig_code = $hit_object->ambiguous_aln();
  • Purpose: Sets/Gets ambiguity code data member.
  • Example: (see usage)
  • Returns: String = 'q', 's', 'qs', '-'
    • 'q' = query sequence contains overlapping sub-sequences while sbjct does not.
    • 's' = sbjct sequence contains overlapping sub-sequences while query does not.
    • 'qs' = query and sbjct sequence contains overlapping sub-sequences relative to each other.
    • '-' = query and sbjct sequence do not contains multiple domains relative to each other OR both contain the same distribution of similar domains.
  • Argument: n/a
  • Throws: n/a
  • Comment: Note: "sbjct" is synonymous with "hit"

πŸ«‚ overlap

See documentation in Bio::Search::Hit::HitI::overlap()


πŸ… n

  • Usage: $hit_object->n();
  • Purpose: Gets the N number for the current 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()

okay bestie that's part one done and the tea is still brewing β˜•βœ¨ there's more coming, don't go anywhere β€”

p πŸ’–

okay so this one hands you the P-value for the best HSP of the BLAST hit you're holding, bestie. one tiny disclaimer tho: P-values are not provided with NCBI Blast2 reports, so if you're not seeing one, that's why. no cap.

  • Usage β€” $hit_object->p( [format] );
  • Purpose β€” Get the P-value for the best HSP of the given BLAST hit. (Note that P-values are not provided with NCBI Blast2 reports).
  • 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.
  • Comments β€” Using the 'parts' argument is not recommended since it will not work as expected if the P-value is not in scientific notation. That is, floats are not converted into sci notation before splitting into parts. so like… beware 😭
  • See Also β€” expect(), significance(), Bio::Search::SearchUtils::get_exponent()

hsp πŸ¦‹

gives you one single HSPI object for the HitI object you're currently vibing with. that's it, that's the whole thing.

  • Usage β€” $hit_object->hsp( [string] );
  • Purpose β€” Get a single HSPI object for the present HitI object.
  • 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::BlastHSP.pm object.
  • Argument β€” String (or no argument).
    • No argument (default) = highest scoring HSP (same as 'best').
    • 'best' or 'first' = highest scoring HSP.
    • 'worst' or 'last' = lowest scoring HSP.
  • Throws β€” Exception if the HSPs have not been collected. Exception if an unrecognized argument is used. don't try it πŸ’€
  • See Also β€” hsps(), num_hsps()

logical_length ✨

this one's mostly for internal use, iykyk. it gets the logical length of the hit sequence β€” which we need because the number of identical/conserved residues can be in peptide sequence space while the query and/or hit sequence are chillin' in nucleotide space. different units, same drama.

  • Usage β€” $hit_object->logical_length( [seq_type] ); (mostly intended for internal use).
  • Purpose β€” Get the logical length of the hit sequence. This is necessary since the number of identical/conserved residues can be in terms of peptide sequence space, yet the query and/or hit sequence are in nucleotide space.
  • 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
    • In the case of BLAST flavors:
    • For TBLASTN reports, the length of the aligned portion of the nucleotide hit sequence is divided by 3; for BLASTX reports, the length of the aligned portion of the nucleotide query sequence is divided by 3. For TBLASTX reports, the length of both hit and query sequence are converted.
    • This is important for functions like frac_aligned_query() which need to operate in amino acid coordinate space when dealing with [T]BLAST[NX] type reports.
  • See Also β€” length(), frac_aligned_query(), frac_aligned_hit()

length_aln 🌸

the total length of the aligned region for either query or sbjct seq β€” and yes, this number includes ALL the HSPs, every single one.

  • Usage β€” $hit_object->length_aln( [seq_type] );
  • Purpose β€” Get the total length of the aligned region for query or sbjct seq. This number will include all HSPs
  • 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).

This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. If you don't want the tiled data, iterate through each HSP calling length() on each (use hsps() to get all HSPs). ur choice bestie 🫢

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

gaps πŸŽ€

counts the gaps in the aligned query, hit, or both β€” and it sums that data across all HSPs. it's giving thorough.

  • 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. tragic fr fr πŸ’€
  • Argument β€” seq_type: 'query' | 'hit' or 'sbjct' | 'total' | 'list' (default = 'total') ('sbjct' is synonymous with 'hit')
  • Throws β€” n/a
  • Comments β€” If you need data for each HSP, use hsps() and then interate through each HSP object. This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. Not relying on wantarray since that will fail in situations such as printf "%d", $hit->gaps() in which you might expect to be printing the total gaps, but evaluates to array context.
  • See Also β€” length_aln()

matches ⭐

See documentation in Bio::Search::Hit::HitI::matches() β€” go read the sibling page, bestie, this one's just pointing you there.


start 🌈

grabs the start coordinate for the query, sbjct, or both sequences in the BlastHit object. if there's more than one HSP, the lowest start value of all the HSPs gets returned. lowest of the low, iconic.

  • Usage β€” $sbjct->start( [seq_type] );
  • Purpose β€” Gets the start coordinate for the query, sbjct, or both sequences in the BlastHit object. If there is more than one HSP, the lowest start value of all HSPs is returned.
  • Example
$qbeg = $sbjct->start('query');
$sbeg = $sbjct->start('hit');
($qbeg, $sbeg) = $sbjct->start();
  • Returns
    • scalar context: integer
    • array context without args: list of two integers (queryStart, sbjctStart)
    • 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
  • See Also β€” end(), range(), strand(), Bio::Search::HSP::BlastHSP::start

end πŸ’…

same energy as start but for the end coordinate. if there's more than one HSP, the largest end value of all HSPs is returned. biggest end wins, periodt.

  • Usage β€” $sbjct->end( [seq_type] );
  • Purpose β€” Gets the end coordinate for the query, sbjct, or both sequences in the BlastHit object. If there is more than one HSP, the largest end value of all HSPs is returned.
  • Example
$qend = $sbjct->end('query');
$send = $sbjct->end('hit');
($qend, $send) = $sbjct->end();
  • Returns
    • scalar context: integer
    • array context without args: list of two integers (queryEnd, sbjctEnd)
    • Array context can be "induced" by providing an argument of 'list' or 'array'.
  • Argument β€” In scalar context: seq_type = 'query' or 'sbjct' (case insensitive). If not supplied, 'query' is used.
  • Throws β€” n/a
  • See Also β€” start(), range(), strand()

range πŸ“

the (start, end) coordinate duo for the query or sbjct sequence in the HSP alignment. two numbers, one vibe.

  • Usage β€” $sbjct->range( [seq_type] );
  • Purpose β€” Gets the (start, end) coordinates for the query or sbjct sequence in the HSP alignment.
  • 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: grab the overall fraction of identical positions across all HSPs. Bestie, that number is only about the aligned regions β€” it does not account for unaligned regions sitting in between the HSPs, if there even are 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 peep the comments below πŸ‘€). ('sbjct' is synonymous with 'hit'.)
  • Throws: n/a.
  • Comments:
    • To compute the fraction identical, the logical length of the aligned portion of the sequence is used. Translation for the BLAST girlies: for TBLASTN reports, the length of the aligned portion of the nucleotide hit sequence is divided by 3; for BLASTX reports, the length of the aligned portion of the nucleotide query sequence is divided by 3. For TBLASTX reports, the length of both hit and query sequence are converted. This is necessary since the number of identical residues is in terms of peptide sequence space. πŸ’…
    • Different versions of Blast report different values for the total length of the alignment. This is the number reported in the denominators in the stats section: "Identical = 34/120 Positives = 67/120".
    • NCBI BLAST uses the total length of the alignment (with gaps). WU-BLAST uses the length of the query sequence (without gaps).
    • So when you call this with an argument of 'total', the value you get shifts depending on which version of BLAST you're running. And total does NOT take HSP tiling into account, so it should not be used.
    • Wanna get the fraction identical among only the aligned residues, gaps fully ignored? Call this method with no argument, or with an argument of 'query' or 'hit'. Easy.
    • If you need data for each HSP, use hsps() and then iterate through the HSP objects. πŸ¦‹
    • This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. ✨
🚨 For real though: 'total' is a no. It ignores HSP tiling entirely and it should not be used. Periodt.
  • See Also: frac_conserved(), frac_aligned_query(), matches(), Bio::Search::SearchUtils::tile_hsps()

🌸 frac_conserved

  • Usage: $hit_object->frac_conserved( [seq_type] );
  • Purpose: grab the overall fraction of conserved positions across all HSPs. Again, this is only about the aligned regions β€” unaligned regions in between the HSPs are not accounted for, if any exist.
  • 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'.)
  • Throws: n/a.
  • Comments:
    • To compute the fraction conserved, the logical length of the aligned portion of the sequence is used. Meaning: in the case of BLAST flavors, for TBLASTN reports, the length of the aligned portion of the nucleotide hit sequence is divided by 3; for BLASTX reports, the length of the aligned portion of the nucleotide query sequence is divided by 3. For TBLASTX reports, the length of both hit and query sequence are converted. This is necessary since the number of conserved residues is in terms of peptide sequence space. πŸ’…
    • Different versions of Blast report different values for the total length of the alignment. This is the number reported in the denominators in the stats section: "Positives = 34/120 Positives = 67/120".
    • NCBI BLAST uses the total length of the alignment (with gaps). WU-BLAST uses the length of the query sequence (without gaps).
    • So when you call this with an argument of 'total', this method reports different values depending on the version of BLAST used. total does NOT take into account HSP tiling, so it should not be used.
    • To get the fraction conserved among only the aligned residues, ignoring the gaps, call this method without an argument or with an argument of 'query' or 'hit'.
    • If you need data for each HSP, use hsps() and then interate through the HSP objects. πŸ¦‹
    • This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. ✨
🚨 Same energy as frac_identical: 'total' should not be used, bestie. It doesn't do HSP tiling. Skip it.
  • See Also: frac_identical(), matches(), Bio::Search::SearchUtils::tile_hsps()

πŸŽ€ frac_aligned_query

  • Usage: $hit_object->frac_aligned_query();
  • Purpose: get the fraction of the query sequence which has been aligned across all HSPs (not including intervals between non-overlapping HSPs).
  • Example: $frac_alnq = $hit_object->frac_aligned_query();
  • Returns: Float (2-decimal precision, e.g., 0.75), or undef if query length is unknown, to avoid division by 0. (Yes bestie, protecting you from the 0 division heartbreak. 🫢)
  • Argument: n/a
  • Throws: n/a
  • Comments: If you need data for each HSP, use hsps() and then interate through the HSP objects. This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. ✨
  • See Also: frac_aligned_hit(), logical_length(), length_aln(), Bio::Search::SearchUtils::tile_hsps()

🌈 frac_aligned_hit

  • Usage: $hit_object->frac_aligned_hit();
  • Purpose: get the fraction of the hit (sbjct) sequence which has been aligned across all HSPs (not including intervals between non-overlapping HSPs).
  • Example: $frac_alnq = $hit_object->frac_aligned_hit();
  • Returns: Float (2-decimal precision, e.g., 0.75), or undef if hit length is unknown, to avoid division by 0. 🫢
  • Argument: n/a
  • Throws: n/a
  • Comments: If you need data for each HSP, use hsps() and then interate through the HSP objects. This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. ✨
  • See Also: frac_aligned_query(), matches(), logical_length(), length_aln(), Bio::Search::SearchUtils::tile_hsps()

πŸ¦‹ frac_aligned_sbjct

Same as frac_aligned_hit() πŸ’–


⭐ num_unaligned_sbjct

Same as num_unaligned_hit() πŸ’–


πŸ‘‘ num_unaligned_hit

  • Usage: $hit_object->num_unaligned_hit();
  • Purpose: get 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: n/a
  • Throws: n/a
  • Comments:
    • See the notes regarding logical lengths in the comments for frac_aligned_hit(). They apply here as well. πŸ“Œ
    • If you need data for each HSP, use hsps() and then interate through the HSP objects.
    • This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. ✨
  • See Also: num_unaligned_query(), Bio::Search::SearchUtils::tile_hsps(), frac_aligned_hit()

πŸ“ num_unaligned_query

  • Usage: $hit_object->num_unaligned_query();
  • Purpose: get the number of the unaligned residues in the query sequence. Sums across all all HSPs.
  • Example: $num_unaln = $hit_object->num_unaligned_query();
  • Returns: Integer
  • Argument: n/a
  • Throws: n/a
  • Comments:
    • See the notes regarding logical lengths in the comments for frac_aligned_query(). They apply here as well. πŸ“Œ
    • If you need data for each HSP, use hsps() and then interate through the HSP objects.
    • This method requires that all HSPs be tiled. If they have not already been tiled, they will be tiled first automatically. ✨
  • See Also: num_unaligned_hit(), frac_aligned_query(), Bio::Search::SearchUtils::tile_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' (default = 'identical'). Can be shortened to 'id' or 'cons'. (Actually, anything not 'id' will evaluate to 'conserved'.)
    • [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::BlastHSP::seq_inds()

πŸ’œ strand

See documentation in Bio::Search::Hit::HitI::strand()


πŸ’œ frame

See documentation in Bio::Search::Hit::HitI::frame()


✨ 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 *N*th hit for a specific query. πŸ‘‘
  • Returns: value of rank
  • Args: newvalue (optional)

🌸 locus

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

πŸŽ€ each_accession_number

  • Title: each_accession_number
  • Usage: @each_accession_number = $hit->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.
  • Returns: list of all accession numbers in the description
  • Args: none

πŸ¦‹ tiled_hsps

See documentation in Bio::Search::SearchUtils::tile_hsps()

query_length

  • Title β€” query_length
  • Usage β€” $obj->query_length($newval)
  • Function β€” gets you / sets you the query_length πŸ’–
  • Returns β€” the value of query_length (a scalar, bestie)
  • Args β€” on set, the new value (a scalar or undef, optional β€” no pressure)

ncbi_gi

  • Title β€” ncbi_gi
  • Usage β€” $acc = $hit->ncbi_gi();
  • Function β€” grabs the NCBI Unique ID (aka the GI #) for the hit, if it's available 🫢
  • Returns β€” a scalar string (and an empty string if it's not set, so no surprises)
  • Args β€” none
  • Note β€” okay so history lesson: as of Sept. 2016 NCBI records will no longer have a GI 😭 this attribute stays in place for older records though, so don't come for it

sort_hits

  • Title β€” sort_hsps
  • Usage β€” $result->sort_hsps(\&sort_function)
  • Function β€” sorts all the available HSP objects using a function you supply. Defaults to sorting by descending score, which honestly? iconic default.
  • Returns β€” n/a
  • Args β€” a coderef for the sort function. Go read the docs on the Perl sort() function for the guidelines on writing sort functions, iykyk
  • Note β€” this is the part where it gets real: to access the special variables $a and $b used by the Perl sort() function, your user function must access the Bio::Search::Hit::HitI namespace. For example, use:
$hit->sort_hsps( sub{$Bio::Search::Result::HitI::a->length <=>
                        $Bio::Search::Result::HitI::b->length});

NOT:

$hit->sort_hsps($a->length <=> $b->length);
fr fr do not skip the namespace, the second one is giving chaos πŸ’€

iteration

  • Usage β€” $hit->iteration( $iteration_num );
  • Purpose β€” gets the iteration number in which the Hit was found πŸ‘‘
  • Example β€” $iteration_num = $sbjct->iteration();
  • Returns β€” an integer greater than or equal to 1. Non-PSI-BLAST reports may report iteration as 1, but this number is only meaningful for PSI-BLAST reports β€” so like, read the room
  • Argument β€” iteration_num (optional, used when setting only)
  • Throws β€” none

See Also β€” found_again()


found_again

  • Title β€” found_again
  • Usage β€”
$hit->found_again;
$hit->found_again(1);
  • Purpose β€” gets a boolean indicator for whether or not the hit has been found in a previous iteration. This is only applicable to PSI-BLAST reports.

This method indicates if the hit was reported in the "Sequences used in model and found again" section of the PSI-BLAST report, or if it was reported in the "Sequences not found previously or not previously below threshold" section of the PSI-BLAST report. Only for hits in iteration > 1. ✨

  • Example β€” if( $hit->found_again()) { ... };
  • Returns β€” Boolean, true (1) if the hit has been found in a previous PSI-BLAST iteration. Returns false (0 or undef) for hits that have not occurred in a previous PSI-BLAST iteration.
  • Argument β€” Boolean (1 or 0). Only used for setting.
  • Throws β€” none

See Also β€” iteration()


and that's a wrap on the whole page, bestie!! πŸŽ€ you just read the version that ships with perl v5.32.1, dated 2021-08-15, filed under Bio::Search::Hit::GenericHit(3pm). go forth and search hits like the main character you are πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from