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