Bio-MUST-Apps-FortyTwo
view release on metacpan or search on metacpan
lib/Bio/MUST/Apps/Debrief42/TaxReport.pm view on Meta::CPAN
package Bio::MUST::Apps::Debrief42::TaxReport;
# ABSTRACT: Front-end class for tabular tax-report parser
# CONTRIBUTOR: Mick VAN VLIERBERGHE <mvanvlierberghe@doct.uliege.be>
$Bio::MUST::Apps::Debrief42::TaxReport::VERSION = '0.213470';
use Moose;
use namespace::autoclean;
use autodie;
use feature qw(say);
use List::AllUtils qw(mesh);
extends 'Bio::FastParsers::Base';
use Bio::MUST::Core;
use Bio::MUST::Core::Utils qw(change_suffix);
use Bio::FastParsers::Constants qw(:files);
use aliased 'Bio::MUST::Apps::Debrief42::TaxReport::NewSeq';
use Smart::Comments;
# 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 = ( NewSeq->heads, 'outfile' );
sub next_seq {
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;
# process TaxReport line
( run in 1.787 second using v1.01-cache-2.11-cpan-98e64b0badf )