Bio-FastParsers
view release on metacpan or search on metacpan
lib/Bio/FastParsers/Hmmer/DomTable.pm view on Meta::CPAN
package Bio::FastParsers::Hmmer::DomTable;
# ABSTRACT: Front-end class for tabular HMMER domain parser
# CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com>
$Bio::FastParsers::Hmmer::DomTable::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::DomTable::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 tlen
query_name query_accession qlen
evalue score bias rank of
c_evalue i_evalue dom_score dom_bias
hmm_from hmm_to ali_from ali_to env_from env_to
acc 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 2.826 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )