Bio::S...ricHSP(3pm)
π¦ Bio::Search::HSP::GenericHSP(3pm) π¦ β User Contributed Perl Documentation π
okay bestie, welcome to the Bio::Search::HSP::GenericHSP era β this is part 1 of 2, so don't go anywhere, we're just getting started. β¨
β¨ NAME β¨
Bio::Search::HSP::GenericHSP β a "Generic" implementation of a High Scoring Pair π«Ά
πΈ SYNOPSIS πΈ
like, here's the vibe, in code form:
my $hsp = Bio::Search::HSP::GenericHSP->new( -algorithm => 'blastp',
-evalue => '1e-30',
);
$r_type = $hsp->algorithm;
$pvalue = $hsp->p();
$evalue = $hsp->evalue();
$frac_id = $hsp->frac_identical( ['query'|'hit'|'total'] );
$frac_cons = $hsp->frac_conserved( ['query'|'hit'|'total'] );
$gaps = $hsp->gaps( ['query'|'hit'|'total'] );
$qseq = $hsp->query_string;
$hseq = $hsp->hit_string;
$homo_string = $hsp->homology_string;
$len = $hsp->length( ['query'|'hit'|'total'] );
$len = $hsp->length( ['query'|'hit'|'total'] );
$rank = $hsp->rank;
# TODO: Describe how to configure a SearchIO stream so that it generates
# GenericHSP objects.
yes, $len = $hsp->length( ['query'|'hit'|'total'] ); really is in there twice. no, I'm not "fixing" it, it's iconic. π
π§ DESCRIPTION π§
So this implementation is "Generic", which lowkey means it's built to hold info about High Scoring pairs from, like, most Search reports β think BLAST and FastA. And if you want something more specialized? You can totally derive from this. slay. π
Unless you're literally writing a parser, you will never ever need to create a GenericHSP or any other HSPI-implementing object yourself. fr fr. If you're using the SearchIO system, the HSPI objects just appear automatically out of a SearchIO stream that returns Bio::Search::Result::ResultI objects, and you get your HSPI objects through the ResultI API. no cap. β¨
And if you want the tea on what you can actually do with GenericHSP (and other HSPI objects), go read the API docs in Bio::Search::HSP::HSPI. that's where the good stuff lives. π
π«Ά FEEDBACK π«Ά
π Mailing Lists π
User feedback is, like, an integral part of the evolution of this and other Bioperl modules β genuinely, it's the whole vibe. 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 your 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, like, so many experienced and responsive experts on the list who can look at the problem and address it quickly. Please include a thorough description of the problem, plus code and data examples, if at all possible. the more detail the better bestie. π
π Reporting Bugs π
Report bugs to the Bioperl bug tracking system so we can 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.org β Email sac-at-bioperl.org
π CONTRIBUTORS π
Sendu Bala, bix@sendu.me.uk
π APPENDIX π
The rest of the documentation is about to detail each of the object methods, one by one. Internal methods are usually preceded with a _ β that's the lil secret handshake. π€«
π new π
- Title: new
- Usage:
my $obj = Bio::Search::HSP::GenericHSP->new(); - Function: Builds a new
Bio::Search::HSP::GenericHSPobject. it's giving construction era. - Returns:
Bio::Search::HSP::GenericHSP - Args:
-algorithm=> algorithm used (BLASTP, TBLASTX, FASTX, etc)-evalue=> evalue-pvalue=> pvalue-bits=> bit value for HSP-score=> score value for HSP (typically z-score but depends on analysis)-hsp_length=> Length of the HSP (including gaps)-identical=> # of residues that that matched identically-percent_identity=> (optional) percent identity-conserved=> # of residues that matched conservatively (only protein comparisons; conserved == identical in nucleotide comparisons)-hsp_gaps=> # of gaps in the HSP-query_gaps=> # of gaps in the query in the alignment-hit_gaps=> # of gaps in the subject in the alignment-query_name=> HSP Query sequence name (if available)-query_start=> HSP Query start (in original query sequence coords)-query_end=> HSP Query end (in original query sequence coords)-query_length=> total length of the query sequence-query_seq=> query sequence portion of the HSP-query_desc=> textual description of the query-hit_name=> HSP Hit sequence name (if available)-hit_start=> HSP Hit start (in original hit sequence coords)-hit_end=> HSP Hit end (in original hit sequence coords)-hit_length=> total length of the hit sequence-hit_seq=> hit sequence portion of the HSP-hit_desc=> textual description of the hit-homology_seq=> homology sequence for the HSP-hit_frame=> hit frame (only if hit is translated protein)-query_frame=> query frame (only if query is translated protein)-rank=> HSP rank-links=> HSP links information (WU-BLAST only)-hsp_group=> HSP Group informat (WU-BLAST only)-gap_symbol=> symbol representing a gap (default ='-')-hit_features=> string of features found in or near HSP hit region (reported in some BLAST text output, v. 2.2.13 and up)-stranded=> If the algorithm isn't known (i.e. defaults to'generic'), setting this will indicate start/end coordinates are to be used to determine the strand for'query','subject','hit','both', or'none'(default ='none')
π¦ Bio::Search::HSP::HSPI methods π¦
Implementation of Bio::Search::HSP::HSPI methods follow β here we go bestie, buckle up. β¨
π algorithm π
- Title: algorithm
- Usage:
my $r_type = $hsp->algorithm - Function: Obtain the name of the algorithm used to obtain the HSP. yes, the algorithm's algorithm.
- Returns: string (e.g.,
BLASTP) - Args: [optional] scalar string to set value
π pvalue π
- Title: pvalue
- Usage:
my $pvalue = $hsp->pvalue(); - Function: Returns the P-value for this HSP or
undef - Returns: float or exponential (
2e-10). note: P-value is not defined with NCBI Blast2 reports. π - Args: [optional] numeric to set value
π evalue π
- Title: evalue
- Usage:
my $evalue = $hsp->evalue(); - Function: Returns the e-value for this HSP. the classic.
- Returns: float or exponential (
2e-10) - Args: [optional] numeric to set value
π frac_identical π
- Title: frac_identical
- Usage:
my $frac_id = $hsp->frac_identical( ['query'|'hit'|'total'] ); - Function: Returns the fraction of identitical positions for this HSP
- Returns: Float in range
0.0->1.0 - Args:
- arg 1:
'query'= num identical / length of query seq (without gaps)'hit'= num identical / length of hit seq (without gaps) β synonyms:'sbjct','subject''total'= num identical / length of alignment (with gaps) β synonyms:'hsp'- default =
'total'
- arg 2: [optional] frac identical value to set for the type requested
- arg 1:
- Note: for translated sequences, this adjusts the length accordingly π
π frac_conserved π
- Title: frac_conserved
- Usage:
my $frac_cons = $hsp->frac_conserved( ['query'|'hit'|'total'] ); - Function: Returns the fraction of conserved positions for this HSP. This is the fraction of symbols in the alignment with a positive score.
- Returns: Float in range
0.0->1.0 - Args:
- arg 1:
'query'= num conserved / length of query seq (without gaps)'hit'= num conserved / length of hit seq (without gaps) β synonyms:'sbjct','subject''total'= num conserved / length of alignment (with gaps) β synonyms:'hsp'- default =
'total'
- arg 2: [optional] frac conserved value to set for the type requested
- arg 1:
π gaps π
- Title: gaps
- Usage:
my $gaps = $hsp->gaps( ['query'|'hit'|'total'] ); - Function: Get the number of gap characters in the query, hit, or total alignment.
- Returns: Integer, number of gaps or
0if none - Args:
- arg 1:
'query'= num gap characters in query seq'hit'= num gap characters in hit seq; synonyms:'sbjct','subject''total'= num gap characters in whole alignment; synonyms:'hsp'- default =
'total'
- arg 2: [optional] integer gap value to set for the type requested
- arg 1:
π query_string π
- Title: query_string
- Usage:
my $qseq = $hsp->query_string; - Function: Retrieves the query sequence of this HSP as a string
- Returns: string
- Args: [optional] string to set for query sequence
π hit_string π
- Title: hit_string
- Usage:
my $hseq = $hsp->hit_string; - Function: Retrieves the hit sequence of this HSP as a string
- Returns: string
- Args: [optional] string to set for hit sequence
π homology_string π
- Title: homology_string
- Usage:
my $homo_string = $hsp->homology_string; - Function: Retrieves the homology sequence for this HSP as a string. The homology sequence is the string of symbols in between the query and hit sequences in the alignment indicating the degree of conservation (e.g., identical, similar, not similar). it's the lil middle child of the alignment. π₯Ή
- Returns: string
- Args: [optional] string to set for homology sequence
π consensus_string π
- Title: consensus_string
- Usage:
my $cs_string = $hsp->consensus_string; - Function: Retrieves the consensus structure line for this HSP as a string (HMMER). If the model had any consensus structure or reference line annotation that it inherited from a multiple alignment (
#=GC SS cons,#=GC RFannotation in Stockholm files), that information is shown as CS or RF annotation line. - Returns: string
- Args: [optional] string to set for consensus structure
π posterior_string π
- Title: posterior_string
- Usage:
my $pp_string = $hsp->posterior_string; - Function: Retrieves the posterior probability line for this HSP as a string (HMMer3). The posterior probability is the string of symbols at the bottom of the alignment indicating the expected accuracy of each aligned residue. A
0means 0-5%,1means 5-15%, and so on;9means 85-95%, and a*means 95-100% posterior probability. yes, the symbols are doing math. iconic. - Returns: string
- Args: [optional] string to set for posterior probability
okay that's part 1 bestie, don't go anywhere β part 2 is right there and it's so worth it π
length
- Usage:
my $len = $hsp->length( ['query'|'hit'|'total'] ); - Function: hands you back the length of the query or the hit inside the alignment, gaps NOT included β or the aggregate length of the whole HSP, gaps included (and yes, that one can be bigger than either the hit or the query, no cap).
- Returns: integer π―
- Args:
- arg 1:
'query'= length of query seq (without gaps)'hit'= length of hit seq (without gaps) (synonyms:sbjct,subject)'total'= length of alignment (with gaps)- default =
'total'
- arg 2: [optional] integer length value to set for that specific type
- arg 1:
hsp_length
- Usage:
my $len = $hsp->hsp_length() - Function: it's literally a shortcut for
length('hsp') - Returns: floating point between 0 and 100
- Args: none, she takes no input π
percent_identity
- Usage:
my $percentid = $hsp->percent_identity() - Function: returns the calculated percent identity for an HSP
- Returns: floating point between 0 and 100
- Args: none
frame
- Usage:
my ($qframe, $hframe) = $hsp->frame('list',$queryframe,$subjectframe) - Function: sets the Frame for both query and subject and makes sure they agree with each other. This overrides the
frame()method implementation inFeaturePair. - Returns: array of query and subject frame if the return type wants an array, or the query frame if defined, or the subject frame if not defined
- Args:
'hit'or'subject'or'sbjct'to retrieve the frame of the subject (this is the default)'query'to retrieve the query frame'list'or'array'to retrieve both query and hit frames together
- Note: Frames are stored the GFF way (
0-2), NOT1-3like they are in BLAST. Negative frames get deduced by checking the strand of the query or hit. π§¬
get_aln
- Usage:
my $aln = $hsp->gel_aln - Function: returns a Bio::SimpleAlign object representing the HSP alignment
- Returns: Bio::SimpleAlign
- Args: none
num_conserved
- Usage:
$obj->num_conserved($newval) - Function: returns the number of conserved residues in the alignment
- Returns: integer
- Args: integer (optional)
num_identical
- Usage:
$obj->num_identical($newval) - Function: returns the number of identical residues in the alignment
- Returns: integer
- Args: integer (optional)
rank
- Usage:
$hsp->rank( [string] ); - Purpose: get the rank of the HSP within a given Blast hit.
- Example:
$rank = $hsp->rank; - Returns: Integer (1..n) corresponding to the order in which the HSP appears in the BLAST report.
seq_inds
- Purpose: get a list of residue positions (indices) for all identical or conserved residues in the query or sbjct sequence.
- Example:
@s_ind = $hsp->seq_inds('query', 'identical');
@h_ind = $hsp->seq_inds('hit', 'conserved');
@h_ind = $hsp->seq_inds('hit', 'conserved-not-identical');
@h_ind = $hsp->seq_inds('hit', 'conserved', 1);
- Returns: List of integers. May include ranges if
collapseis true. - Argument:
seq_type='query'or'hit'or'sbjct'(default =query), and'sbjct'is synonymous with'hit'class='identical'- identical positions'conserved'- conserved positions'nomatch'- mismatched residue or gap positions'mismatch'- mismatched residue positions (no gaps)'gap'- gap positions only'frameshift'- frameshift positions only'conserved-not-identical'- conserved positions w/o identical residues- the name can be shortened to
'id'or'cons'unless the name is . The default value is'identical'
collapse= boolean, if true, 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.
- Comments: For HSPs partially or completely derived from translated sequences (TBLASTN, BLASTX, TBLASTX, or similar), some positional data cannot easily be attributed to a single position (i.e. the positional data is ambiguous). In these cases all three codon positions are reported. Under these conditions you can check
ambiguous_seq_inds()to determine whether the query, subject, or both are ambiguous. - See Also: Bio::Search::SearchUtils::collapse_nums() (in Bio::Search::SearchUtils), Bio::Search::Hit::HitI::seq_inds() (in Bio::Search::Hit::HitI)
ambiguous_seq_inds
- Purpose: returns a string denoting whether sequence indices for query, subject, or both are ambiguous
- Returns: String;
'query','subject','query/subject', or the empty string'' - Argument: none
- Comments: For HSPs partially or completely derived from translated sequences (TBLASTN, BLASTX, TBLASTX, or similar), some positional data cannot easily be attributed to a single position (i.e. the positional data is ambiguous). In these cases all three codon positions are reported when using
seq_inds(). Under these conditions you can checkambiguous_seq_inds()to determine whether the query, subject, or both are ambiguous. - See Also: Bio::Search::Hit::HSPI::seq_inds()
π«Ά Inherited from Bio::SeqFeature::SimilarityPair π«Ά
These methods come from Bio::SeqFeature::SimilarityPair, bestie, she's just sharing the wealth.
query
- Usage:
my $query = $hsp->query - Function: returns a SeqFeature representing the query in the HSP
- Returns: Bio::SeqFeature::Similarity
- Args: [optional] new value to set
hit
- Usage:
my $hit = $hsp->hit - Function: returns a SeqFeature representing the hit in the HSP
- Returns: Bio::SeqFeature::Similarity
- Args: [optional] new value to set
significance
- Usage:
$evalue = $obj->significance();
$obj->significance($evalue);
- Function: get/set the significance value
- Returns: numeric
- Args: [optional] new value to set
strand
- Usage:
$hsp->strand('query') - Function: retrieves the strand for the HSP component requested
- Returns:
+1or-1 - Args:
'hit'or'subject'or'sbjct'to retrieve the strand of the subject,'query'to retrieve the query strand (default)
score
- Usage:
$score = $obj->score();
$obj->score($value);
- Function: get/set the score value
- Returns: numeric
- Args: [optional] new value to set
bits
- Usage:
$bits = $obj->bits();
$obj->bits($value);
- Function: get/set the bits value
- Returns: numeric
- Args: [optional] new value to set
π Private methods π
(not for you, bestie, these are the internals doing their little thing behind the curtain β¨)
_calculate_seq_positions
- Usage:
$self->_calculate_seq_positions - Function: Internal function
- Returns:
- Args:
n
See documentation in Bio::Search::HSP::HSPI::n()
range
See documentation in Bio::Search::HSP::HSPI::range()
links
- Usage:
$obj->links($newval) - Function: get/set the Links value (from WU-BLAST). Indicates the placement of the alignment in the group of HSPs.
- Returns: Value of links
- Args: On set, new value (a scalar or undef, optional)
hsp_group
- Usage:
$obj->hsp_group($newval) - Function: get/set the Group value (from WU-BLAST). Indicates a grouping of HSPs.
- Returns: Value of group
- Args: On set, new value (a scalar or undef, optional)
hit_features
- Usage:
$obj->hit_features($newval) - Function: get/set the HSP hit feature string (from some BLAST 2.2.13 text output), which is a string of overlapping or nearby features in HSP hit
- Returns: Value of hit features, if present
- Args: On set, new value (a scalar or undef, optional)
π Brief introduction on cigar string π
NOTE: the concept is originally from EnsEMBL docs at http://may2005.archive.ensembl.org/Docs/wiki/html/EnsemblDocs/CigarFormat.html β please append to these docs if you have a better definition. π«Ά
Sequence alignment hits can be stored in a database as ungapped alignments. This imposes 2 major constraints on alignments:
a) alignments for a single hit record require multiple rows in the database, and b) it is not possible to accurately retrieve the exact original alignment.
Alternatively, sequence alignments can be stored as gapped alignments using the CIGAR line format (where CIGAR stands for Concise Idiosyncratic Gapped Alignment Report). Iconic name honestly.
In the cigar line format alignments are stored as follows:
M: Match D: Deletion I: Insertion
An example of an alignment for a hypthetical protein match is shown below:
Query: 42 PGPAGLP----GSVGLQGPRGLRGPLP-GPLGPPL...
PG P G GP R PLGP
Sbjct: 1672 PGTP*TPLVPLGPWVPLGPSSPR--LPSGPLGPTD...
protein_align_feature table as the following cigar line:
7M4D12M2I2MD7M
cigar_string
- Name:
cigar_string - Usage:
$cigar_string = $hsp->cigar_string - Function: generate and return cigar string for this HSP alignment
- Args: no input needed
- Return: a cigar string
generate_cigar_string
- Name:
generate_cigar_string - Usage:
my $cigar_string = Bio::Search::HSP::GenericHSP::generate_cigar_string ($qstr, $hstr); - Function: generate cigar string from a simple sequence of alignment.
- Args: the string of query and subject
- Return: cigar string
and that's a wrap, bestie π«Ά this page was served up by perl v5.32.1, dated 2021-08-15, and yes it really is called Bio::S...ricHSP(3pm) β the name got a little β¨truncatedβ¨ for the flex, but you know exactly which one it is. go read some HSPs, you ate π π
π¦ 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