Bio-FastParsers
view release on metacpan or search on metacpan
lib/Bio/FastParsers/Hmmer/Table.pm view on Meta::CPAN
package Bio::FastParsers::Hmmer::Table;
# ABSTRACT: Front-end class for tabular HMMER parser
# CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com>
$Bio::FastParsers::Hmmer::Table::VERSION = '0.221230';
use Moose;
use namespace::autoclean;
use autodie;
use List::AllUtils qw(mesh);
extends 'Bio::FastParsers::Base';
use Bio::FastParsers::Constants qw(:files);
use aliased 'Bio::FastParsers::Hmmer::Table::Hit';
# public attributes (inherited)
# private attributes
has '_line_iterator' => (
traits => ['Code'],
is => 'ro',
isa => 'CodeRef',
init_arg => undef,
lazy => 1,
builder => '_build_line_iterator',
handles => {
_next_line => 'execute',
},
);
## no critic (ProhibitUnusedPrivateSubroutines)
sub _build_line_iterator {
my $self = shift;
open my $fh, '<', $self->file; # autodie
return sub { <$fh> }; # return closure
}
## use critic
my @attrs = qw(
target_name target_accession
query_name query_accession
evalue score bias
best_dom_evalue best_dom_score best_dom_bias
exp reg clu ov env dom rep inc
target_description
); # DID try to use MOP to get Hit attrs but order was not preserved
sub next_hit {
my $self = shift;
LINE:
while (my $line = $self->_next_line) {
# skip header/comments and empty lines
chomp $line;
next LINE if $line =~ $COMMENT_LINE
|| $line =~ $EMPTY_LINE;
( run in 0.491 second using v1.01-cache-2.11-cpan-ceb78f64989 )