Bio-MUST-Apps-OmpaPa

 view release on metacpan or  search on metacpan

lib/Bio/MUST/Apps/OmpaPa/Hmmer.pm  view on Meta::CPAN

package Bio::MUST::Apps::OmpaPa::Hmmer;
# ABSTRACT: internal class for tabular HMMER parser
# CONTRIBUTOR: Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
$Bio::MUST::Apps::OmpaPa::Hmmer::VERSION = '0.260260';
use Moose;
use namespace::autoclean;

use autodie;
use feature qw(say);

use Smart::Comments '###';

use Carp;
use List::AllUtils qw(mesh);

extends 'Bio::FastParsers::Hmmer::DomTable';
with 'Bio::MUST::Apps::OmpaPa::Roles::Parsable';


sub collect_hits {
    my $self = shift;

    my @hits;

    # parse HMMER report
    HIT:
    while (my $hit = $self->next_hit) {

        # honor --max-hits limit
        if (@hits >= $self->max_hits) {
            carp 'Reached --max-hits limit; truncating report!';
            last HIT;
        }

        if ($hit->rank == 1) {

            # collect useful hit attributes
            push @hits, {
                'acc'       => $hit->target_name,
                'dsc'       => $hit->target_description // 'none',
                'exp'       => $hit->evalue,
                'bit'       => $hit->score,
                'qlen'      => $hit->qlen,
                'len'       => $hit->tlen,
                'hmm_from'  => $hit->hmm_from,
                'hmm_to'    => $hit->hmm_to,
            };
        }
    }

    return \@hits;
}

__PACKAGE__->meta->make_immutable;
1;

__END__

=pod

=head1 NAME

Bio::MUST::Apps::OmpaPa::Hmmer - internal class for tabular HMMER parser

=head1 VERSION



( run in 1.705 second using v1.01-cache-2.11-cpan-302cb4679cc )