File Coverage

blib/lib/Bio/FastParsers/Blast/Xml/BlastOutput.pm
Criterion Covered Total %
statement 27 36 75.0
branch n/a
condition n/a
subroutine 11 19 57.8
pod 10 10 100.0
total 48 65 73.8


line stmt bran cond sub pod time code
1             package Bio::FastParsers::Blast::Xml::BlastOutput;
2             # ABSTRACT: NCBI BLAST DTD-derived internal class
3             $Bio::FastParsers::Blast::Xml::BlastOutput::VERSION = '0.201110';
4 7     7   4276 use Moose;
  7         21  
  7         71  
5 7     7   48485 use namespace::autoclean;
  7         19  
  7         55  
6              
7             # AUTOGENERATED CODE! DO NOT MODIFY THIS FILE!
8              
9 7     7   869 use XML::Bare qw(forcearray);
  7         23  
  7         541  
10              
11 7     7   65 use aliased 'Bio::FastParsers::Blast::Xml::Iteration';
  7         47  
  7         57  
12 7     7   848 use aliased 'Bio::FastParsers::Blast::Xml::Statistics';
  7         19  
  7         43  
13 7     7   1197 use aliased 'Bio::FastParsers::Blast::Xml::Parameters';
  7         19  
  7         27  
14              
15              
16             # private attributes
17              
18             has '_root' => (
19             is => 'ro',
20             isa => 'HashRef',
21             required => 1,
22             );
23              
24              
25             # public array(s) of composed objects
26              
27              
28             has 'iterations' => (
29             traits => ['Array'],
30             is => 'ro',
31             isa => 'ArrayRef[Bio::FastParsers::Blast::Xml::Iteration]',
32             init_arg => undef,
33             lazy => 1,
34             builder => '_build_iterations',
35             handles => {
36             count_iterations => 'count',
37             all_iterations => 'elements',
38             get_iteration => 'get',
39             next_iteration => 'shift',
40             },
41             );
42              
43             ## no critic (ProhibitUnusedPrivateSubroutines)
44              
45             sub _build_iterations {
46 6     6   18 my $self = shift;
47 7         349 return [ map { Iteration->new( _root => $_ ) } @{
48 6         16 forcearray $self->_root->{'BlastOutput_iterations'}->{'Iteration'}
  6         207  
49             } ];
50             }
51              
52             ## use critic
53              
54              
55              
56             # public composed object(s)
57              
58              
59             has 'mbstat' => (
60             is => 'ro',
61             isa => 'Bio::FastParsers::Blast::Xml::Statistics',
62             init_arg => undef,
63             lazy => 1,
64             builder => '_build_mbstat',
65             );
66              
67             ## no critic (ProhibitUnusedPrivateSubroutines)
68              
69             sub _build_mbstat {
70 0     0   0 my $self = shift;
71             return Statistics->new(
72 0         0 _root => $self->_root->{'BlastOutput_mbstat'}->{'Statistics'}
73             );
74             }
75              
76             # use critic
77              
78              
79             has 'param' => (
80             is => 'ro',
81             isa => 'Bio::FastParsers::Blast::Xml::Parameters',
82             init_arg => undef,
83             lazy => 1,
84             builder => '_build_param',
85             );
86              
87             ## no critic (ProhibitUnusedPrivateSubroutines)
88              
89             sub _build_param {
90 5     5   15 my $self = shift;
91             return Parameters->new(
92 5         185 _root => $self->_root->{'BlastOutput_param'}->{'Parameters'}
93             );
94             }
95              
96             # use critic
97              
98              
99             # public methods
100              
101              
102             sub db {
103 5     5 1 162 return shift->_root->{'BlastOutput_db'}->{'value'}
104             }
105              
106              
107             sub program {
108 5     5 1 210 return shift->_root->{'BlastOutput_program'}->{'value'}
109             }
110              
111              
112             sub query_def {
113 0     0 1 0 return shift->_root->{'BlastOutput_query-def'}->{'value'}
114             }
115              
116              
117             sub query_id {
118 0     0 1 0 return shift->_root->{'BlastOutput_query-ID'}->{'value'}
119             }
120              
121              
122             sub query_len {
123 0     0 1 0 return shift->_root->{'BlastOutput_query-len'}->{'value'}
124             }
125              
126              
127             sub query_seq {
128 0     0 1 0 return shift->_root->{'BlastOutput_query-seq'}->{'value'}
129             }
130              
131              
132             sub reference {
133 0     0 1 0 return shift->_root->{'BlastOutput_reference'}->{'value'}
134             }
135              
136              
137             sub version {
138 0     0 1 0 return shift->_root->{'BlastOutput_version'}->{'value'}
139             }
140              
141              
142             # public aliases
143              
144              
145             sub statistics {
146             return shift->mbstat
147 0     0 1 0 }
148              
149              
150             sub parameters {
151             return shift->param
152 10     10 1 15455 }
153              
154              
155             __PACKAGE__->meta->make_immutable;
156             1;
157              
158             __END__
159              
160             =pod
161              
162             =head1 NAME
163              
164             Bio::FastParsers::Blast::Xml::BlastOutput - NCBI BLAST DTD-derived internal class
165              
166             =head1 VERSION
167              
168             version 0.201110
169              
170             =head1 SYNOPSIS
171              
172             # see Bio::FastParsers::Blast::Xml
173              
174             =head1 DESCRIPTION
175              
176             This class implements the C<BlastOutput> level of the XML BLAST parser.
177              
178             =head1 ATTRIBUTES
179              
180             =head2 iterations
181              
182             ArrayRef of L<Bio::FastParsers::Blast::Xml::Iteration>
183              
184             =head2 mbstat
185              
186             L<Bio::FastParsers::Blast::Xml::Statistics> composed object
187              
188             =head2 param
189              
190             L<Bio::FastParsers::Blast::Xml::Parameters> composed object
191              
192             =head1 METHODS
193              
194             =head2 count_iterations
195              
196             Returns the number of Iterations of the BlastOutput.
197              
198             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
199             my $count = $blast_output->count_iterations;
200              
201             This method does not accept any arguments.
202              
203             =head2 all_iterations
204              
205             Returns all the Iterations of the BlastOutput (not an array reference).
206              
207             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
208             my @iterations = $blast_output->all_iterations;
209              
210             This method does not accept any arguments.
211              
212             =head2 get_iteration
213              
214             Returns one Iteration of the BlastOutput by its index. You can also use
215             negative index numbers, just as with Perl's core array handling. If the
216             specified Iteration does not exist, this method will return C<undef>.
217              
218             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
219             my $iteration = $blast_output->get_iteration($index);
220             croak "Iteration $index not found!" unless defined $iteration;
221              
222             This method accepts just one argument (and not an array slice).
223              
224             =head2 next_iteration
225              
226             Shifts the first Iteration of the array off and returns it, shortening the
227             array by 1 and moving everything down. If there are no more Iterations in
228             the array, returns C<undef>.
229              
230             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
231             while (my $iteration = $blast_output->next_iteration) {
232             # process $iteration
233             # ...
234             }
235              
236             This method does not accept any arguments.
237              
238             =head2 db
239              
240             Returns the value of the element C<<BlastOutput_db>>.
241              
242             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
243             my $db = $blast_output->db;
244              
245             This method does not accept any arguments.
246              
247             =head2 program
248              
249             Returns the value of the element C<<BlastOutput_program>>.
250              
251             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
252             my $program = $blast_output->program;
253              
254             This method does not accept any arguments.
255              
256             =head2 query_def
257              
258             Returns the value of the element C<<BlastOutput_query-def>>.
259              
260             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
261             my $query_def = $blast_output->query_def;
262              
263             This method does not accept any arguments.
264              
265             =head2 query_id
266              
267             Returns the value of the element C<<BlastOutput_query-ID>>.
268              
269             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
270             my $query_id = $blast_output->query_id;
271              
272             This method does not accept any arguments.
273              
274             =head2 query_len
275              
276             Returns the value of the element C<<BlastOutput_query-len>>.
277              
278             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
279             my $query_len = $blast_output->query_len;
280              
281             This method does not accept any arguments.
282              
283             =head2 query_seq
284              
285             Returns the value of the element C<<BlastOutput_query-seq>>.
286              
287             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
288             my $query_seq = $blast_output->query_seq;
289              
290             This method does not accept any arguments.
291              
292             =head2 reference
293              
294             Returns the value of the element C<<BlastOutput_reference>>.
295              
296             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
297             my $reference = $blast_output->reference;
298              
299             This method does not accept any arguments.
300              
301             =head2 version
302              
303             Returns the value of the element C<<BlastOutput_version>>.
304              
305             # $blast_output is a Bio::FastParsers::Blast::Xml::BlastOutput
306             my $version = $blast_output->version;
307              
308             This method does not accept any arguments.
309              
310             =head1 ALIASES
311              
312             =head2 statistics
313              
314             Alias for C<mbstat> method. For API consistency.
315              
316             =head2 parameters
317              
318             Alias for C<param> method. For API consistency.
319              
320             =head1 AUTHOR
321              
322             Denis BAURAIN <denis.baurain@uliege.be>
323              
324             =head1 COPYRIGHT AND LICENSE
325              
326             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
327              
328             This is free software; you can redistribute it and/or modify it under
329             the same terms as the Perl 5 programming language system itself.
330              
331             =cut