File Coverage

blib/lib/Bio/FastParsers/Hmmer/Standard.pm
Criterion Covered Total %
statement 25 29 86.2
branch n/a
condition n/a
subroutine 7 11 63.6
pod 0 5 0.0
total 32 45 71.1


line stmt bran cond sub pod time code
1             # ABSTRACT: Front-end class for standard HMMER parser
2             # CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com>
3             $Bio::FastParsers::Hmmer::Standard::VERSION = '0.221230';
4             use Moose;
5 7     7   49 use namespace::autoclean;
  7         13  
  7         51  
6 7     7   42433  
  7         17  
  7         64  
7             # TODO: check if autodie is actually needed here
8             use autodie;
9 7     7   615  
  7         14  
  7         58  
10             use List::AllUtils qw(indexes firstidx mesh);
11 7     7   32619  
  7         18  
  7         613  
12             extends 'Bio::FastParsers::Base';
13              
14             use Bio::FastParsers::Constants qw(:files);
15 7     7   57 use aliased 'Bio::FastParsers::Hmmer::Standard::Iteration';
  7         14  
  7         1004  
16 7     7   47  
  7         15  
  7         54  
17              
18             # public attributes (inherited)
19              
20              
21             # private attributes
22              
23             has '_iterations' => (
24             traits => ['Array'],
25             is => 'ro',
26             isa => 'ArrayRef[Bio::FastParsers::Hmmer::Standard::Iteration]',
27             writer => '_set_iterations',
28             handles => {
29             next_iteration => 'shift',
30             get_iteration => 'get',
31             all_iterations => 'elements',
32             count_iterations => 'count',
33             },
34             );
35              
36             my $self = shift;
37              
38 9     9 0 17 my $content = $self->file->slurp; # includes autodie
39             my @iter_blocks = $content =~ m{ ( ^Query: .+? ^//$ ) }xmsg;
40 9         231 my @iterations = map { Iteration->new($_) } @iter_blocks;
41 9         12422 $self->_set_iterations( \@iterations );
42 9         30  
  10         409  
43 9         336 return;
44             }
45 9         264  
46              
47             # aliases
48              
49             return shift->next_iteration;
50             }
51              
52 0     0 0   return shift->get_iteration(@_);
53             }
54              
55             return shift->all_iterations;
56 0     0 0   }
57              
58             return shift->count_iterations;
59             }
60 0     0 0    
61             # TODO: improve documentation of HMMER methods
62              
63             __PACKAGE__->meta->make_immutable;
64 0     0 0   1;
65              
66              
67             =pod
68              
69             =head1 NAME
70              
71             Bio::FastParsers::Hmmer::Standard - Front-end class for standard HMMER parser
72              
73             =head1 VERSION
74              
75             version 0.221230
76              
77             =head1 SYNOPSIS
78              
79             use aliased 'Bio::FastParsers::Hmmer::Standard';
80              
81             # open and parse hmmsearch output
82             my $infile = 'test/hmmer.out';
83             my $parser = Standard->new(file => $infile);
84             say $parser->next_hit->fullseq_eval;
85              
86             =head1 DESCRIPTION
87              
88             # TODO
89              
90             =head1 ATTRIBUTES
91              
92             =head2 file
93              
94             Path to HMMER report file in standard format (--notextw) to be parsed
95              
96             =head1 AUTHOR
97              
98             Denis BAURAIN <denis.baurain@uliege.be>
99              
100             =head1 CONTRIBUTOR
101              
102             =for stopwords Arnaud DI FRANCO
103              
104             Arnaud DI FRANCO <arnaud.difranco@gmail.com>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
109              
110             This is free software; you can redistribute it and/or modify it under
111             the same terms as the Perl 5 programming language system itself.
112              
113             =cut