FastParsers/Blast/Xml/Hsp.pm

filter: Statementstmt 83.0% 54 / 65 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 73.1% 30 / 41 Podpod 100% 37 / 37 totaltotal 83.2% 129 / 155 CC 7 SCAR 4.1
CC
7
Cov
81%
hit_strand
2.1
query_strand
2.1
query_start
2.1
CRAP 1.5
« FastParsers/Blast/Xml/Iteration.pm ↑ Summary FastParsers/Blast/Xml/BlastOutput.pm »
1 package Bio::FastParsers::Blast::Xml::Hsp;
2 # ABSTRACT: NCBI BLAST DTD-derived internal class
3 7 $Bio::FastParsers::Blast::Xml::Hsp::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  
12  
13 # private attributes
14  
15 7 has '_root' => (
16 is => 'ro',
17 isa => 'HashRef',
18 required => 1,
19 );
20  
21 7 has '_parent' => (
22 is => 'ro',
23 isa => 'Maybe[Object]',
24 required => 1,
25 );
26  
27  
28 # public array(s) of composed objects
29  
30  
31 # public composed object(s)
32  
33  
34 # public methods
35  
36  
37 sub align_len {
38 2 ▶ return shift->_root->{'Hsp_align-len'}->{'value'}
Subroutine align_len: called CC=1 SCAR=0.0
Pod documented
39 }
40  
41  
42 sub bit_score {
43 0 ▶ return shift->_root->{'Hsp_bit-score'}->{'value'}
Subroutine bit_score: not called CC=1 SCAR=6.9
Pod documented
44 }
45  
46  
47 sub density {
48 0 ▶ return shift->_root->{'Hsp_density'}->{'value'}
Subroutine density: not called CC=1 SCAR=6.9
Pod documented
49 }
50  
51  
52 sub evalue {
53 0 ▶ return shift->_root->{'Hsp_evalue'}->{'value'}
Subroutine evalue: not called CC=1 SCAR=6.9
Pod documented
54 }
55  
56  
57 sub gaps {
58 0 ▶ return shift->_root->{'Hsp_gaps'}->{'value'}
Subroutine gaps: not called CC=1 SCAR=6.9
Pod documented
59 }
60  
61  
62 sub hit_frame {
63 2 ▶ return shift->_root->{'Hsp_hit-frame'}->{'value'}
Subroutine hit_frame: called CC=1 SCAR=0.0
Pod documented
64 }
65  
66  
67 sub hit_from {
68 2424 ▶ return shift->_root->{'Hsp_hit-from'}->{'value'}
Subroutine hit_from: called CC=1 SCAR=0.0
Pod documented
69 }
70  
71  
72 sub hit_to {
73 1861 ▶ return shift->_root->{'Hsp_hit-to'}->{'value'}
Subroutine hit_to: called CC=1 SCAR=0.0
Pod documented
74 }
75  
76  
77 sub hseq {
78 0 ▶ return shift->_root->{'Hsp_hseq'}->{'value'}
Subroutine hseq: not called CC=1 SCAR=6.9
Pod documented
79 }
80  
81  
82 sub identity {
83 56 ▶ return shift->_root->{'Hsp_identity'}->{'value'}
Subroutine identity: called CC=1 SCAR=0.0
Pod documented
84 }
85  
86  
87 sub midline {
88 40 ▶ return shift->_root->{'Hsp_midline'}->{'value'}
Subroutine midline: called CC=1 SCAR=0.0
Pod documented
89 }
90  
91  
92 sub num {
93 203 ▶ return shift->_root->{'Hsp_num'}->{'value'}
Subroutine num: called CC=1 SCAR=0.0
Pod documented
94 }
95  
96  
97 sub pattern_from {
98 0 ▶ return shift->_root->{'Hsp_pattern-from'}->{'value'}
Subroutine pattern_from: not called CC=1 SCAR=6.9
Pod documented
99 }
100  
101  
102 sub pattern_to {
103 0 ▶ return shift->_root->{'Hsp_pattern-to'}->{'value'}
Subroutine pattern_to: not called CC=1 SCAR=6.9
Pod documented
104 }
105  
106  
107 sub positive {
108 564 ▶ return shift->_root->{'Hsp_positive'}->{'value'}
Subroutine positive: called CC=1 SCAR=0.0
Pod documented
109 }
110  
111  
112 sub qseq {
113 0 ▶ return shift->_root->{'Hsp_qseq'}->{'value'}
Subroutine qseq: not called CC=1 SCAR=6.9
Pod documented
114 }
115  
116  
117 sub query_frame {
118 2 ▶ return shift->_root->{'Hsp_query-frame'}->{'value'}
Subroutine query_frame: called CC=1 SCAR=0.0
Pod documented
119 }
120  
121  
122 sub query_from {
123 1861 ▶ return shift->_root->{'Hsp_query-from'}->{'value'}
Subroutine query_from: called CC=1 SCAR=0.0
Pod documented
124 }
125  
126  
127 sub query_to {
128 1861 ▶ return shift->_root->{'Hsp_query-to'}->{'value'}
Subroutine query_to: called CC=1 SCAR=0.0
Pod documented
129 }
130  
131  
132 sub score {
133 258 ▶ return shift->_root->{'Hsp_score'}->{'value'}
Subroutine score: called CC=1 SCAR=0.0
Pod documented
134 }
135  
136  
137 # public aliases
138  
139  
140 sub expect {
141 return shift->evalue
142 0 ▶}
Subroutine expect: not called CC=1 SCAR=6.9
Pod documented
143  
144  
145 sub qcov {
146 return shift->query_coverage
147 1 ▶}
Subroutine qcov: called CC=1 SCAR=0.0
Pod documented
148  
149  
150 sub scov {
151 return shift->subject_coverage
152 0 ▶}
Subroutine scov: not called CC=1 SCAR=6.9
Pod documented
153  
154  
155 sub pident {
156 return shift->percentage_identity
157 1 ▶}
Subroutine pident: called CC=1 SCAR=0.0
Pod documented
158  
159  
160 sub ppos {
161 return shift->percentage_positive
162 0 ▶}
Subroutine ppos: not called CC=1 SCAR=6.9
Pod documented
163  
164  
165  
166 sub query_len {
167 return shift->_parent->query_len
168 2 ▶}
Subroutine query_len: called CC=1 SCAR=0.0
Pod documented
169  
170  
171  
172 sub hit_len {
173 return shift->_parent->len
174 2 ▶}
Subroutine hit_len: called CC=1 SCAR=0.0
Pod documented
175  
176  
177 # pseudo-aliases
178  
179 7 ▶use Const::Fast;
Subroutine BEGIN: called CC=1 SCAR=0.0
180 7 const my $NEGFRAME => qr{\A -}xms;
181  
182  
183 sub hit_strand {
184 1 ▶ my $self = shift;
Subroutine hit_strand: called CC=2 SCAR=7.2
Pod documented
185 1 ▶ return $self->hit_frame =~ $NEGFRAME ? -1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->hit_frame =~ /$NEGFRAME/ ? : 1 0 1
186 }
187  
188  
189 sub hit_start {
190 620 ▶ my $self = shift;
Subroutine hit_start: called CC=2 SCAR=6.9
Pod documented
191 620 ▶ return $self->hit_from < $self->hit_to ? $self->hit_from
Branch: 1 branch
BranchTrueFalseTotal
$self->hit_from < $self->hit_to ? : 618 2 620
192 : $self->hit_to;
193 }
194  
195  
196 sub hit_end {
197 620 ▶ my $self = shift;
Subroutine hit_end: called CC=2 SCAR=6.9
Pod documented
198 620 ▶ return $self->hit_to > $self->hit_from ? $self->hit_to
Branch: 1 branch
BranchTrueFalseTotal
$self->hit_to > $self->hit_from ? : 618 2 620
199 : $self->hit_from;
200 }
201  
202  
203 sub query_strand {
204 1 ▶ my $self = shift;
Subroutine query_strand: called CC=2 SCAR=7.2
Pod documented
205 1 ▶ return $self->query_frame =~ $NEGFRAME ? -1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->query_frame =~ /$NEGFRAME/ ? : 0 1 1
206 }
207  
208  
209 sub query_start {
210 620 ▶ my $self = shift;
Subroutine query_start: called CC=2 SCAR=7.2
Pod documented
211 620 ▶ return $self->query_from < $self->query_to ? $self->query_from
Branch: 1 branch
BranchTrueFalseTotal
$self->query_from < $self->query_to ? : 620 0 620
212 : $self->query_to;
213 }
214  
215  
216 sub query_end {
217 620 ▶ my $self = shift;
Subroutine query_end: called CC=2 SCAR=7.2
Pod documented
218 620 ▶ return $self->query_to > $self->query_from ? $self->query_to
Branch: 1 branch
BranchTrueFalseTotal
$self->query_to > $self->query_from ? : 620 0 620
219 : $self->query_from;
220 }
221  
222  
223 sub query_coverage {
224 1 ▶ my $self = shift;
Subroutine query_coverage: called CC=1 SCAR=0.0
Pod documented
225 1 return sprintf("%.1f",
226 100 * ( $self->query_end - $self->query_start + 1 ) / $self->query_len
227 );
228 }
229  
230  
231 sub subject_coverage {
232 1 ▶ my $self = shift;
Subroutine subject_coverage: called CC=1 SCAR=0.0
Pod documented
233 1 return sprintf("%.1f",
234 100 * ( $self->hit_end - $self->hit_start + 1 ) / $self->hit_len
235 );
236 }
237  
238  
239 sub percentage_identity {
240 1 ▶ my $self = shift;
Subroutine percentage_identity: called CC=1 SCAR=0.0
Pod documented
241 1 return sprintf("%.1f", 100 * ( $self->identity / $self->align_len ) );
242 }
243  
244  
245 sub percentage_positive {
246 1 ▶ my $self = shift;
Subroutine percentage_positive: called CC=1 SCAR=0.0
Pod documented
247 1 return sprintf("%.1f", 100 * ( $self->positive / $self->align_len ) );
248 }
249  
250  
251 7 __PACKAGE__->meta->make_immutable;
252 7 1;
253  
254 __END__
255  
256 =pod
257  
258 =head1 NAME
259  
260 Bio::FastParsers::Blast::Xml::Hsp - NCBI BLAST DTD-derived internal class
261  
262 =head1 VERSION
263  
264 version 0.213510
265  
266 =head1 SYNOPSIS
267  
268 # see Bio::FastParsers::Blast::Xml
269  
270 =head1 DESCRIPTION
271  
272 This class implements the C<Hsp> level of the XML BLAST parser.
273  
274 =head1 METHODS
275  
276 =head2 align_len
277  
278 Returns the value of the element C<<Hsp_align-len>>.
279  
280 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
281 my $align_len = $hsp->align_len;
282  
283 This method does not accept any arguments.
284  
285 =head2 bit_score
286  
287 Returns the value of the element C<<Hsp_bit-score>>.
288  
289 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
290 my $bit_score = $hsp->bit_score;
291  
292 This method does not accept any arguments.
293  
294 =head2 density
295  
296 Returns the value of the element C<<Hsp_density>>.
297  
298 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
299 my $density = $hsp->density;
300  
301 This method does not accept any arguments.
302  
303 =head2 evalue
304  
305 Returns the value of the element C<<Hsp_evalue>>.
306  
307 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
308 my $evalue = $hsp->evalue;
309  
310 This method does not accept any arguments.
311  
312 =head2 gaps
313  
314 Returns the value of the element C<<Hsp_gaps>>.
315  
316 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
317 my $gaps = $hsp->gaps;
318  
319 This method does not accept any arguments.
320  
321 =head2 hit_frame
322  
323 Returns the value of the element C<<Hsp_hit-frame>>.
324  
325 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
326 my $hit_frame = $hsp->hit_frame;
327  
328 This method does not accept any arguments.
329  
330 =head2 hit_from
331  
332 Returns the value of the element C<<Hsp_hit-from>>.
333  
334 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
335 my $hit_from = $hsp->hit_from;
336  
337 This method does not accept any arguments.
338  
339 =head2 hit_to
340  
341 Returns the value of the element C<<Hsp_hit-to>>.
342  
343 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
344 my $hit_to = $hsp->hit_to;
345  
346 This method does not accept any arguments.
347  
348 =head2 hseq
349  
350 Returns the value of the element C<<Hsp_hseq>>.
351  
352 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
353 my $hseq = $hsp->hseq;
354  
355 This method does not accept any arguments.
356  
357 =head2 identity
358  
359 Returns the value of the element C<<Hsp_identity>>.
360  
361 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
362 my $identity = $hsp->identity;
363  
364 This method does not accept any arguments.
365  
366 =head2 midline
367  
368 Returns the value of the element C<<Hsp_midline>>.
369  
370 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
371 my $midline = $hsp->midline;
372  
373 This method does not accept any arguments.
374  
375 =head2 num
376  
377 Returns the value of the element C<<Hsp_num>>.
378  
379 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
380 my $num = $hsp->num;
381  
382 This method does not accept any arguments.
383  
384 =head2 pattern_from
385  
386 Returns the value of the element C<<Hsp_pattern-from>>.
387  
388 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
389 my $pattern_from = $hsp->pattern_from;
390  
391 This method does not accept any arguments.
392  
393 =head2 pattern_to
394  
395 Returns the value of the element C<<Hsp_pattern-to>>.
396  
397 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
398 my $pattern_to = $hsp->pattern_to;
399  
400 This method does not accept any arguments.
401  
402 =head2 positive
403  
404 Returns the value of the element C<<Hsp_positive>>.
405  
406 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
407 my $positive = $hsp->positive;
408  
409 This method does not accept any arguments.
410  
411 =head2 qseq
412  
413 Returns the value of the element C<<Hsp_qseq>>.
414  
415 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
416 my $qseq = $hsp->qseq;
417  
418 This method does not accept any arguments.
419  
420 =head2 query_frame
421  
422 Returns the value of the element C<<Hsp_query-frame>>.
423  
424 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
425 my $query_frame = $hsp->query_frame;
426  
427 This method does not accept any arguments.
428  
429 =head2 query_from
430  
431 Returns the value of the element C<<Hsp_query-from>>.
432  
433 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
434 my $query_from = $hsp->query_from;
435  
436 This method does not accept any arguments.
437  
438 =head2 query_to
439  
440 Returns the value of the element C<<Hsp_query-to>>.
441  
442 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
443 my $query_to = $hsp->query_to;
444  
445 This method does not accept any arguments.
446  
447 =head2 score
448  
449 Returns the value of the element C<<Hsp_score>>.
450  
451 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
452 my $score = $hsp->score;
453  
454 This method does not accept any arguments.
455  
456 =head2 hit_strand
457  
458 Returns the strand of the hit. The strand can be either 1 or -1 depending on
459 the sign of the element C<<Hsp_hit-frame>>.
460  
461 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
462 my $hit_strand = $hsp->hit_strand;
463  
464 This method does not accept any arguments.
465  
466 =head2 hit_start
467  
468 Returns the start coordinate of the hit. This value is taken either from the
469 element C<<Hsp_hit-from>> or from the element C<<Hsp_hit-to>> depending on
470 the hit orientation. The numerical value returned by this method is
471 guaranteed to be lower than the value returned by C<hit_end>.
472  
473 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
474 my ($hit_start, $hit_end) = ($hsp->hit_start, $hsp->hit_end);
475 if ($hit_start < $hit_end) { # always true
476 ...
477 }
478  
479 This method does not accept any arguments.
480  
481 =head2 hit_end
482  
483 Returns the end coordinate of the hit. This value is taken either from the
484 element C<<Hsp_hit-to>> or from the element C<<Hsp_hit-from>> depending on
485 the hit orientation. The numerical value returned by this method is
486 guaranteed to be greater than the value returned by C<hit_start>.
487  
488 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
489 my ($hit_start, $hit_end) = ($hsp->hit_start, $hsp->hit_end);
490 if ($hit_start < $hit_end) { # always true
491 ...
492 }
493  
494 This method does not accept any arguments.
495  
496 =head2 query_strand
497  
498 Returns the strand of the query. The strand can be either 1 or -1 depending
499 on the sign of the element C<<Hsp_query-frame>>.
500  
501 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
502 my $query_strand = $hsp->query_strand;
503  
504 This method does not accept any arguments.
505  
506 =head2 query_start
507  
508 Returns the start coordinate of the query. This value is taken either from
509 the element C<<Hsp_query-from>> or from the element C<<Hsp_query-to>>
510 depending on the query orientation. The numerical value returned by this
511 method is guaranteed to be lower than the value returned by C<query_end>.
512  
513 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
514 my ($query_start, $query_end) = ($hsp->query_start, $hsp->query_end);
515 if ($query_start < $query_end) { # always true
516 ...
517 }
518  
519 This method does not accept any arguments.
520  
521 =head2 query_end
522  
523 Returns the end coordinate of the query. This value is taken either from the
524 element C<<Hsp_query-to>> or from the element C<<Hsp_query-from>> depending
525 on the query orientation. The numerical value returned by this method is
526 guaranteed to be greater than the value returned by C<query_start>.
527  
528 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
529 my ($query_start, $query_end) = ($hsp->query_start, $hsp->query_end);
530 if ($query_start < $query_end) { # always true
531 ...
532 }
533  
534 This method does not accept any arguments.
535  
536 =head2 query_coverage
537  
538 Returns the query coverage of the HSP.
539  
540 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
541 my $query_coverage = $hsp->query_coverage;
542  
543 This method does not accept any arguments.
544  
545 =head2 subject_coverage
546  
547 Returns the subject (hit) coverage of the HSP.
548  
549 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
550 my $subject_coverage = $hsp->subject_coverage;
551  
552 This method does not accept any arguments.
553  
554 =head2 percentage_identity
555  
556 Returns the percentage of identity of the HSP.
557  
558 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
559 my $percentage_identity = $hsp->percentage_identity;
560  
561 This method does not accept any arguments.
562  
563 =head2 percentage_positive
564  
565 Returns the percentage of positive matches of the HSP.
566  
567 # $hsp is a Bio::FastParsers::Blast::Xml::Hsp
568 my $percentage_positive = $hsp->percentage_positive;
569  
570 This method does not accept any arguments.
571  
572 =head1 ALIASES
573  
574 =head2 expect
575  
576 Alias for C<evalue> method. For API consistency.
577  
578 =head2 qcov
579  
580 Alias for C<query_coverage> method. For API consistency.
581  
582 =head2 scov
583  
584 Alias for C<subject_coverage> method. For API consistency.
585  
586 =head2 pident
587  
588 Alias for C<percentage_identity> method. For API consistency.
589  
590 =head2 ppos
591  
592 Alias for C<percentage_positive> method. For API consistency.
593  
594 =head2 query_len
595  
596 Alias for C<query_len> method in Hit object. For API completeness.
597  
598 =head2 hit_len
599  
600 Alias for C<len> method in Hit object. For API completeness.
601  
602 =head1 AUTHOR
603  
604 Denis BAURAIN <denis.baurain@uliege.be>
605  
606 =head1 COPYRIGHT AND LICENSE
607  
608 This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
609  
610 This is free software; you can redistribute it and/or modify it under
611 the same terms as the Perl 5 programming language system itself.
612  
613 =cut
« FastParsers/Blast/Xml/Iteration.pm ↑ Summary FastParsers/Blast/Xml/BlastOutput.pm »