Coordinate/Result.pm

filter: Statementstmt 91.0% 61 / 67 Branchbran 73.0% 19 / 26 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 12 / 12 Podpod 100% 8 / 8 totaltotal 83.7% 103 / 123 CC 19 SCAR 12.8
CC
19
Cov
84%
gap
5.6
add_sub_Location
5.4
match
4.9
CRAP 3.6
« Coordinate/ExtrapolatingPair.pm ↑ Summary Coordinate/Chain.pm »
1 package Bio::Coordinate::Result;
2 10 our $AUTHORITY = 'cpan:BIOPERLML';
3 10 $Bio::Coordinate::Result::VERSION = '1.007001';
4 10 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use parent qw(Bio::Location::Split Bio::Coordinate::ResultI);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # ABSTRACT: Results from coordinate transformation.
10 # AUTHOR: Heikki Lehvaslaiho <heikki@bioperl.org>
11 # OWNER: Heikki Lehvaslaiho
12 # LICENSE: Perl_5
13  
14  
15  
16 200 ▶sub add_sub_Location {
Subroutine add_sub_Location: called CC=5 SCAR=16.8
Pod documented
17 200 my ($self,$value) = @_;
18 200 ▶ if( ! $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 200 200
19 0 $self->warn("provding an empty value for location\n");
20 0 return;
21 }
22 200 ▶ $self->throw("Is not a Bio::LocationI but [$value]")
Branch: 1 branch
BranchTrueFalseTotal
unless $value->isa("Bio::LocationI") 0 200 200
23 unless $value->isa('Bio::LocationI');
24  
25 200 ▶ $self->{'_match'} = $value
Branch: 1 branch
BranchTrueFalseTotal
if $value->isa("Bio::Coordinate::Result::Match") 119 81 200
26 if $value->isa('Bio::Coordinate::Result::Match');
27  
28 200 ▶ $self->{'_gap'} = $value
Branch: 1 branch
BranchTrueFalseTotal
if $value->isa("Bio::Coordinate::Result::Gap") 81 119 200
29 if $value->isa('Bio::Coordinate::Result::Gap');
30  
31 200 $self->SUPER::add_sub_Location($value);
32  
33 }
34  
35  
36 36 ▶sub add_result {
Subroutine add_result: called CC=2 SCAR=7.0
Pod documented
37 36 my ($self,$value) = @_;
38  
39 36 ▶ $self->throw("Is not a Bio::Coordinate::Result but [$value]")
Branch: 1 branch
BranchTrueFalseTotal
unless $value->isa("Bio::Coordinate::Result") 0 36 36
40 unless $value->isa('Bio::Coordinate::Result');
41  
42 36 map { $self->add_sub_Location($_) } $value->each_Location;
43 }
44  
45  
46 160 ▶sub seq_id {
Subroutine seq_id: called CC=2 SCAR=6.9
Pod documented
47 160 my ($self, $seqid) = @_;
48  
49 160 my @ls = $self->each_Location;
50 160 ▶ if (@ls) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ls) { } 81 79 160
51 81 return $ls[0]->seq_id;
52 } else {
53 79 return;
54 }
55 }
56  
57  
58 35 ▶sub each_gap {
Subroutine each_gap: called CC=3 SCAR=11.0
Pod documented
59 35 my ($self) = @_;
60  
61 35 my @gaps;
62 35 foreach my $gap ($self->each_Location) {
63 56 ▶ push @gaps, $gap if $gap->isa('Bio::Coordinate::Result::Gap');
Branch: 1 branch
BranchTrueFalseTotal
if $gap->isa("Bio::Coordinate::Result::Gap") 36 20 56
64 }
65 35 return @gaps;
66  
67 }
68  
69  
70 131 ▶sub each_match {
Subroutine each_match: called CC=3 SCAR=11.0
Pod documented
71 131 my ($self) = @_;
72  
73 131 my @matches;
74 131 foreach my $match ($self->each_Location) {
75 257 ▶ push @matches, $match if $match->isa('Bio::Coordinate::Result::Match');
Branch: 1 branch
BranchTrueFalseTotal
if $match->isa("Bio::Coordinate::Result::Match") 165 92 257
76 }
77 131 return @matches;
78 }
79  
80  
81 104 ▶sub match {
Subroutine match: called CC=4 SCAR=15.9
Pod documented
82 104 my ($self) = @_;
83  
84 104 ▶ $self->warn("More than one match in results")
Branch: 1 branch
BranchTrueFalseTotal
if $self->each_match > 1 and $self->verbose > 0 0 104 104
Condition66%2/3
$self->each_match > 1 and $self->verbose > 0
!ll&&!rl&&r
86180
MC/DC0%0/2
$self->each_match > 1 and $self->verbose > 0
$self->each_match > 1 $self->verbose > 0
Truth table66%2/3
A and B
A= $self->each_match > 1B= $self->verbose > 0
ABresult
0X0
100
111
85 if $self->each_match > 1 and $self->verbose > 0;
86 104 ▶ unless (defined $self->{'_match'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_match"}) 0 104 104
87 0 my @m = $self->each_match;
88 0 $self->{'_match'} = $m[-1];
89 }
90 104 return $self->{'_match'};
91 }
92  
93  
94 24 ▶sub gap {
Subroutine gap: called CC=4 SCAR=17.2
Pod documented
95 24 my ($self) = @_;
96  
97 24 ▶ $self->warn("More than one gap in results")
Branch: 1 branch
BranchTrueFalseTotal
if $self->each_gap > 1 and $self->verbose > 0 0 24 24
Condition33%1/3
$self->each_gap > 1 and $self->verbose > 0
!ll&&!rl&&r
2400
MC/DC0%0/2
$self->each_gap > 1 and $self->verbose > 0
$self->each_gap > 1 $self->verbose > 0
Truth table33%1/3
A and B
A= $self->each_gap > 1B= $self->verbose > 0
ABresult
0X0
100
111
98 if $self->each_gap > 1 and $self->verbose > 0;
99 24 ▶ unless (defined $self->{'_gap'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_gap"}) 0 24 24
100 0 my @m = $self->each_gap;
101 0 $self->{'_gap'} = $m[-1];
102 }
103 24 return $self->{'_gap'};
104 }
105  
106  
107 16 ▶sub purge_gaps {
Subroutine purge_gaps: called CC=3 SCAR=11.0
Pod documented
108 16 my ($self) = @_;
109 16 my @matches;
110 16 my $count = 0;
111  
112 16 foreach my $loc ($self->each_Location) {
113 46 ▶ if ($loc->isa('Bio::Coordinate::Result::Match')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($loc->isa('Bio::Coordinate::Result::Match')) { } 28 18 46
114 28 push @matches, $loc;
115 } else {
116 18 $count++
117 }
118 }
119 16 @{$self->{'_sublocations'}} = ();
120 16 delete $self->{'_gap'} ;
121 16 push @{$self->{'_sublocations'}}, @matches;
122 16 return $count;
123 }
124  
125 10 1;
126  
127 __END__
« Coordinate/ExtrapolatingPair.pm ↑ Summary Coordinate/Chain.pm »