NAME
Bio::Search::HSP::GenericHSP - A "Generic" implementation of a High Scoring Pair
SYNOPSIS
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.
DESCRIPTION
This implementation is "Generic", meaning it is is suitable for holding information about High Scoring pairs from most Search reports such as BLAST and FastA. Specialized objects can be derived from this.
Unless you're writing a parser, you won't ever need to create a GenericHSP or any other HSPI-implementing object. If you use the SearchIO system, HSPI objects are created automatically from a SearchIO stream which returns Bio::Search::Result::ResultI objects and you get the HSPI objects via the ResultI API.
For documentation on what you can do with GenericHSP (and other HSPI objects), please see the API documentation in Bio::Search::HSP::HSPI.
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.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
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-at-bioperl.org Email sac-at-bioperl.org
CONTRIBUTORS
Sendu Bala, [email protected]
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage : my $obj = Bio::Search::HSP::GenericHSP->new();Function: Builds a new Bio::Search::HSP::GenericHSP objectReturns : Bio::Search::HSP::GenericHSPArgs : -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 onanalysis)-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 hitregion (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/endcoordinates are to be used to determine the strandfor 'query', 'subject', 'hit', 'both', or 'none'(default = 'none')
Bio::Search::HSP::HSPI methods
Implementation of Bio::Search::HSP::HSPI methods follow
algorithm
Title : algorithmUsage : my $r_type = $hsp->algorithmFunction: Obtain the name of the algorithm used to obtain the HSPReturns : string (e.g., BLASTP)Args : [optional] scalar string to set value
pvalue
Title : pvalueUsage : my $pvalue = $hsp->pvalue();Function: Returns the P-value for this HSP or undefReturns : float or exponential (2e-10)P-value is not defined with NCBI Blast2 reports.Args : [optional] numeric to set value
evalue
Title : evalueUsage : my $evalue = $hsp->evalue();Function: Returns the e-value for this HSPReturns : float or exponential (2e-10)Args : [optional] numeric to set value
frac_identical
Title : frac_identicalUsage : my $frac_id = $hsp->frac_identical( ['query'|'hit'|'total'] );Function: Returns the fraction of identitical positions for this HSPReturns : Float in range 0.0 -> 1.0Args : 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 requestedNote : for translated sequences, this adjusts the length accordingly
frac_conserved
Title : frac_conservedUsage : 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 apositive score.Returns : Float in range 0.0 -> 1.0Args : 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
gaps
Title : gapsUsage : 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 0 if noneArgs : 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
query_string
Title : query_stringUsage : my $qseq = $hsp->query_string;Function: Retrieves the query sequence of this HSP as a stringReturns : stringArgs : [optional] string to set for query sequence
hit_string
Title : hit_stringUsage : my $hseq = $hsp->hit_string;Function: Retrieves the hit sequence of this HSP as a stringReturns : stringArgs : [optional] string to set for hit sequence
homology_string
Title : homology_stringUsage : 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).Returns : stringArgs : [optional] string to set for homology sequence
consensus_string
Title : consensus_stringUsage : 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 RF annotation in Stockholm files), that information is shown: as CS or RF annotation line.Returns : stringArgs : [optional] string to set for consensus structure
posterior_string
Title : posterior_stringUsage : 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 0 means 0-5%, 1 means 5-15%, and so on; 9 means 85-95%,: and a * means 95-100% posterior probability.Returns : stringArgs : [optional] string to set for posterior probability
length
Title : lengthUsage : my $len = $hsp->length( ['query'|'hit'|'total'] );Function : Returns the length of the query or hit in the alignment(without gaps)or the aggregate length of the HSP (including gaps;this may be greater than either hit or query )Returns : integerArgs : 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 specific type
hsp_length
Title : hsp_lengthUsage : my $len = $hsp->hsp_length()Function: shortcut length('hsp')Returns : floating point between 0 and 100Args : none
percent_identity
Title : percent_identityUsage : my $percentid = $hsp->percent_identity()Function: Returns the calculated percent identity for an HSPReturns : floating point between 0 and 100Args : none
frame
Title : frameUsage : my ($qframe, $hframe) = $hsp->frame('list',$queryframe,$subjectframe)Function: Set the Frame for both query and subject and insure thatthey agree.This overrides the frame() method implementation inFeaturePair.Returns : array of query and subject frame if return type wants an arrayor query frame if defined or subject frame if not definedArgs : 'hit' or 'subject' or 'sbjct' to retrieve the frame of the subject (default)'query' to retrieve the query frame'list' or 'array' to retrieve both query and hit frames togetherNote : Frames are stored in the GFF way (0-2) not 1-3as they are in BLAST (negative frames are deduced by checkingthe strand of the query or hit)
get_aln
Title : get_alnUsage : my $aln = $hsp->gel_alnFunction: Returns a L<Bio::SimpleAlign> object representing the HSP alignmentReturns : L<Bio::SimpleAlign>Args : none
num_conserved
Title : num_conservedUsage : $obj->num_conserved($newval)Function: returns the number of conserved residues in the alignmentReturns : integerArgs : integer (optional)
num_identical
Title : num_identicalUsage : $obj->num_identical($newval)Function: returns the number of identical residues in the alignmentReturns : integerArgs : 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 HSPappears in the BLAST report.
seq_inds
Title : seq_indsPurpose : 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 collapse is true.Argument : seq_type = 'query' or 'hit' or 'sbjct' (default = query): ('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 : L<Bio::Search::SearchUtils::collapse_nums()|Bio::Search::SearchUtils>,L<Bio::Search::Hit::HitI::seq_inds()|Bio::Search::Hit::HitI>
ambiguous_seq_inds
Title : ambiguous_seq_indsPurpose : returns a string denoting whether sequence indices for query,: subject, or both are ambiguousReturns : String; 'query', 'subject', 'query/subject', or empty string ''Argument : noneComments : 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 check ambiguous_seq_inds() to determine whether: the query, subject, or both are ambiguous.See Also : L<Bio::Search::Hit::HSPI::seq_inds()>
Inherited from Bio::SeqFeature::SimilarityPair
These methods come from Bio::SeqFeature::SimilarityPair
query
Title : queryUsage : my $query = $hsp->queryFunction: Returns a SeqFeature representing the query in the HSPReturns : L<Bio::SeqFeature::Similarity>Args : [optional] new value to set
hit
Title : hitUsage : my $hit = $hsp->hitFunction: Returns a SeqFeature representing the hit in the HSPReturns : L<Bio::SeqFeature::Similarity>Args : [optional] new value to set
significance
Title : significanceUsage : $evalue = $obj->significance();$obj->significance($evalue);Function: Get/Set the significance valueReturns : numericArgs : [optional] new value to set
strand
Title : strandUsage : $hsp->strand('query')Function: Retrieves the strand for the HSP component requestedReturns : +1 or -1Args : 'hit' or 'subject' or 'sbjct' to retrieve the strand of the subject,'query' to retrieve the query strand (default)
score
Title : scoreUsage : $score = $obj->score();$obj->score($value);Function: Get/Set the score valueReturns : numericArgs : [optional] new value to set
bits
Title : bitsUsage : $bits = $obj->bits();$obj->bits($value);Function: Get/Set the bits valueReturns : numericArgs : [optional] new value to set
Private methods
_calculate_seq_positions
Title : _calculate_seq_positionsUsage : $self->_calculate_seq_positionsFunction: Internal functionReturns :Args :
n
See documentation in Bio::Search::HSP::HSPI::n()
range
See documentation in Bio::Search::HSP::HSPI::range()
links
Title : linksUsage : $obj->links($newval)Function: Get/Set the Links value (from WU-BLAST)Indicates the placement of the alignment in the group of HSPsReturns : Value of linksArgs : On set, new value (a scalar or undef, optional)
hsp_group
Title : hsp_groupUsage : $obj->hsp_group($newval)Function: Get/Set the Group value (from WU-BLAST)Indicates a grouping of HSPsReturns : Value of groupArgs : On set, new value (a scalar or undef, optional)
hit_features
Title : hit_featuresUsage : $obj->hit_features($newval)Function: Get/Set the HSP hit feature string (from some BLAST 2.2.13 textoutput), which is a string of overlapping or nearby features in HSPhitReturns : Value of hit features, if presentArgs : 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).
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_stringUsage: $cigar_string = $hsp->cigar_stringFunction: Generate and return cigar string for this HSP alignmentArgs: No input neededReturn: a cigar string
generate_cigar_string
Name: generate_cigar_stringUsage: 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 subjectReturn: cigar string