Bio-FastParsers
view release on metacpan or search on metacpan
lib/Bio/FastParsers/Blast/Xml/Hsp.pm view on Meta::CPAN
sub pattern_from {
return shift->_root->{'Hsp_pattern-from'}->{'value'}
}
sub pattern_to {
return shift->_root->{'Hsp_pattern-to'}->{'value'}
}
sub positive {
return shift->_root->{'Hsp_positive'}->{'value'}
}
sub qseq {
return shift->_root->{'Hsp_qseq'}->{'value'}
}
sub query_frame {
return shift->_root->{'Hsp_query-frame'}->{'value'}
}
sub query_from {
return shift->_root->{'Hsp_query-from'}->{'value'}
}
sub query_to {
return shift->_root->{'Hsp_query-to'}->{'value'}
}
sub score {
return shift->_root->{'Hsp_score'}->{'value'}
}
# public aliases
sub expect {
return shift->evalue
}
sub qcov {
return shift->query_coverage
}
sub scov {
return shift->subject_coverage
}
sub pident {
return shift->percentage_identity
}
sub ppos {
return shift->percentage_positive
}
sub query_len {
return shift->_parent->query_len
}
sub hit_len {
return shift->_parent->len
}
# pseudo-aliases
use Const::Fast;
const my $NEGFRAME => qr{\A -}xms;
sub hit_strand {
my $self = shift;
return $self->hit_frame =~ $NEGFRAME ? -1 : 1;
}
sub hit_start {
my $self = shift;
return $self->hit_from < $self->hit_to ? $self->hit_from
: $self->hit_to;
}
sub hit_end {
my $self = shift;
return $self->hit_to > $self->hit_from ? $self->hit_to
: $self->hit_from;
}
sub query_strand {
my $self = shift;
return $self->query_frame =~ $NEGFRAME ? -1 : 1;
}
sub query_start {
my $self = shift;
return $self->query_from < $self->query_to ? $self->query_from
: $self->query_to;
}
sub query_end {
my $self = shift;
return $self->query_to > $self->query_from ? $self->query_to
: $self->query_from;
}
sub query_coverage {
my $self = shift;
return sprintf("%.1f",
100 * ( $self->query_end - $self->query_start + 1 ) / $self->query_len
);
}
sub subject_coverage {
my $self = shift;
return sprintf("%.1f",
100 * ( $self->hit_end - $self->hit_start + 1 ) / $self->hit_len
);
}
sub percentage_identity {
my $self = shift;
return sprintf("%.1f", 100 * ( $self->identity / $self->align_len ) );
}
sub percentage_positive {
my $self = shift;
return sprintf("%.1f", 100 * ( $self->positive / $self->align_len ) );
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Bio::FastParsers::Blast::Xml::Hsp - NCBI BLAST DTD-derived internal class
=head1 VERSION
version 0.221230
=head1 SYNOPSIS
# see Bio::FastParsers::Blast::Xml
=head1 DESCRIPTION
This class implements the C<Hsp> level of the XML BLAST parser.
=head1 METHODS
=head2 align_len
Returns the value of the element C<<Hsp_align-len>>.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $align_len = $hsp->align_len;
This method does not accept any arguments.
=head2 bit_score
Returns the value of the element C<<Hsp_bit-score>>.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $bit_score = $hsp->bit_score;
This method does not accept any arguments.
=head2 density
Returns the value of the element C<<Hsp_density>>.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $density = $hsp->density;
This method does not accept any arguments.
=head2 evalue
Returns the value of the element C<<Hsp_evalue>>.
lib/Bio/FastParsers/Blast/Xml/Hsp.pm view on Meta::CPAN
This method does not accept any arguments.
=head2 query_strand
Returns the strand of the query. The strand can be either 1 or -1 depending
on the sign of the element C<<Hsp_query-frame>>.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $query_strand = $hsp->query_strand;
This method does not accept any arguments.
=head2 query_start
Returns the start coordinate of the query. This value is taken either from
the element C<<Hsp_query-from>> or from the element C<<Hsp_query-to>>
depending on the query orientation. The numerical value returned by this
method is guaranteed to be lower than the value returned by C<query_end>.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my ($query_start, $query_end) = ($hsp->query_start, $hsp->query_end);
if ($query_start < $query_end) { # always true
...
}
This method does not accept any arguments.
=head2 query_end
Returns the end coordinate of the query. This value is taken either from the
element C<<Hsp_query-to>> or from the element C<<Hsp_query-from>> depending
on the query orientation. The numerical value returned by this method is
guaranteed to be greater than the value returned by C<query_start>.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my ($query_start, $query_end) = ($hsp->query_start, $hsp->query_end);
if ($query_start < $query_end) { # always true
...
}
This method does not accept any arguments.
=head2 query_coverage
Returns the query coverage of the HSP.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $query_coverage = $hsp->query_coverage;
This method does not accept any arguments.
=head2 subject_coverage
Returns the subject (hit) coverage of the HSP.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $subject_coverage = $hsp->subject_coverage;
This method does not accept any arguments.
=head2 percentage_identity
Returns the percentage of identity of the HSP.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $percentage_identity = $hsp->percentage_identity;
This method does not accept any arguments.
=head2 percentage_positive
Returns the percentage of positive matches of the HSP.
# $hsp is a Bio::FastParsers::Blast::Xml::Hsp
my $percentage_positive = $hsp->percentage_positive;
This method does not accept any arguments.
=head1 ALIASES
=head2 expect
Alias for C<evalue> method. For API consistency.
=head2 qcov
Alias for C<query_coverage> method. For API consistency.
=head2 scov
Alias for C<subject_coverage> method. For API consistency.
=head2 pident
Alias for C<percentage_identity> method. For API consistency.
=head2 ppos
Alias for C<percentage_positive> method. For API consistency.
=head2 query_len
Alias for C<query_len> method in Hit object. For API completeness.
=head2 hit_len
Alias for C<len> method in Hit object. For API completeness.
=head1 AUTHOR
Denis BAURAIN <denis.baurain@uliege.be>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 2.313 seconds using v1.01-cache-2.11-cpan-302cb4679cc )