| 1 | package Bio::FastParsers::Hmmer::Standard; | ||
| 2 | # ABSTRACT: Front-end class for standard HMMER parser | ||
| 3 | # CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com> | ||
| 4 | 7 | $Bio::FastParsers::Hmmer::Standard::VERSION = '0.221230'; | |
| 5 | 7 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 7 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | # TODO: check if autodie is actually needed here | ||
| 9 | 7 | ▶ | use autodie; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 7 | ▶ | use List::AllUtils qw(indexes firstidx mesh); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 7 | extends 'Bio::FastParsers::Base'; | |
| 14 | |||
| 15 | 7 | ▶ | use Bio::FastParsers::Constants qw(:files); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 7 | ▶ | use aliased 'Bio::FastParsers::Hmmer::Standard::Iteration'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | |||
| 19 | # public attributes (inherited) | ||
| 20 | |||
| 21 | |||
| 22 | # private attributes | ||
| 23 | |||
| 24 | 7 | has '_iterations' => ( | |
| 25 | traits => ['Array'], | ||
| 26 | is => 'ro', | ||
| 27 | isa => 'ArrayRef[Bio::FastParsers::Hmmer::Standard::Iteration]', | ||
| 28 | writer => '_set_iterations', | ||
| 29 | handles => { | ||
| 30 | next_iteration => 'shift', | ||
| 31 | get_iteration => 'get', | ||
| 32 | all_iterations => 'elements', | ||
| 33 | count_iterations => 'count', | ||
| 34 | }, | ||
| 35 | ); | ||
| 36 | |||
| 37 | 9 | ▶ | sub BUILD { |
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 38 | 9 | my $self = shift; | |
| 39 | |||
| 40 | 9 | my $content = $self->file->slurp; # includes autodie | |
| 41 | 9 | my @iter_blocks = $content =~ m{ ( ^Query: .+? ^//$ ) }xmsg; | |
| 42 | 9 | my @iterations = map { Iteration->new($_) } @iter_blocks; | |
| 43 | 9 | $self->_set_iterations( \@iterations ); | |
| 44 | |||
| 45 | 9 | return; | |
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | # aliases | ||
| 50 | |||
| 51 | 0 | ▶ | sub next_query { |
|
Subroutine
next_query: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 52 | 0 | return shift->next_iteration; | |
| 53 | } | ||
| 54 | |||
| 55 | 0 | ▶ | sub get_query { ## no critic (RequireArgUnpacking) |
|
Subroutine
get_query: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 56 | 0 | return shift->get_iteration(@_); | |
| 57 | } | ||
| 58 | |||
| 59 | 0 | ▶ | sub all_queries { |
|
Subroutine
all_queries: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 60 | 0 | return shift->all_iterations; | |
| 61 | } | ||
| 62 | |||
| 63 | 0 | ▶ | sub count_queries { |
|
Subroutine
count_queries: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 64 | 0 | return shift->count_iterations; | |
| 65 | } | ||
| 66 | |||
| 67 | # TODO: improve documentation of HMMER methods | ||
| 68 | |||
| 69 | 7 | __PACKAGE__->meta->make_immutable; | |
| 70 | 7 | 1; | |
| 71 | |||
| 72 | __END__ | ||