BioPerl
view release on metacpan or search on metacpan
Bio/Search/HSP/PsiBlastHSP.pm view on Meta::CPAN
=head1 DISCLAIMER
This software is provided "as is" without warranty of any kind.
=cut
# END of main POD documentation.
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
# Let the code begin...
package Bio::Search::HSP::PsiBlastHSP;
use strict;
use Bio::SeqFeature::Similarity;
use vars qw($GAP_SYMBOL %STRAND_SYMBOL);
use overload
'""' => \&to_string;
use base qw(Bio::SeqFeature::SimilarityPair Bio::Search::HSP::HSPI);
$GAP_SYMBOL = '-'; # Need a more general way to handle gap symbols.
%STRAND_SYMBOL = ('Plus' => 1, 'Minus' => -1 );
=head2 new
Usage : $hsp = Bio::Search::HSP::PsiBlastHSP->new( %named_params );
: Bio::Search::HSP::PsiBlastHSP.pm objects are constructed
: automatically by Bio::SearchIO::BlastHitFactory.pm,
: so there is no need for direct instantiation.
Purpose : Constructs a new PsiBlastHSP object and Initializes key variables
: for the HSP.
Returns : A Bio::Search::HSP::PsiBlastHSP object
Argument : Named parameters:
: Parameter keys are case-insensitive.
: -RAW_DATA => array ref containing raw BLAST report data for
: for a single HSP. This includes all lines
: of the HSP alignment from a traditional BLAST
or PSI-BLAST (non-XML) report,
: -RANK => integer (1..n).
: -PROGRAM => string ('TBLASTN', 'BLASTP', etc.).
: -QUERY_NAME => string, id of query sequence
: -HIT_NAME => string, id of hit sequence
:
Comments : Having the raw data allows this object to do lazy parsing of
: the raw HSP data (i.e., not parsed until needed).
:
: Note that there is a fair amount of basic parsing that is
: currently performed in this module that would be more appropriate
: to do within a separate factory object.
: This parsing code will likely be relocated and more initialization
: parameters will be added to new().
:
See Also : L<Bio::SeqFeature::SimilarityPair::new()>, L<Bio::SeqFeature::Similarity::new()>
=cut
#----------------
sub new {
#----------------
my ($class, @args ) = @_;
my $self = $class->SUPER::new( @args );
# Initialize placeholders
$self->{'_queryGaps'} = $self->{'_sbjctGaps'} = 0;
my ($raw_data, $qname, $hname, $qlen, $hlen);
($self->{'_prog'}, $self->{'_rank'}, $raw_data,
$qname, $hname) =
$self->_rearrange([qw( PROGRAM
RANK
RAW_DATA
QUERY_NAME
HIT_NAME
)], @args );
# _set_data() does a fair amount of parsing.
# This will likely change (see comment above.)
$self->_set_data( @{$raw_data} );
# Store the aligned query as sequence feature
my ($qb, $hb) = ($self->start());
my ($qe, $he) = ($self->end());
my ($qs, $hs) = ($self->strand());
my ($qf,$hf) = ($self->query->frame(),
$self->hit->frame);
$self->query( Bio::SeqFeature::Similarity->new (-start =>$qb,
-end =>$qe,
-strand =>$qs,
-bits =>$self->bits,
-score =>$self->score,
-frame =>$qf,
-seq_id => $qname,
-source =>$self->{'_prog'} ));
$self->hit( Bio::SeqFeature::Similarity->new (-start =>$hb,
-end =>$he,
-strand =>$hs,
-bits =>$self->bits,
-score =>$self->score,
-frame =>$hf,
-seq_id => $hname,
-source =>$self->{'_prog'} ));
# set lengths
$self->query->seqlength($qlen); # query
$self->hit->seqlength($hlen); # subject
$self->query->frac_identical($self->frac_identical('query'));
$self->hit->frac_identical($self->frac_identical('hit'));
return $self;
( run in 1.234 second using v1.01-cache-2.11-cpan-71847e10f99 )