| 1 | package Bio::FastParsers::Blast::Xml::Iteration; | ||
| 2 | # ABSTRACT: NCBI BLAST DTD-derived internal class | ||
| 3 | 7 | $Bio::FastParsers::Blast::Xml::Iteration::VERSION = '0.213510'; | |
| 4 | 7 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 7 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | # AUTOGENERATED CODE! DO NOT MODIFY THIS FILE! | ||
| 8 | |||
| 9 | 7 | ▶ | use XML::Bare qw(forcearray); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 7 | ▶ | use aliased 'Bio::FastParsers::Blast::Xml::Hit'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 7 | ▶ | use aliased 'Bio::FastParsers::Blast::Xml::Statistics'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | |||
| 15 | # private attributes | ||
| 16 | |||
| 17 | 7 | has '_root' => ( | |
| 18 | is => 'ro', | ||
| 19 | isa => 'HashRef', | ||
| 20 | required => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | 7 | has '_parent' => ( | |
| 24 | is => 'ro', | ||
| 25 | isa => 'Maybe[Object]', | ||
| 26 | required => 1, | ||
| 27 | ); | ||
| 28 | |||
| 29 | |||
| 30 | # public array(s) of composed objects | ||
| 31 | |||
| 32 | |||
| 33 | 7 | has 'hits' => ( | |
| 34 | traits => ['Array'], | ||
| 35 | is => 'ro', | ||
| 36 | isa => 'ArrayRef[Bio::FastParsers::Blast::Xml::Hit]', | ||
| 37 | init_arg => undef, | ||
| 38 | lazy => 1, | ||
| 39 | builder => '_build_hits', | ||
| 40 | handles => { | ||
| 41 | count_hits => 'count', | ||
| 42 | all_hits => 'elements', | ||
| 43 | get_hit => 'get', | ||
| 44 | next_hit => 'shift', | ||
| 45 | }, | ||
| 46 | ); | ||
| 47 | |||
| 48 | ## no critic (ProhibitUnusedPrivateSubroutines) | ||
| 49 | |||
| 50 | sub _build_hits { | ||
| 51 | 6 | ▶ | my $self = shift; |
|
Subroutine
_build_hits: called CC=1 SCAR=0.0
| |||
| 52 | 44 | return [ map { Hit->new( _root => $_, _parent => $self ) } @{ | |
| 53 | 6 | forcearray $self->_root->{'Iteration_hits'}->{'Hit'} | |
| 54 | } ]; | ||
| 55 | } | ||
| 56 | |||
| 57 | ## use critic | ||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | # public composed object(s) | ||
| 62 | |||
| 63 | |||
| 64 | 7 | has 'stat' => ( | |
| 65 | is => 'ro', | ||
| 66 | isa => 'Bio::FastParsers::Blast::Xml::Statistics', | ||
| 67 | init_arg => undef, | ||
| 68 | lazy => 1, | ||
| 69 | builder => '_build_stat', | ||
| 70 | ); | ||
| 71 | |||
| 72 | ## no critic (ProhibitUnusedPrivateSubroutines) | ||
| 73 | |||
| 74 | sub _build_stat { | ||
| 75 | 0 | ▶ | my $self = shift; |
|
Subroutine
_build_stat: not called CC=1 SCAR=6.9
| |||
| 76 | return Statistics->new( | ||
| 77 | 0 | _root => $self->_root->{'Iteration_stat'}->{'Statistics'}, | |
| 78 | _parent => $self | ||
| 79 | ); | ||
| 80 | } | ||
| 81 | |||
| 82 | # use critic | ||
| 83 | |||
| 84 | |||
| 85 | # public methods | ||
| 86 | |||
| 87 | |||
| 88 | sub iter_num { | ||
| 89 | 0 | ▶ | return shift->_root->{'Iteration_iter-num'}->{'value'} |
|
Subroutine
iter_num: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | sub message { | ||
| 94 | 0 | ▶ | return shift->_root->{'Iteration_message'}->{'value'} |
|
Subroutine
message: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 95 | } | ||
| 96 | |||
| 97 | |||
| 98 | sub query_def { | ||
| 99 | 0 | ▶ | return shift->_root->{'Iteration_query-def'}->{'value'} |
|
Subroutine
query_def: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 100 | } | ||
| 101 | |||
| 102 | |||
| 103 | sub query_id { | ||
| 104 | 0 | ▶ | return shift->_root->{'Iteration_query-ID'}->{'value'} |
|
Subroutine
query_id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 105 | } | ||
| 106 | |||
| 107 | |||
| 108 | sub query_len { | ||
| 109 | 2 | ▶ | return shift->_root->{'Iteration_query-len'}->{'value'} |
|
Subroutine
query_len: called CC=1 SCAR=0.0
Pod
documented
| |||
| 110 | } | ||
| 111 | |||
| 112 | |||
| 113 | # public aliases | ||
| 114 | |||
| 115 | |||
| 116 | sub statistics { | ||
| 117 | return shift->stat | ||
| 118 | 0 | ▶ | } |
|
Subroutine
statistics: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 119 | |||
| 120 | |||
| 121 | sub num { | ||
| 122 | return shift->iter_num | ||
| 123 | 0 | ▶ | } |
|
Subroutine
num: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 124 | |||
| 125 | |||
| 126 | 7 | __PACKAGE__->meta->make_immutable; | |
| 127 | 7 | 1; | |
| 128 | |||
| 129 | __END__ | ||
| 130 | |||
| 131 | =pod | ||
| 132 | |||
| 133 | =head1 NAME | ||
| 134 | |||
| 135 | Bio::FastParsers::Blast::Xml::Iteration - NCBI BLAST DTD-derived internal class | ||
| 136 | |||
| 137 | =head1 VERSION | ||
| 138 | |||
| 139 | version 0.213510 | ||
| 140 | |||
| 141 | =head1 SYNOPSIS | ||
| 142 | |||
| 143 | # see Bio::FastParsers::Blast::Xml | ||
| 144 | |||
| 145 | =head1 DESCRIPTION | ||
| 146 | |||
| 147 | This class implements the C<Iteration> level of the XML BLAST parser. | ||
| 148 | |||
| 149 | =head1 ATTRIBUTES | ||
| 150 | |||
| 151 | =head2 hits | ||
| 152 | |||
| 153 | ArrayRef of L<Bio::FastParsers::Blast::Xml::Hit> | ||
| 154 | |||
| 155 | =head2 stat | ||
| 156 | |||
| 157 | L<Bio::FastParsers::Blast::Xml::Statistics> composed object | ||
| 158 | |||
| 159 | =head1 METHODS | ||
| 160 | |||
| 161 | =head2 count_hits | ||
| 162 | |||
| 163 | Returns the number of Hits of the Iteration. | ||
| 164 | |||
| 165 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 166 | my $count = $iteration->count_hits; | ||
| 167 | |||
| 168 | This method does not accept any arguments. | ||
| 169 | |||
| 170 | =head2 all_hits | ||
| 171 | |||
| 172 | Returns all the Hits of the Iteration (not an array reference). | ||
| 173 | |||
| 174 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 175 | my @hits = $iteration->all_hits; | ||
| 176 | |||
| 177 | This method does not accept any arguments. | ||
| 178 | |||
| 179 | =head2 get_hit | ||
| 180 | |||
| 181 | Returns one Hit of the Iteration by its index. You can also use | ||
| 182 | negative index numbers, just as with Perl's core array handling. If the | ||
| 183 | specified Hit does not exist, this method will return C<undef>. | ||
| 184 | |||
| 185 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 186 | my $hit = $iteration->get_hit($index); | ||
| 187 | croak "Hit $index not found!" unless defined $hit; | ||
| 188 | |||
| 189 | This method accepts just one argument (and not an array slice). | ||
| 190 | |||
| 191 | =head2 next_hit | ||
| 192 | |||
| 193 | Shifts the first Hit of the array off and returns it, shortening the | ||
| 194 | array by 1 and moving everything down. If there are no more Hits in | ||
| 195 | the array, returns C<undef>. | ||
| 196 | |||
| 197 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 198 | while (my $hit = $iteration->next_hit) { | ||
| 199 | # process $hit | ||
| 200 | # ... | ||
| 201 | } | ||
| 202 | |||
| 203 | This method does not accept any arguments. | ||
| 204 | |||
| 205 | =head2 iter_num | ||
| 206 | |||
| 207 | Returns the value of the element C<<Iteration_iter-num>>. | ||
| 208 | |||
| 209 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 210 | my $iter_num = $iteration->iter_num; | ||
| 211 | |||
| 212 | This method does not accept any arguments. | ||
| 213 | |||
| 214 | =head2 message | ||
| 215 | |||
| 216 | Returns the value of the element C<<Iteration_message>>. | ||
| 217 | |||
| 218 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 219 | my $message = $iteration->message; | ||
| 220 | |||
| 221 | This method does not accept any arguments. | ||
| 222 | |||
| 223 | =head2 query_def | ||
| 224 | |||
| 225 | Returns the value of the element C<<Iteration_query-def>>. | ||
| 226 | |||
| 227 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 228 | my $query_def = $iteration->query_def; | ||
| 229 | |||
| 230 | This method does not accept any arguments. | ||
| 231 | |||
| 232 | =head2 query_id | ||
| 233 | |||
| 234 | Returns the value of the element C<<Iteration_query-ID>>. | ||
| 235 | |||
| 236 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 237 | my $query_id = $iteration->query_id; | ||
| 238 | |||
| 239 | This method does not accept any arguments. | ||
| 240 | |||
| 241 | =head2 query_len | ||
| 242 | |||
| 243 | Returns the value of the element C<<Iteration_query-len>>. | ||
| 244 | |||
| 245 | # $iteration is a Bio::FastParsers::Blast::Xml::Iteration | ||
| 246 | my $query_len = $iteration->query_len; | ||
| 247 | |||
| 248 | This method does not accept any arguments. | ||
| 249 | |||
| 250 | =head1 ALIASES | ||
| 251 | |||
| 252 | =head2 statistics | ||
| 253 | |||
| 254 | Alias for C<stat> method. For API consistency. | ||
| 255 | |||
| 256 | =head2 num | ||
| 257 | |||
| 258 | Alias for C<iter_num> method. For API consistency. | ||
| 259 | |||
| 260 | =head1 AUTHOR | ||
| 261 | |||
| 262 | Denis BAURAIN <denis.baurain@uliege.be> | ||
| 263 | |||
| 264 | =head1 COPYRIGHT AND LICENSE | ||
| 265 | |||
| 266 | This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. | ||
| 267 | |||
| 268 | This is free software; you can redistribute it and/or modify it under | ||
| 269 | the same terms as the Perl 5 programming language system itself. | ||
| 270 | |||
| 271 | =cut | ||