GenOO/Data/File/SAM/Cigar.pm

filter: Statementstmt 90.9% 130 / 143 Branchbran 88.8% 64 / 72 Conditioncond 61.3% 46 / 75 MC/DCmcdc 40.0% 14 / 35 Subroutinesub 95.4% 21 / 22 Podpod 0.0% 0 / 19 totaltotal 75.1% 275 / 366 CC 62 SCAR 28.0
CC
62
Cov
83%
aligned_areas_starts_and_stops
90.0
mid_position
12.2
deletion_positions_on_reference
9.1
CRAP 16.4
« GenOO/RegionCollection/Factory/DBIC.pm ↑ Summary GenOO/Helper/MyMath.pm »
1 # POD documentation - main docs before the code
2  
3 =head1 NAME
4  
5 GenOO::Data::File::SAM::Cigar - Role that corresponds to the SAM file CIGAR string
6  
7 =head1 SYNOPSIS
8  
9 This role when consumed requires specific attributes and provides
10 methods to extract information from the CIGAR string as defined in
11 the SAM format specifications.
12  
13 =head1 DESCRIPTION
14  
15 The cigar string describes the alignment of a query on a reference sequence.
16 This role offers methods that can extract information from the CIGAR string
17 directly such as the positions on insertions, the total number of deletions, etc
18
19 The CIGAR operations are given in the following table (set `*' if unavailable):
20 Op BAM Description
21 M 0 alignment match (can be a sequence match or mismatch)
22 I 1 insertion to the reference
23 D 2 deletion from the reference
24 N 3 skipped region from the reference
25 S 4 soft clipping (clipped sequences present in SEQ)
26 H 5 hard clipping (clipped sequences NOT present in SEQ)
27 P 6 padding (silent deletion from padded reference)
28 = 7 sequence match
29 X 8 sequence mismatch
30
31 * H can only be present as the first and/or last operation.
32 * S may only have H operations between them and the ends of the CIGAR string.
33 * For mRNA-to-genome alignment, an N operation represents an intron. For other types of
34 alignments, the interpretation of N is not defined.
35 * Sum of lengths of the M/I/S/=/X operations shall equal the length of SEQ.
36  
37 =head1 EXAMPLES
38  
39 # Get the location information on the reference sequence
40 $obj_with_role->deletion_positions_on_query; # (10, 19, ...)
41 $obj_with_role->insertion_count; # 3
42 $obj_with_role->deletion_positions_on_reference; # (43534511, 43534522, ...)
43  
44 =cut
45  
46 # Let the code begin...
47  
48 package GenOO::Data::File::SAM::Cigar;
49 1 $GenOO::Data::File::SAM::Cigar::VERSION = '1.4.9';
50  
51 #######################################################################
52 ####################### Load External modules #####################
53 #######################################################################
54 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
55 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
56  
57  
58 #######################################################################
59 ######################## Required attributes ######################
60 #######################################################################
61 1 requires qw(cigar strand start);
62  
63  
64 #######################################################################
65 ######################## Interface Methods ########################
66 #######################################################################
67 sub M_count {
68 14 ▶ my ($self) = @_;
Subroutine M_count: called CC=1 SCAR=0.0
Pod undocumented
69
70 14 return $self->_total_operator_count('M');
71 }
72  
73 sub I_count {
74 7 ▶ my ($self) = @_;
Subroutine I_count: called CC=1 SCAR=0.0
Pod undocumented
75
76 7 return $self->_total_operator_count('I');
77 }
78  
79 sub D_count {
80 20 ▶ my ($self) = @_;
Subroutine D_count: called CC=1 SCAR=0.0
Pod undocumented
81
82 20 return $self->_total_operator_count('D');
83 }
84  
85 sub N_count {
86 14 ▶ my ($self) = @_;
Subroutine N_count: called CC=1 SCAR=0.0
Pod undocumented
87
88 14 return $self->_total_operator_count('N');
89 }
90  
91 sub S_count {
92 9 ▶ my ($self) = @_;
Subroutine S_count: called CC=1 SCAR=0.0
Pod undocumented
93
94 9 return $self->_total_operator_count('S');
95 }
96  
97 sub H_count {
98 1 ▶ my ($self) = @_;
Subroutine H_count: called CC=1 SCAR=0.0
Pod undocumented
99
100 1 return $self->_total_operator_count('H');
101 }
102  
103 sub P_count {
104 13 ▶ my ($self) = @_;
Subroutine P_count: called CC=1 SCAR=0.0
Pod undocumented
105
106 13 return $self->_total_operator_count('P');
107 }
108  
109 sub EQ_count {
110 14 ▶ my ($self) = @_;
Subroutine EQ_count: called CC=1 SCAR=0.0
Pod undocumented
111
112 14 return $self->_total_operator_count('=');
113 }
114  
115 sub X_count {
116 14 ▶ my ($self) = @_;
Subroutine X_count: called CC=1 SCAR=0.0
Pod undocumented
117
118 14 return $self->_total_operator_count('X');
119 }
120  
121 sub insertion_count {
122 6 ▶ my ($self) = @_;
Subroutine insertion_count: called CC=1 SCAR=0.0
Pod undocumented
123
124 6 return $self->I_count;
125 }
126  
127 sub deletion_count {
128 6 ▶ my ($self) = @_;
Subroutine deletion_count: called CC=1 SCAR=0.0
Pod undocumented
129
130 6 return $self->D_count;
131 }
132  
133 sub deletion_positions_on_query {
134 6 ▶ my ($self) = @_;
Subroutine deletion_positions_on_query: called CC=7 SCAR=19.5
Pod undocumented
135 #Tag: AGTGATGGGA------GGATGTCTCGTCTGTGAGTTACAGCA -> CIGAR: 2M1I7M6D26M
136 # - -
137 #Genome: AG-GCTGGTAGCTCAGGGATGTCTCGTCTGTGAGTTACAGCA -> MD:Z: 3C3T1^GCTCAG26
138
139 6 my @deletion_positions;
140 6 ▶ if ($self->cigar =~ /D/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cigar =~ /D/) 5 1 6
141 5 my $cigar = $self->cigar_relative_to_query;
142
143 5 my $relative_position = 0;
144 5 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 44 5 49
145 44 my $count = $1;
146 44 my $identifier = $2;
147
148 44 ▶ if ($identifier eq 'D') {
Branch: 2 branches
BranchTrueFalseTotal
if ($identifier eq 'D') { } 7 37 44
elsif ($identifier ne 'N' and $identifier ne 'P' and $identifier ne 'H') { } 35 4 39
149 7 push @deletion_positions, $relative_position - 1;
150 }
151 ▶ elsif ($identifier ne 'N' and $identifier ne 'P' and $identifier ne 'H') {
Condition66%4/6
$identifier ne "N" and $identifier ne "P" and $identifier ne "H"
!ll&&!rl&&r
2035
$identifier ne "N" and $identifier ne "P"
!ll&&!rl&&r
2035
MC/DC33%1/3
$identifier ne "N" and $identifier ne "P" and $identifier ne "H"
$identifier ne "N" $identifier ne "P" $identifier ne "H"
Truth table50%2/4
A and B and C
A= $identifier ne "N"B= $identifier ne "P"C= $identifier ne "H"
ABCresult
0XX0
10X0
1100
1111
152 35 $relative_position += $count;
153 }
154 }
155 }
156
157 6 return @deletion_positions;
158 }
159  
160 sub mid_position {
161 8 ▶ my ($self) = @_;
Subroutine mid_position: called CC=12 SCAR=25.0
Pod undocumented
162 # Read: AGTGAT____GGA---GTGACTCA-C -> CIGAR: 2M1I3M4N3M3D1M1I3M1I2M1D1M / 2=1I1=1X1=4N1=1X1=3D1=1I2=1X1I2=1D1=
163 # - - -
164 # Genome: AG-GCTNNNNGTAGAGG-GAG-CAGC -> MD:Z: 3C1^NNNN1T1^GAG3G2^G1
165
166 8 my $mid_position = $self->start - 1;
167 8 my $mid_position_on_query = ($self->query_length - $self->S_count + 1) / 2;
168 8 my $cigar = $self->cigar;
169
170 8 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 31 1 32
171 31 my ($count, $identifier) = ($1, $2);
172 31 ▶ if ($identifier eq 'D' or $identifier eq 'N' or $identifier eq 'P' or $identifier eq 'H') {
Branch: 3 branches
BranchTrueFalseTotal
if ($identifier eq 'D' or $identifier eq 'N' or $identifier eq 'P' or $identifier eq 'H') { } 6 25 31
elsif ($identifier eq 'M' or $identifier eq '=' or $identifier eq 'X') { } 21 4 25
elsif ($identifier eq 'I') { } 4 0 4
Condition77%7/9
$identifier eq "D" or $identifier eq "N" or $identifier eq "P" or $identifier eq "H"
l!l&&r!l&&!r
6025
$identifier eq "D" or $identifier eq "N" or $identifier eq "P"
l!l&&r!l&&!r
6025
$identifier eq "D" or $identifier eq "N"
l!l&&r!l&&!r
4225
MC/DC50%2/4
$identifier eq "D" or $identifier eq "N" or $identifier eq "P" or $identifier eq "H"
$identifier eq "D" $identifier eq "N" $identifier eq "P" $identifier eq "H"
Truth table60%3/5
A or B or C or D
A= $identifier eq "D"B= $identifier eq "N"C= $identifier eq "P"D= $identifier eq "H"
ABCDresult
1XXX1
01XX1
001X1
00011
00000
173 6 $mid_position += $count;
174 }
175 ▶ elsif ($identifier eq 'M' or $identifier eq '=' or $identifier eq 'X') {
Condition100%6/6
$identifier eq "M" or $identifier eq "=" or $identifier eq "X"
l!l&&r!l&&!r
1924
$identifier eq "M" or $identifier eq "="
l!l&&r!l&&!r
1366
MC/DC100%3/3
$identifier eq "M" or $identifier eq "=" or $identifier eq "X"
$identifier eq "M" $identifier eq "=" $identifier eq "X"
Truth table100%4/4
A or B or C
A= $identifier eq "M"B= $identifier eq "="C= $identifier eq "X"
ABCresult
1XX1
01X1
0011
0000
176 21 ▶ if ($mid_position_on_query < $count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mid_position_on_query < $count) 7 14 21
177 7 return $mid_position + $mid_position_on_query;
178 }
179 14 $mid_position += $count;
180 14 $mid_position_on_query -= $count;
181 }
182 elsif ($identifier eq 'I') {
183 4 ▶ if ($mid_position_on_query < $count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mid_position_on_query < $count) 0 4 4
184 0 return $mid_position + 0.5;
185 }
186 4 $mid_position_on_query -= $count;
187 }
188 }
189
190 1 return;
191 }
192  
193  
194 sub insertion_positions_on_query {
195 6 ▶ my ($self) = @_;
Subroutine insertion_positions_on_query: called CC=9 SCAR=22.0
Pod undocumented
196 #Tag: AGTGATGGGA------GGATGTCTCGTCTGTGAGTTACAGCA -> CIGAR: 2M1I7M6D26M
197 # - -
198 #Genome: AG-GCTGGTAGCTCAGGGATGTCTCGTCTGTGAGTTACAGCA -> MD:Z: 3C3T1^GCTCAG26
199
200 6 my @insertion_positions;
201 6 ▶ if ($self->cigar =~ /I/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cigar =~ /I/) 4 2 6
202 4 my $cigar = $self->cigar_relative_to_query;
203
204 4 my $relative_position = 0;
205 4 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 41 4 45
206 41 my $count = $1;
207 41 my $identifier = $2;
208
209 41 ▶ if ($identifier eq 'I') {
Branch: 2 branches
BranchTrueFalseTotal
if ($identifier eq 'I') { } 8 33 41
elsif ($identifier ne 'D' and $identifier ne 'N' and $identifier ne 'P' and $identifier ne 'H') { } 25 16 41
210 8 ▶ for (my $i=0; $i<$count; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $count) 8 8 16
211 8 push @insertion_positions, $relative_position;
212 8 $relative_position++;
213 }
214 }
215 ▶ elsif ($identifier ne 'D' and $identifier ne 'N' and $identifier ne 'P' and $identifier ne 'H') {
Condition77%7/9
$identifier ne "D" and $identifier ne "N" and $identifier ne "P" and $identifier ne "H"
!ll&&!rl&&r
8025
$identifier ne "D" and $identifier ne "N" and $identifier ne "P"
!ll&&!rl&&r
8025
$identifier ne "D" and $identifier ne "N"
!ll&&!rl&&r
6225
MC/DC50%2/4
$identifier ne "D" and $identifier ne "N" and $identifier ne "P" and $identifier ne "H"
$identifier ne "D" $identifier ne "N" $identifier ne "P" $identifier ne "H"
Truth table60%3/5
A and B and C and D
A= $identifier ne "D"B= $identifier ne "N"C= $identifier ne "P"D= $identifier ne "H"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
216 25 $relative_position += $count;
217 }
218 }
219 }
220
221 6 return @insertion_positions;
222 }
223  
224 sub mismatch_positions_on_query {
225 7 ▶ my ($self) = @_;
Subroutine mismatch_positions_on_query: called CC=9 SCAR=22.0
Pod undocumented
226 #Tag: AGTGATGGGA------GGATGTCTCGTCTGTGAGTTACAGCA -> CIGAR: 2M1I7M6D26M
227 # - -
228 #Genome: AG-GCTGGTAGCTCAGGGATGTCTCGTCTGTGAGTTACAGCA -> MD:Z: 3C3T1^GCTCAG26
229
230 7 ▶ if ($self->cigar =~ /X/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cigar =~ /X/) { } 1 6 7
231 1 my @mismatch_positions;
232 1 my $cigar = $self->cigar_relative_to_query;
233
234 1 my $relative_position = 0;
235 1 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 18 1 19
236 18 my $count = $1;
237 18 my $identifier = $2;
238
239 18 ▶ if ($identifier eq 'X') {
Branch: 2 branches
BranchTrueFalseTotal
if ($identifier eq 'X') { } 3 15 18
elsif ($identifier ne 'D' and $identifier ne 'N' and $identifier ne 'P' and $identifier ne 'H') { } 12 6 18
240 3 ▶ for (my $i=0; $i<$count; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $count) 3 3 6
241 3 push @mismatch_positions, $relative_position;
242 3 $relative_position++;
243 }
244 }
245 ▶ elsif ($identifier ne 'D' and $identifier ne 'N' and $identifier ne 'P' and $identifier ne 'H') {
Condition77%7/9
$identifier ne "D" and $identifier ne "N" and $identifier ne "P" and $identifier ne "H"
!ll&&!rl&&r
3012
$identifier ne "D" and $identifier ne "N" and $identifier ne "P"
!ll&&!rl&&r
3012
$identifier ne "D" and $identifier ne "N"
!ll&&!rl&&r
2112
MC/DC50%2/4
$identifier ne "D" and $identifier ne "N" and $identifier ne "P" and $identifier ne "H"
$identifier ne "D" $identifier ne "N" $identifier ne "P" $identifier ne "H"
Truth table60%3/5
A and B and C and D
A= $identifier ne "D"B= $identifier ne "N"C= $identifier ne "P"D= $identifier ne "H"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
246 12 $relative_position += $count;
247 }
248 }
249 1 return @mismatch_positions;
250 }
251 else {
252 6 return $self->mismatch_positions_on_query_calculated_from_mdz();
253 }
254 }
255  
256 sub deletion_positions_on_reference {
257 6 ▶ my ($self) = @_;
Subroutine deletion_positions_on_reference: called CC=9 SCAR=22.0
Pod undocumented
258 #Tag: AGTGATGGGA------GGATGTCTCGTCTGTGAGTTACAGCA -> CIGAR: 2M1I7M6D26M
259 # - -
260 #Genome: AG-GCTGGTAGCTCAGGGATGTCTCGTCTGTGAGTTACAGCA -> MD:Z: 3C3T1^GCTCAG26
261
262 6 my @deletion_positions;
263 6 ▶ if ($self->cigar =~ /D/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cigar =~ /D/) 5 1 6
264 5 my $cigar = $self->cigar;
265
266 5 my $relative_position = 0;
267 5 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 44 5 49
268 44 my $count = $1;
269 44 my $identifier = $2;
270
271 44 ▶ if ($identifier eq 'D') {
Branch: 2 branches
BranchTrueFalseTotal
if ($identifier eq 'D') { } 7 37 44
elsif ($identifier ne 'I' and $identifier ne 'P' and $identifier ne 'S' and $identifier ne 'H') { } 29 16 45
272 7 ▶ for (my $i=0; $i<$count; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $count) 13 7 20
273 13 push @deletion_positions, $self->start + $relative_position;
274 13 $relative_position++;
275 }
276 }
277 ▶ elsif ($identifier ne 'I' and $identifier ne 'P' and $identifier ne 'S' and $identifier ne 'H') {
Condition66%6/9
$identifier ne "I" and $identifier ne "P" and $identifier ne "S" and $identifier ne "H"
!ll&&!rl&&r
8029
$identifier ne "I" and $identifier ne "P" and $identifier ne "S"
!ll&&!rl&&r
8029
$identifier ne "I" and $identifier ne "P"
!ll&&!rl&&r
8029
MC/DC25%1/4
$identifier ne "I" and $identifier ne "P" and $identifier ne "S" and $identifier ne "H"
$identifier ne "I" $identifier ne "P" $identifier ne "S" $identifier ne "H"
Truth table40%2/5
A and B and C and D
A= $identifier ne "I"B= $identifier ne "P"C= $identifier ne "S"D= $identifier ne "H"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
278 29 $relative_position += $count;
279 }
280 }
281 }
282
283 6 return @deletion_positions;
284 }
285  
286 sub mismatch_positions_on_reference {
287 20 ▶ my ($self) = @_;
Subroutine mismatch_positions_on_reference: called CC=9 SCAR=22.0
Pod undocumented
288 #Tag: AGTGATGGGA------GGATGTCTCGTCTGTGAGTTACAGCA -> CIGAR: 2M1I7M6D26M
289 # - -
290 #Genome: AG-GCTGGTAGCTCAGGGATGTCTCGTCTGTGAGTTACAGCA -> MD:Z: 3C3T1^GCTCAG26
291
292 20 ▶ if ($self->cigar =~ /X/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cigar =~ /X/) { } 2 18 20
293 2 my @mismatch_positions;
294 2 my $cigar = $self->cigar;
295
296 2 my $relative_position = 0;
297 2 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 36 2 38
298 36 my $count = $1;
299 36 my $identifier = $2;
300
301 36 ▶ if ($identifier eq 'X') {
Branch: 2 branches
BranchTrueFalseTotal
if ($identifier eq 'X') { } 6 30 36
elsif ($identifier ne 'I' and $identifier ne 'P' and $identifier ne 'S' and $identifier ne 'H') { } 24 12 36
302 6 ▶ for (my $i=0; $i<$count; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $count) 6 6 12
303 6 push @mismatch_positions, $self->start + $relative_position;
304 6 $relative_position++;
305 }
306 }
307 ▶ elsif ($identifier ne 'I' and $identifier ne 'P' and $identifier ne 'S' and $identifier ne 'H') {
Condition66%6/9
$identifier ne "I" and $identifier ne "P" and $identifier ne "S" and $identifier ne "H"
!ll&&!rl&&r
6024
$identifier ne "I" and $identifier ne "P" and $identifier ne "S"
!ll&&!rl&&r
6024
$identifier ne "I" and $identifier ne "P"
!ll&&!rl&&r
6024
MC/DC25%1/4
$identifier ne "I" and $identifier ne "P" and $identifier ne "S" and $identifier ne "H"
$identifier ne "I" $identifier ne "P" $identifier ne "S" $identifier ne "H"
Truth table40%2/5
A and B and C and D
A= $identifier ne "I"B= $identifier ne "P"C= $identifier ne "S"D= $identifier ne "H"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
308 24 $relative_position += $count;
309 }
310 }
311 2 return @mismatch_positions;
312 }
313 else {
314 18 return $self->mismatch_positions_on_reference_calculated_from_mdz();
315 }
316 }
317  
318 sub cigar_relative_to_query {
319 15 ▶ my ($self) = @_;
Subroutine cigar_relative_to_query: called CC=4 SCAR=13.9
Pod undocumented
320
321 15 my $cigar = $self->cigar;
322
323 # if negative strand -> reverse the cigar string
324 15 ▶ if (defined $self->strand and ($self->strand == -1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->strand and $self->strand == -1) { } 4 11 15
Condition100%3/3
defined $self->strand and $self->strand == -1
!ll&&!rl&&r
1104
MC/DC100%2/2
defined $self->strand and $self->strand == -1
defined $self->strand $self->strand == -1
Truth table100%3/3
A and B
A= defined $self->strandB= $self->strand == -1
ABresult
0X0
100
111
325 4 my $reverse_cigar = '';
326 4 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 16 4 20
327 16 $reverse_cigar = $1.$2.$reverse_cigar;
328 }
329 4 return $reverse_cigar;
330 }
331 else {
332 11 return $cigar;
333 }
334 }
335  
336 sub aligned_areas_starts_and_stops {
337 0 ▶ my ($self) = @_;
Subroutine aligned_areas_starts_and_stops: not called CC=9 SCAR=45.0
Pod undocumented
338
339 # returns the start and stop positions on the reference
340 # for all parts of the alignment that bind.
341
342 # Read: AGTGAT____GGA---GTGACTCA-C -> CIGAR: 2M1I3M4N3M3D1M1I3M1I2M1D1M / 2=1I1=1X1=4N1=1X1=3D1=1I2=1X1I2=1D1=
343 # - - -
344 # Genome: AG-GCTNNNNGTAGAGG-GAG-CAGC -> MD:Z: 3C1^NNNN1T1^GAG3G2^G1
345
346 0 my @exon_starts;
347 my @exon_stops;
348
349 0 my $pos = $self->start;
350 0 my $cigar = $self->cigar;
351
352 0 ▶ while ($cigar =~ /(\d+)([MIDNSHP=X])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)([MIDNSHP=X])/g) 0 0 0
353 0 my ($count, $identifier) = ($1, $2);
354 0 ▶ if ($identifier eq 'D' or $identifier eq 'N' or $identifier eq 'P' or $identifier eq 'H') {
Branch: 2 branches
BranchTrueFalseTotal
if ($identifier eq 'D' or $identifier eq 'N' or $identifier eq 'P' or $identifier eq 'H') { } 0 0 0
elsif ($identifier eq 'M' or $identifier eq '=' or $identifier eq 'X') { } 0 0 0
Condition0%0/9
$identifier eq "D" or $identifier eq "N" or $identifier eq "P" or $identifier eq "H"
l!l&&r!l&&!r
000
$identifier eq "D" or $identifier eq "N" or $identifier eq "P"
l!l&&r!l&&!r
000
$identifier eq "D" or $identifier eq "N"
l!l&&r!l&&!r
000
MC/DC0%0/4
$identifier eq "D" or $identifier eq "N" or $identifier eq "P" or $identifier eq "H"
$identifier eq "D" $identifier eq "N" $identifier eq "P" $identifier eq "H"
Truth table0%0/5
A or B or C or D
A= $identifier eq "D"B= $identifier eq "N"C= $identifier eq "P"D= $identifier eq "H"
ABCDresult
1XXX1
01XX1
001X1
00011
00000
355 0 $pos += $count;
356 }
357 ▶ elsif ($identifier eq 'M' or $identifier eq '=' or $identifier eq 'X') {
Condition0%0/6
$identifier eq "M" or $identifier eq "=" or $identifier eq "X"
l!l&&r!l&&!r
000
$identifier eq "M" or $identifier eq "="
l!l&&r!l&&!r
000
MC/DC0%0/3
$identifier eq "M" or $identifier eq "=" or $identifier eq "X"
$identifier eq "M" $identifier eq "=" $identifier eq "X"
Truth table0%0/4
A or B or C
A= $identifier eq "M"B= $identifier eq "="C= $identifier eq "X"
ABCresult
1XX1
01X1
0011
0000
358 0 push @exon_starts, $pos;
359 0 push @exon_stops, $pos+$count-1;
360 0 $pos += $count;
361 }
362 }
363 0 return (\@exon_starts, \@exon_stops);
364 }
365  
366 #######################################################################
367 ######################### Private methods ##########################
368 #######################################################################
369 sub _total_operator_count {
370 106 ▶ my ($self, $operator) = @_;
Subroutine _total_operator_count: called CC=2 SCAR=6.9
371
372 106 my $cigar = $self->cigar;
373
374 106 my $count = 0;
375 106 ▶ while ($cigar =~ /(\d+)$operator/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cigar =~ /(\d+)$operator/g) 115 106 221
376 115 $count += $1;
377 }
378 106 return $count;
379 }
380  
381 1 1;
« GenOO/RegionCollection/Factory/DBIC.pm ↑ Summary GenOO/Helper/MyMath.pm »