File Coverage

blib/lib/Bio/FastParsers/Blast/Xml/Hsp.pm
Criterion Covered Total %
statement 35 45 77.7
branch 8 12 66.6
condition n/a
subroutine 21 31 67.7
pod 27 27 100.0
total 91 115 79.1


line stmt bran cond sub pod time code
1             package Bio::FastParsers::Blast::Xml::Hsp;
2             # ABSTRACT: NCBI BLAST DTD-derived internal class
3             $Bio::FastParsers::Blast::Xml::Hsp::VERSION = '0.201110';
4 7     7   4605 use Moose;
  7         17  
  7         41  
5 7     7   47206 use namespace::autoclean;
  7         18  
  7         48  
6              
7             # AUTOGENERATED CODE! DO NOT MODIFY THIS FILE!
8              
9 7     7   609 use XML::Bare qw(forcearray);
  7         18  
  7         4574  
10              
11              
12              
13             # private attributes
14              
15             has '_root' => (
16             is => 'ro',
17             isa => 'HashRef',
18             required => 1,
19             );
20              
21              
22             # public array(s) of composed objects
23              
24              
25             # public composed object(s)
26              
27              
28             # public methods
29              
30              
31             sub align_len {
32 0     0 1 0 return shift->_root->{'Hsp_align-len'}->{'value'}
33             }
34              
35              
36             sub bit_score {
37 0     0 1 0 return shift->_root->{'Hsp_bit-score'}->{'value'}
38             }
39              
40              
41             sub density {
42 0     0 1 0 return shift->_root->{'Hsp_density'}->{'value'}
43             }
44              
45              
46             sub evalue {
47 0     0 1 0 return shift->_root->{'Hsp_evalue'}->{'value'}
48             }
49              
50              
51             sub gaps {
52 0     0 1 0 return shift->_root->{'Hsp_gaps'}->{'value'}
53             }
54              
55              
56             sub hit_frame {
57 2     2 1 76 return shift->_root->{'Hsp_hit-frame'}->{'value'}
58             }
59              
60              
61             sub hit_from {
62 2421     2421 1 70092 return shift->_root->{'Hsp_hit-from'}->{'value'}
63             }
64              
65              
66             sub hit_to {
67 1858     1858 1 53137 return shift->_root->{'Hsp_hit-to'}->{'value'}
68             }
69              
70              
71             sub hseq {
72 0     0 1 0 return shift->_root->{'Hsp_hseq'}->{'value'}
73             }
74              
75              
76             sub identity {
77 55     55 1 1764 return shift->_root->{'Hsp_identity'}->{'value'}
78             }
79              
80              
81             sub midline {
82 40     40 1 1153 return shift->_root->{'Hsp_midline'}->{'value'}
83             }
84              
85              
86             sub num {
87 203     203 1 6030 return shift->_root->{'Hsp_num'}->{'value'}
88             }
89              
90              
91             sub pattern_from {
92 0     0 1 0 return shift->_root->{'Hsp_pattern-from'}->{'value'}
93             }
94              
95              
96             sub pattern_to {
97 0     0 1 0 return shift->_root->{'Hsp_pattern-to'}->{'value'}
98             }
99              
100              
101             sub positive {
102 563     563 1 17534 return shift->_root->{'Hsp_positive'}->{'value'}
103             }
104              
105              
106             sub qseq {
107 0     0 1 0 return shift->_root->{'Hsp_qseq'}->{'value'}
108             }
109              
110              
111             sub query_frame {
112 2     2 1 65 return shift->_root->{'Hsp_query-frame'}->{'value'}
113             }
114              
115              
116             sub query_from {
117 1858     1858 1 52961 return shift->_root->{'Hsp_query-from'}->{'value'}
118             }
119              
120              
121             sub query_to {
122 1858     1858 1 52719 return shift->_root->{'Hsp_query-to'}->{'value'}
123             }
124              
125              
126             sub score {
127 258     258 1 7468 return shift->_root->{'Hsp_score'}->{'value'}
128             }
129              
130              
131             # public aliases
132              
133              
134             sub expect {
135             return shift->evalue
136 0     0 1 0 }
137              
138             # pseudo-aliases
139              
140 7     7   60 use Const::Fast;
  7         23  
  7         83  
