| 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.213510'; | |
| 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 | sub BUILD { | ||
| 38 | 9 | ▶ | my $self = shift; |
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 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 | sub next_query { | ||
| 52 | 0 | ▶ | return shift->next_iteration; |
|
Subroutine
next_query: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 53 | } | ||
| 54 | |||
| 55 | sub get_query { ## no critic (RequireArgUnpacking) | ||
| 56 | 0 | ▶ | return shift->get_iteration(@_); |
|
Subroutine
get_query: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 57 | } | ||
| 58 | |||
| 59 | sub all_queries { | ||
| 60 | 0 | ▶ | return shift->all_iterations; |
|
Subroutine
all_queries: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 61 | } | ||
| 62 | |||
| 63 | sub count_queries { | ||
| 64 | 0 | ▶ | return shift->count_iterations; |
|
Subroutine
count_queries: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 65 | } | ||
| 66 | |||
| 67 | # TODO: improve documentation of HMMER methods | ||
| 68 | |||
| 69 | 7 | __PACKAGE__->meta->make_immutable; | |
| 70 | 7 | 1; | |
| 71 | |||
| 72 | __END__ | ||
| 73 | |||
| 74 | =pod | ||
| 75 | |||
| 76 | =head1 NAME | ||
| 77 | |||
| 78 | Bio::FastParsers::Hmmer::Standard - Front-end class for standard HMMER parser | ||
| 79 | |||
| 80 | =head1 VERSION | ||
| 81 | |||
| 82 | version 0.213510 | ||
| 83 | |||
| 84 | =head1 SYNOPSIS | ||
| 85 | |||
| 86 | use aliased 'Bio::FastParsers::Hmmer::Standard'; | ||
| 87 | |||
| 88 | # open and parse hmmsearch output | ||
| 89 | my $infile = 'test/hmmer.out'; | ||
| 90 | my $parser = Standard->new(file => $infile); | ||
| 91 | say $parser->next_hit->fullseq_eval; | ||
| 92 | |||
| 93 | =head1 DESCRIPTION | ||
| 94 | |||
| 95 | # TODO | ||
| 96 | |||
| 97 | =head1 ATTRIBUTES | ||
| 98 | |||
| 99 | =head2 file | ||
| 100 | |||
| 101 | Path to HMMER report file in standard format (--notextw) to be parsed | ||
| 102 | |||
| 103 | =head1 AUTHOR | ||
| 104 | |||
| 105 | Denis BAURAIN <denis.baurain@uliege.be> | ||
| 106 | |||
| 107 | =head1 CONTRIBUTOR | ||
| 108 | |||
| 109 | =for stopwords Arnaud DI FRANCO | ||
| 110 | |||
| 111 | Arnaud DI FRANCO <arnaud.difranco@gmail.com> | ||
| 112 | |||
| 113 | =head1 COPYRIGHT AND LICENSE | ||
| 114 | |||
| 115 | This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. | ||
| 116 | |||
| 117 | This is free software; you can redistribute it and/or modify it under | ||
| 118 | the same terms as the Perl 5 programming language system itself. | ||
| 119 | |||
| 120 | =cut | ||