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