Bio-FastParsers

 view release on metacpan or  search on metacpan

lib/Bio/FastParsers/Blast/Table.pm  view on Meta::CPAN

package Bio::FastParsers::Blast::Table;
# ABSTRACT: Front-end class for tabular BLAST parser
$Bio::FastParsers::Blast::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::Blast::Table::Hsp';

# TODO: recreate Table classes and internal classes through Templating
# TODO: check API consistency with Hmmer::Table and DomTable through synonyms
# TODO: document Hsp/Hit methods

# 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',
    },
);

has '_last_' . $_ => (
    is       => 'ro',
    isa      => 'Str',
    init_arg => undef,
    default  => q{},
    writer   => '_set_last_' . $_,
) for qw(query hit);


## 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(
    query_id hit_id
    percent_identity hsp_length mismatches gaps
    query_from  query_to
      hit_from    hit_to
    evalue bit_score
    query_strand
      hit_strand
    query_start query_end



( run in 0.835 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )