FastParsers/Blast/Xml/Hit.pm

filter: Statementstmt 85.7% 24 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod 100% 6 / 6 totaltotal 82.2% 37 / 45 CC 1 SCAR 3.1
CC
1
Cov
86%
accession
2.0
def
2.0
id
2.0
CRAP 1.4
« FastParsers/Hmmer/Standard.pm ↑ Summary FastParsers/Blast/Table/Hsp.pm »
1 package Bio::FastParsers::Blast::Xml::Hit;
2 # ABSTRACT: NCBI BLAST DTD-derived internal class
3 7 $Bio::FastParsers::Blast::Xml::Hit::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::Hsp';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 # private attributes
15  
16 7 has '_root' => (
17 is => 'ro',
18 isa => 'HashRef',
19 required => 1,
20 );
21  
22 7 has '_parent' => (
23 is => 'ro',
24 isa => 'Maybe[Object]',
25 required => 1,
26 );
27  
28  
29 # public array(s) of composed objects
30  
31  
32 7 has 'hsps' => (
33 traits => ['Array'],
34 is => 'ro',
35 isa => 'ArrayRef[Bio::FastParsers::Blast::Xml::Hsp]',
36 init_arg => undef,
37 lazy => 1,
38 builder => '_build_hsps',
39 handles => {
40 count_hsps => 'count',
41 all_hsps => 'elements',
42 get_hsp => 'get',
43 next_hsp => 'shift',
44 },
45 );
46  
47 ## no critic (ProhibitUnusedPrivateSubroutines)
48  
49 sub _build_hsps {
50 43 ▶ my $self = shift;
Subroutine _build_hsps: called CC=1 SCAR=0.0
51 651 return [ map { Hsp->new( _root => $_, _parent => $self ) } @{
52 43 forcearray $self->_root->{'Hit_hsps'}->{'Hsp'}
53 } ];
54 }
55  
56 ## use critic
57  
58  
59  
60 # public composed object(s)
61  
62  
63 # public methods
64  
65  
66 sub accession {
67 0 ▶ return shift->_root->{'Hit_accession'}->{'value'}
Subroutine accession: not called CC=1 SCAR=6.9
Pod documented
68 }
69  
70  
71 sub def {
72 0 ▶ return shift->_root->{'Hit_def'}->{'value'}
Subroutine def: not called CC=1 SCAR=6.9
Pod documented
73 }
74  
75  
76 sub id {
77 0 ▶ return shift->_root->{'Hit_id'}->{'value'}
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
78 }
79  
80  
81 sub len {
82 2 ▶ return shift->_root->{'Hit_len'}->{'value'}
Subroutine len: called CC=1 SCAR=0.0
Pod documented
83 }
84  
85  
86 sub num {
87 0 ▶ return shift->_root->{'Hit_num'}->{'value'}
Subroutine num: not called CC=1 SCAR=6.9
Pod documented
88 }
89  
90  
91 # public aliases
92  
93  
94  
95 sub query_len {
96 return shift->_parent->query_len
97 2 ▶}
Subroutine query_len: called CC=1 SCAR=0.0
Pod documented
98  
99  
100 7 __PACKAGE__->meta->make_immutable;
101 7 1;
102  
103 __END__
104  
105 =pod
106  
107 =head1 NAME
108  
109 Bio::FastParsers::Blast::Xml::Hit - NCBI BLAST DTD-derived internal class
110  
111 =head1 VERSION
112  
113 version 0.213510
114  
115 =head1 SYNOPSIS
116  
117 # see Bio::FastParsers::Blast::Xml
118  
119 =head1 DESCRIPTION
120  
121 This class implements the C<Hit> level of the XML BLAST parser.
122  
123 =head1 ATTRIBUTES
124  
125 =head2 hsps
126  
127 ArrayRef of L<Bio::FastParsers::Blast::Xml::Hsp>
128  
129 =head1 METHODS
130  
131 =head2 count_hsps
132  
133 Returns the number of Hsps of the Hit.
134  
135 # $hit is a Bio::FastParsers::Blast::Xml::Hit
136 my $count = $hit->count_hsps;
137  
138 This method does not accept any arguments.
139  
140 =head2 all_hsps
141  
142 Returns all the Hsps of the Hit (not an array reference).
143  
144 # $hit is a Bio::FastParsers::Blast::Xml::Hit
145 my @hsps = $hit->all_hsps;
146  
147 This method does not accept any arguments.
148  
149 =head2 get_hsp
150  
151 Returns one Hsp of the Hit by its index. You can also use
152 negative index numbers, just as with Perl's core array handling. If the
153 specified Hsp does not exist, this method will return C<undef>.
154  
155 # $hit is a Bio::FastParsers::Blast::Xml::Hit
156 my $hsp = $hit->get_hsp($index);
157 croak "Hsp $index not found!" unless defined $hsp;
158  
159 This method accepts just one argument (and not an array slice).
160  
161 =head2 next_hsp
162  
163 Shifts the first Hsp of the array off and returns it, shortening the
164 array by 1 and moving everything down. If there are no more Hsps in
165 the array, returns C<undef>.
166  
167 # $hit is a Bio::FastParsers::Blast::Xml::Hit
168 while (my $hsp = $hit->next_hsp) {
169 # process $hsp
170 # ...
171 }
172  
173 This method does not accept any arguments.
174  
175 =head2 accession
176  
177 Returns the value of the element C<<Hit_accession>>.
178  
179 # $hit is a Bio::FastParsers::Blast::Xml::Hit
180 my $accession = $hit->accession;
181  
182 This method does not accept any arguments.
183  
184 =head2 def
185  
186 Returns the value of the element C<<Hit_def>>.
187  
188 # $hit is a Bio::FastParsers::Blast::Xml::Hit
189 my $def = $hit->def;
190  
191 This method does not accept any arguments.
192  
193 =head2 id
194  
195 Returns the value of the element C<<Hit_id>>.
196  
197 # $hit is a Bio::FastParsers::Blast::Xml::Hit
198 my $id = $hit->id;
199  
200 This method does not accept any arguments.
201  
202 =head2 len
203  
204 Returns the value of the element C<<Hit_len>>.
205  
206 # $hit is a Bio::FastParsers::Blast::Xml::Hit
207 my $len = $hit->len;
208  
209 This method does not accept any arguments.
210  
211 =head2 num
212  
213 Returns the value of the element C<<Hit_num>>.
214  
215 # $hit is a Bio::FastParsers::Blast::Xml::Hit
216 my $num = $hit->num;
217  
218 This method does not accept any arguments.
219  
220 =head1 ALIASES
221  
222 =head2 query_len
223  
224 Alias for C<query_len> method in Iteration object. For API completeness.
225  
226 =head1 AUTHOR
227  
228 Denis BAURAIN <denis.baurain@uliege.be>
229  
230 =head1 COPYRIGHT AND LICENSE
231  
232 This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
233  
234 This is free software; you can redistribute it and/or modify it under
235 the same terms as the Perl 5 programming language system itself.
236  
237 =cut
« FastParsers/Hmmer/Standard.pm ↑ Summary FastParsers/Blast/Table/Hsp.pm »