141             const my $NEGFRAME => qr{\A -}xms;
142              
143              
144             sub hit_strand {
145 1     1 1 3 my $self = shift;
146 1 50       6 return $self->hit_frame =~ $NEGFRAME ? -1 : 1;
147             }
148              
149              
150             sub hit_start {
151 619     619 1 2194 my $self = shift;
152 619 100       1121 return $self->hit_from < $self->hit_to ? $self->hit_from
153             : $self->hit_to;
154             }
155              
156              
157             sub hit_end {
158 619     619 1 1038 my $self = shift;
159 619 100       1035 return $self->hit_to > $self->hit_from ? $self->hit_to
160             : $self->hit_from;
161             }
162              
163              
164             sub query_strand {
165 1     1 1 9 my $self = shift;
166 1 50       7 return $self->query_frame =~ $NEGFRAME ? -1 : 1;
167             }
168              
169              
170             sub query_start {
171 619     619 1 2029 my $self = shift;
172 619 50       1129 return $self->query_from < $self->query_to ? $self->query_from
173             : $self->query_to;
174             }
175              
176              
177             sub query_end {
178 619     619 1 1057 my $self = shift;
179 619 50       1063 return $self->query_to > $self->query_from ? $self->query_to
180             : $self->query_from;
181             }
182              
183              
184             __PACKAGE__->meta->make_immutable;
185             1;
186              
187             __END__
188              
189             =pod
190              
191             =head1 NAME
192              
193             Bio::FastParsers::Blast::Xml::Hsp - NCBI BLAST DTD-derived internal class
194              
195             =head1 VERSION
196              
197             version 0.201110
198              
199             =head1 SYNOPSIS
200              
201             # see Bio::FastParsers::Blast::Xml
202              
203             =head1 DESCRIPTION
204              
205             This class implements the C<Hsp> level of the XML BLAST parser.
206              
207             =head1 METHODS
208              
209             =head2 align_len
210              
211             Returns the value of the element C<<Hsp_align-len>>.
212              
213             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
214             my $align_len = $hsp->align_len;
215              
216             This method does not accept any arguments.
217              
218             =head2 bit_score
219              
220             Returns the value of the element C<<Hsp_bit-score>>.
221              
222             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
223             my $bit_score = $hsp->bit_score;
224              
225             This method does not accept any arguments.
226              
227             =head2 density
228              
229             Returns the value of the element C<<Hsp_density>>.
230              
231             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
232             my $density = $hsp->density;
233              
234             This method does not accept any arguments.
235              
236             =head2 evalue
237              
238             Returns the value of the element C<<Hsp_evalue>>.
239              
240             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
241             my $evalue = $hsp->evalue;
242              
243             This method does not accept any arguments.
244              
245             =head2 gaps
246              
247             Returns the value of the element C<<Hsp_gaps>>.
248              
249             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
250             my $gaps = $hsp->gaps;
251              
252             This method does not accept any arguments.
253              
254             =head2 hit_frame
255              
256             Returns the value of the element C<<Hsp_hit-frame>>.
257              
258             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
259             my $hit_frame = $hsp->hit_frame;
260              
261             This method does not accept any arguments.
262              
263             =head2 hit_from
264              
265             Returns the value of the element C<<Hsp_hit-from>>.
266              
267             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
268             my $hit_from = $hsp->hit_from;
269              
270             This method does not accept any arguments.
271              
272             =head2 hit_to
273              
274             Returns the value of the element C<<Hsp_hit-to>>.
275              
276             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
277             my $hit_to = $hsp->hit_to;
278              
279             This method does not accept any arguments.
280              
281             =head2 hseq
282              
283             Returns the value of the element C<<Hsp_hseq>>.
284              
285             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
286             my $hseq = $hsp->hseq;
287              
288             This method does not accept any arguments.
289              
290             =head2 identity
291              
292             Returns the value of the element C<<Hsp_identity>>.
293              
294             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
295             my $identity = $hsp->identity;
296              
297             This method does not accept any arguments.
298              
299             =head2 midline
300              
301             Returns the value of the element C<<Hsp_midline>>.
302              
303             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
304             my $midline = $hsp->midline;
305              
306             This method does not accept any arguments.
307              
308             =head2 num
309              
310             Returns the value of the element C<<Hsp_num>>.
311              
312             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
313             my $num = $hsp->num;
314              
315             This method does not accept any arguments.
316              
317             =head2 pattern_from
318              
319             Returns the value of the element C<<Hsp_pattern-from>>.
320              
321             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
322             my $pattern_from = $hsp->pattern_from;
323              
324             This method does not accept any arguments.
325              
326             =head2 pattern_to
327              
328             Returns the value of the element C<<Hsp_pattern-to>>.
329              
330             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
331             my $pattern_to = $hsp->pattern_to;
332              
333             This method does not accept any arguments.
334              
335             =head2 positive
336              
337             Returns the value of the element C<<Hsp_positive>>.
338              
339             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
340             my $positive = $hsp->positive;
341              
342             This method does not accept any arguments.
343              
344             =head2 qseq
345              
346             Returns the value of the element C<<Hsp_qseq>>.
347              
348             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
349             my $qseq = $hsp->qseq;
350              
351             This method does not accept any arguments.
352              
353             =head2 query_frame
354              
355             Returns the value of the element C<<Hsp_query-frame>>.
356              
357             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
358             my $query_frame = $hsp->query_frame;
359              
360             This method does not accept any arguments.
361              
362             =head2 query_from
363              
364             Returns the value of the element C<<Hsp_query-from>>.
365              
366             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
367             my $query_from = $hsp->query_from;
368              
369             This method does not accept any arguments.
370              
371             =head2 query_to
372              
373             Returns the value of the element C<<Hsp_query-to>>.
374              
375             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
376             my $query_to = $hsp->query_to;
377              
378             This method does not accept any arguments.
379              
380             =head2 score
381              
382             Returns the value of the element C<<Hsp_score>>.
383              
384             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
385             my $score = $hsp->score;
386              
387             This method does not accept any arguments.
388              
389             =head2 hit_strand
390              
391             Returns the strand of the hit. The strand can be either 1 or -1 depending on
392             the sign of the element C<<Hsp_hit-frame>>.
393              
394             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
395             my $hit_strand = $hsp->hit_strand;
396              
397             This method does not accept any arguments.
398              
399             =head2 hit_start
400              
401             Returns the start coordinate of the hit. This value is taken either from the
402             element C<<Hsp_hit-from>> or from the element C<<Hsp_hit-to>> depending on
403             the hit orientation. The numerical value returned by this method is
404             guaranteed to be lower than the value returned by C<hit_end>.
405              
406             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
407             my ($hit_start, $hit_end) = ($hsp->hit_start, $hsp->hit_end);
408             if ($hit_start < $hit_end) { # always true
409             ...
410             }
411              
412             This method does not accept any arguments.
413              
414             =head2 hit_end
415              
416             Returns the end coordinate of the hit. This value is taken either from the
417             element C<<Hsp_hit-to>> or from the element C<<Hsp_hit-from>> depending on
418             the hit orientation. The numerical value returned by this method is
419             guaranteed to be greater than the value returned by C<hit_start>.
420              
421             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
422             my ($hit_start, $hit_end) = ($hsp->hit_start, $hsp->hit_end);
423             if ($hit_start < $hit_end) { # always true
424             ...
425             }
426              
427             This method does not accept any arguments.
428              
429             =head2 query_strand
430              
431             Returns the strand of the query. The strand can be either 1 or -1 depending
432             on the sign of the element C<<Hsp_query-frame>>.
433              
434             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
435             my $query_strand = $hsp->query_strand;
436              
437             This method does not accept any arguments.
438              
439             =head2 query_start
440              
441             Returns the start coordinate of the query. This value is taken either from
442             the element C<<Hsp_query-from>> or from the element C<<Hsp_query-to>>
443             depending on the query orientation. The numerical value returned by this
444             method is guaranteed to be lower than the value returned by C<query_end>.
445              
446             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
447             my ($query_start, $query_end) = ($hsp->query_start, $hsp->query_end);
448             if ($query_start < $query_end) { # always true
449             ...
450             }
451              
452             This method does not accept any arguments.
453              
454             =head2 query_end
455              
456             Returns the end coordinate of the query. This value is taken either from the
457             element C<<Hsp_query-to>> or from the element C<<Hsp_query-from>> depending
458             on the query orientation. The numerical value returned by this method is
459             guaranteed to be greater than the value returned by C<query_start>.
460              
461             # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
462             my ($query_start, $query_end) = ($hsp->query_start, $hsp->query_end);
463             if ($query_start < $query_end) { # always true
464             ...
465             }
466              
467             This method does not accept any arguments.
468              
469             =head1 ALIASES
470              
471             =head2 expect
472              
473             Alias for C<evalue> method. For API consistency.
474              
475             =head1 AUTHOR
476              
477             Denis BAURAIN <denis.baurain@uliege.be>
478              
479             =head1 COPYRIGHT AND LICENSE
480              
481             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
482              
483             This is free software; you can redistribute it and/or modify it under
484             the same terms as the Perl 5 programming language system itself.
485              
486             =cut