| 1 | # POD documentation - main docs before the code | ||||||||||||||
| 2 | |||||||||||||||
| 3 | =head1 NAME | ||||||||||||||
| 4 | |||||||||||||||
| 5 | GenOO::Spliceable - Role for a region that can be spliced | ||||||||||||||
| 6 | |||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||
| 8 | |||||||||||||||
| 9 | # This role provides regions with the splicing attributes and methods | ||||||||||||||
| 10 | |||||||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||||||
| 12 | |||||||||||||||
| 13 | An object that consumes this role gets splicing attributes and methods such as exons and | ||||||||||||||
| 14 | introns. The key attributes of this class are "splice_starts" and "splice_stops" | ||||||||||||||
| 15 | which are sorted arrays of coordinates that define the intervals for exons. | ||||||||||||||
| 16 | |||||||||||||||
| 17 | -------------EXON_1----------- ------------EXON_2------------ | ||||||||||||||
| 18 | SPLICE_START_1...SPLICE_STOP_1...INTRON...SPLICE_START_2...SPLICE_STOP_2...INTRON... | ||||||||||||||
| 19 | |||||||||||||||
| 20 | =head1 EXAMPLES | ||||||||||||||
| 21 | |||||||||||||||
| 22 | # Get the location information on the reference sequence | ||||||||||||||
| 23 | $obj_with_role->exons; | ||||||||||||||
| 24 | $obj_with_role->introns; | ||||||||||||||
| 25 | |||||||||||||||
| 26 | # Check if a position is within an exon or an intron | ||||||||||||||
| 27 | $obj_with_role->is_position_within_exon(120); # 1/0 | ||||||||||||||
| 28 | $obj_with_role->is_position_within_intron(120); # 0/1 | ||||||||||||||
| 29 | |||||||||||||||
| 30 | # Get the length of the exonic region | ||||||||||||||
| 31 | $obj_with_role->exonic_length; | ||||||||||||||
| 32 | |||||||||||||||
| 33 | =cut | ||||||||||||||
| 34 | |||||||||||||||
| 35 | # Let the code begin... | ||||||||||||||
| 36 | |||||||||||||||
| 37 | package GenOO::Spliceable; | ||||||||||||||
| 38 | 1 | $GenOO::Spliceable::VERSION = '1.5.0'; | |||||||||||||
| 39 | 1 | ▶ | use Moose::Role; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 40 | 1 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 41 | 1 | ▶ | use namespace::autoclean; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 42 | |||||||||||||||
| 43 | 1 | ▶ | use GenOO::Exon; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 44 | 1 | ▶ | use GenOO::Intron; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 45 | 1 | ▶ | use GenOO::Junction; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 46 | |||||||||||||||
| 47 | # Define new data type | ||||||||||||||
| 48 | 8076 | ▶ | subtype 'SortedArrayRef', as 'ArrayRef', where { _sorted_array() }; | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 49 | |||||||||||||||
| 50 | # Define coercions to new data type | ||||||||||||||
| 51 | 20 | ▶ | coerce 'SortedArrayRef', from 'ArrayRef', via { [sort {$a <=> $b} @{$_}] }; | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 52 | 0 | ▶ | coerce 'SortedArrayRef', from 'Str' , via { [sort {$a <=> $b} (split(/\D+/,$_))] }; | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||||||||||||||
| 53 | |||||||||||||||
| 54 | # Define attributes | ||||||||||||||
| 55 | 1 | has 'splice_starts' => ( | |||||||||||||
| 56 | isa => 'SortedArrayRef', | ||||||||||||||
| 57 | is => 'ro', | ||||||||||||||
| 58 | writer => '_set_splice_starts', | ||||||||||||||
| 59 | required => 1, | ||||||||||||||
| 60 | coerce => 1 | ||||||||||||||
| 61 | ); | ||||||||||||||
| 62 | |||||||||||||||
| 63 | 1 | has 'splice_stops' => ( | |||||||||||||
| 64 | isa => 'SortedArrayRef', | ||||||||||||||
| 65 | is => 'ro', | ||||||||||||||
| 66 | writer => '_set_splice_stops', | ||||||||||||||
| 67 | required => 1, | ||||||||||||||
| 68 | coerce => 1 | ||||||||||||||
| 69 | ); | ||||||||||||||
| 70 | |||||||||||||||
| 71 | 1 | has 'exons' => ( | |||||||||||||
| 72 | isa => 'ArrayRef', | ||||||||||||||
| 73 | is => 'ro', | ||||||||||||||
| 74 | builder => '_create_exons', | ||||||||||||||
| 75 | init_arg => undef, | ||||||||||||||
| 76 | lazy => 1, | ||||||||||||||
| 77 | ); | ||||||||||||||
| 78 | |||||||||||||||
| 79 | 1 | has 'introns' => ( | |||||||||||||
| 80 | isa => 'ArrayRef', | ||||||||||||||
| 81 | is => 'ro', | ||||||||||||||
| 82 | builder => '_create_introns', | ||||||||||||||
| 83 | init_arg => undef, | ||||||||||||||
| 84 | lazy => 1, | ||||||||||||||
| 85 | ); | ||||||||||||||
| 86 | |||||||||||||||
| 87 | # Define consumed roles | ||||||||||||||
| 88 | 1 | with 'GenOO::Region'; | |||||||||||||
| 89 | |||||||||||||||
| 90 | |||||||||||||||
| 91 | sub BUILD { | ||||||||||||||
| 92 | 1053 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 93 | |||||||||||||||
| 94 | 1053 | $self->_sanitize_splice_starts_and_stops; | |||||||||||||
| 95 | } | ||||||||||||||
| 96 | |||||||||||||||
| 97 | ####################################################################### | ||||||||||||||
| 98 | ######################## Interface Methods ######################## | ||||||||||||||
| 99 | ####################################################################### | ||||||||||||||
| 100 | sub is_position_within_exon { | ||||||||||||||
| 101 | 4 | ▶ | my ($self, $position) = @_; | ||||||||||||
|
Subroutine
is_position_within_exon: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||
| 102 | |||||||||||||||
| 103 | 4 | my $exons = $self->exons; | |||||||||||||
| 104 | 4 | foreach my $exon (@$exons) { | |||||||||||||
| 105 | 10 | ▶ | if ($exon->contains_position($position)) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 106 | 2 | return 1; | |||||||||||||
| 107 | } | ||||||||||||||
| 108 | } | ||||||||||||||
| 109 | 2 | return 0; | |||||||||||||
| 110 | } | ||||||||||||||
| 111 | |||||||||||||||
| 112 | sub is_position_within_intron { | ||||||||||||||
| 113 | 2 | ▶ | my ($self, $position) = @_; | ||||||||||||
|
Subroutine
is_position_within_intron: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||
| 114 | |||||||||||||||
| 115 | 2 | my $introns = $self->introns; | |||||||||||||
| 116 | 2 | foreach my $intron (@$introns) { | |||||||||||||
| 117 | 4 | ▶ | if ($intron->contains_position($position)) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 118 | 1 | return 1; | |||||||||||||
| 119 | } | ||||||||||||||
| 120 | } | ||||||||||||||
| 121 | 1 | return 0; | |||||||||||||
| 122 | } | ||||||||||||||
| 123 | |||||||||||||||
| 124 | sub exon_exon_junctions { | ||||||||||||||
| 125 | 1 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
exon_exon_junctions: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||
| 126 | |||||||||||||||
| 127 | 1 | my @junctions; | |||||||||||||
| 128 | my @junction_starts; | ||||||||||||||
| 129 | 1 | my @junction_stops; | |||||||||||||
| 130 | |||||||||||||||
| 131 | 1 | my $exons = $self->exons; | |||||||||||||
| 132 | 1 | ▶ | if (@$exons > 1) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 133 | 1 | ▶ | for (my $i=0;$i<@$exons-1;$i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 134 | 3 | push @junction_starts, $$exons[$i]->stop; | |||||||||||||
| 135 | 3 | push @junction_stops, $$exons[$i+1]->start; | |||||||||||||
| 136 | } | ||||||||||||||
| 137 | } | ||||||||||||||
| 138 | |||||||||||||||
| 139 | 1 | ▶ | my $junctions_count = @junction_starts == @junction_stops ? @junction_starts : die "Junctions starts are not of the same size as junction stops\n"; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 140 | 1 | ▶ | for (my $i=0;$i<$junctions_count;$i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 141 | 3 | push @junctions, GenOO::Junction->new( | |||||||||||||
| 142 | species => $self->species, | ||||||||||||||
| 143 | strand => $self->strand, | ||||||||||||||
| 144 | chromosome => $self->chromosome, | ||||||||||||||
| 145 | start => $junction_starts[$i], | ||||||||||||||
| 146 | stop => $junction_stops[$i], | ||||||||||||||
| 147 | part_of => $self, | ||||||||||||||
| 148 | ); | ||||||||||||||
| 149 | } | ||||||||||||||
| 150 | 1 | return \@junctions; | |||||||||||||
| 151 | } | ||||||||||||||
| 152 | |||||||||||||||
| 153 | sub exonic_sequence { | ||||||||||||||
| 154 | 1 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
exonic_sequence: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||
| 155 | |||||||||||||||
| 156 | 1 | ▶ | if (defined $self->sequence) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 157 | 1 | my $exonic_sequence = ''; | |||||||||||||
| 158 | |||||||||||||||
| 159 | 1 | ▶ | my $seq = $self->strand == 1 ? $self->sequence : reverse($self->sequence); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 160 | 1 | foreach my $exon (@{$self->exons}) { | |||||||||||||
| 161 | 4 | $exonic_sequence .= substr($seq, ($exon->start - $self->start), $exon->length); | |||||||||||||
| 162 | } | ||||||||||||||
| 163 | |||||||||||||||
| 164 | 1 | ▶ | if ($self->strand == 1) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 165 | 0 | return $exonic_sequence; | |||||||||||||
| 166 | } | ||||||||||||||
| 167 | else { | ||||||||||||||
| 168 | 1 | return reverse($exonic_sequence); | |||||||||||||
| 169 | } | ||||||||||||||
| 170 | } | ||||||||||||||
| 171 | } | ||||||||||||||
| 172 | |||||||||||||||
| 173 | sub exonic_length { | ||||||||||||||
| 174 | 1 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
exonic_length: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 175 | |||||||||||||||
| 176 | 1 | my $length = 0; | |||||||||||||
| 177 | 1 | foreach my $exon (@{$self->exons}) { | |||||||||||||
| 178 | 4 | $length += $exon->length; | |||||||||||||
| 179 | } | ||||||||||||||
| 180 | |||||||||||||||
| 181 | 1 | return $length; | |||||||||||||
| 182 | } | ||||||||||||||
| 183 | |||||||||||||||
| 184 | sub intronic_length { | ||||||||||||||
| 185 | 1 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
intronic_length: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 186 | |||||||||||||||
| 187 | 1 | my $length = 0; | |||||||||||||
| 188 | 1 | foreach my $intron (@{$self->introns}) { | |||||||||||||
| 189 | 3 | $length += $intron->length; | |||||||||||||
| 190 | } | ||||||||||||||
| 191 | |||||||||||||||
| 192 | 1 | return $length; | |||||||||||||
| 193 | } | ||||||||||||||
| 194 | |||||||||||||||
| 195 | sub relative_exonic_position { | ||||||||||||||
| 196 | 2 | ▶ | my ($self, $abs_pos) = @_; | ||||||||||||
|
Subroutine
relative_exonic_position: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||
| 197 | |||||||||||||||
| 198 | 2 | ▶ | if ($self->is_position_within_exon($abs_pos)) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 199 | 1 | my $relative_pos = $abs_pos - $self->start; | |||||||||||||
| 200 | 1 | foreach my $intron (@{$self->introns}) { | |||||||||||||
| 201 | 1 | ▶ | if ($intron->stop < $abs_pos) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 202 | 0 | $relative_pos -= $intron->length; | |||||||||||||
| 203 | } | ||||||||||||||
| 204 | else { | ||||||||||||||
| 205 | 1 | last; | |||||||||||||
| 206 | } | ||||||||||||||
| 207 | } | ||||||||||||||
| 208 | 1 | return $relative_pos; | |||||||||||||
| 209 | } | ||||||||||||||
| 210 | else { | ||||||||||||||
| 211 | 1 | return undef; | |||||||||||||
| 212 | } | ||||||||||||||
| 213 | } | ||||||||||||||
| 214 | |||||||||||||||
| 215 | sub set_splice_starts_and_stops { | ||||||||||||||
| 216 | 966 | ▶ | my ($self, $splice_starts, $splice_stops) = @_; | ||||||||||||
|
Subroutine
set_splice_starts_and_stops: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 217 | |||||||||||||||
| 218 | 966 | $self->_set_splice_starts($splice_starts); | |||||||||||||
| 219 | 966 | $self->_set_splice_stops($splice_stops); | |||||||||||||
| 220 | 966 | $self->_sanitize_splice_starts_and_stops; | |||||||||||||
| 221 | } | ||||||||||||||
| 222 | |||||||||||||||
| 223 | ####################################################################### | ||||||||||||||
| 224 | ####################### Private Methods ############################ | ||||||||||||||
| 225 | ####################################################################### | ||||||||||||||
| 226 | sub _create_exons { | ||||||||||||||
| 227 | 20 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
_create_exons: called CC=2 SCAR=6.9
| |||||||||||||||
| 228 | |||||||||||||||
| 229 | 20 | my $exon_starts = $self->splice_starts; | |||||||||||||
| 230 | 20 | my $exon_stops = $self->splice_stops; | |||||||||||||
| 231 | |||||||||||||||
| 232 | 20 | my @exons; | |||||||||||||
| 233 | 20 | ▶ | for (my $i=0;$i<@{$exon_starts};$i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 234 | 54 | push @exons, GenOO::Exon->new({ | |||||||||||||
| 235 | strand => $self->strand, | ||||||||||||||
| 236 | chromosome => $self->rname, | ||||||||||||||
| 237 | start => $$exon_starts[$i], | ||||||||||||||
| 238 | stop => $$exon_stops[$i], | ||||||||||||||
| 239 | part_of => $self | ||||||||||||||
| 240 | }); | ||||||||||||||
| 241 | } | ||||||||||||||
| 242 | |||||||||||||||
| 243 | 20 | return \@exons; | |||||||||||||
| 244 | } | ||||||||||||||
| 245 | |||||||||||||||
| 246 | sub _create_introns { | ||||||||||||||
| 247 | 3 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
_create_introns: called CC=4 SCAR=14.2
| |||||||||||||||
| 248 | |||||||||||||||
| 249 | 3 | my $exon_starts = $self->splice_starts; | |||||||||||||
| 250 | 3 | my $exon_stops = $self->splice_stops; | |||||||||||||
| 251 | |||||||||||||||
| 252 | 3 | my @introns; | |||||||||||||
| 253 | |||||||||||||||
| 254 | 3 | ▶ | if ($self->start < $$exon_starts[0]) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 255 | 0 | push @introns, GenOO::Intron->new({ | |||||||||||||
| 256 | strand => $self->strand, | ||||||||||||||
| 257 | chromosome => $self->rname, | ||||||||||||||
| 258 | start => $self->start, | ||||||||||||||
| 259 | stop => $$exon_starts[0] - 1, | ||||||||||||||
| 260 | part_of => $self, | ||||||||||||||
| 261 | }); | ||||||||||||||
| 262 | } | ||||||||||||||
| 263 | |||||||||||||||
| 264 | 3 | ▶ | for (my $i=1;$i<@{$exon_starts};$i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 265 | push @introns, (GenOO::Intron->new({ | ||||||||||||||
| 266 | strand => $self->strand, | ||||||||||||||
| 267 | chromosome => $self->rname, | ||||||||||||||
| 268 | 9 | start => ${$exon_stops}[$i-1] + 1, | |||||||||||||
| 269 | 9 | stop => ${$exon_starts}[$i] - 1, | |||||||||||||
| 270 | part_of => $self, | ||||||||||||||
| 271 | })); | ||||||||||||||
| 272 | } | ||||||||||||||
| 273 | |||||||||||||||
| 274 | 3 | ▶ | if ($self->stop > $$exon_stops[-1]) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 275 | 0 | push @introns, (GenOO::Intron->new({ | |||||||||||||
| 276 | strand => $self->strand, | ||||||||||||||
| 277 | chromosome => $self->rname, | ||||||||||||||
| 278 | start => $$exon_stops[-1] + 1, | ||||||||||||||
| 279 | stop => $self->stop, | ||||||||||||||
| 280 | part_of => $self, | ||||||||||||||
| 281 | })); | ||||||||||||||
| 282 | } | ||||||||||||||
| 283 | |||||||||||||||
| 284 | 3 | return \@introns; | |||||||||||||
| 285 | } | ||||||||||||||
| 286 | |||||||||||||||
| 287 | sub _sanitize_splice_starts_and_stops { | ||||||||||||||
| 288 | 2019 | ▶ | my ($self) = @_; | ||||||||||||
|
Subroutine
_sanitize_splice_starts_and_stops: called CC=4 SCAR=15.2
| |||||||||||||||
| 289 | |||||||||||||||
| 290 | 2019 | my $splice_starts = $self->splice_starts; | |||||||||||||
| 291 | 2019 | my $splice_stops = $self->splice_stops; | |||||||||||||
| 292 | |||||||||||||||
| 293 | 2019 | ▶ | if (@$splice_starts != @$splice_stops) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 294 | 0 | die "Error: Spice starts array is not of the same size as splice_stops (".scalar @$splice_starts."!=".scalar @$splice_stops.")\n"; | |||||||||||||
| 295 | } | ||||||||||||||
| 296 | |||||||||||||||
| 297 | 2019 | my $index = 0; | |||||||||||||
| 298 | 2019 | ▶ | while ($index < (@$splice_starts-1)) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 299 | 5551 | ▶ | if ($$splice_stops[$index] == $$splice_starts[$index+1] - 1) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 300 | 0 | $$splice_stops[$index] = $$splice_stops[$index+1]; | |||||||||||||
| 301 | 0 | splice @$splice_starts, $index+1, 1; | |||||||||||||
| 302 | 0 | splice @$splice_stops, $index+1, 1; | |||||||||||||
| 303 | } | ||||||||||||||
| 304 | else { | ||||||||||||||
| 305 | 5551 | $index++; | |||||||||||||
| 306 | } | ||||||||||||||
| 307 | } | ||||||||||||||
| 308 | } | ||||||||||||||
| 309 | |||||||||||||||
| 310 | ####################################################################### | ||||||||||||||
| 311 | ####################### Private Routines ########################### | ||||||||||||||
| 312 | ####################################################################### | ||||||||||||||
| 313 | sub _sanitize_splice_coords_within_limits { | ||||||||||||||
| 314 | 6 | ▶ | my ($pre_splice_starts, $pre_splice_stops, $start, $stop) = @_; | ||||||||||||
|
Subroutine
_sanitize_splice_coords_within_limits: called CC=6 SCAR=17.9
| |||||||||||||||
| 315 | |||||||||||||||
| 316 | 6 | my @splice_starts; | |||||||||||||
| 317 | my @splice_stops; | ||||||||||||||
| 318 | 6 | ▶ | for (my $i=0;$i<@$pre_splice_starts;$i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 319 | 48 | ▶ | if ($$pre_splice_stops[$i] < $start) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 320 | 14 | next; | |||||||||||||
| 321 | } | ||||||||||||||
| 322 | elsif ($$pre_splice_starts[$i] > $stop) { | ||||||||||||||
| 323 | 14 | next; | |||||||||||||
| 324 | } | ||||||||||||||
| 325 | else { #if the exon overlaps or is contained in the UTR5 | ||||||||||||||
| 326 | 20 | ▶ | if ($start >= $$pre_splice_starts[$i]) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 327 | 6 | push @splice_starts, $start; | |||||||||||||
| 328 | } | ||||||||||||||
| 329 | else { | ||||||||||||||
| 330 | 14 | push @splice_starts, $$pre_splice_starts[$i]; | |||||||||||||
| 331 | } | ||||||||||||||
| 332 | 20 | ▶ | if ($stop < $$pre_splice_stops[$i]) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 333 | 4 | push @splice_stops, $stop; | |||||||||||||
| 334 | } | ||||||||||||||
| 335 | else { | ||||||||||||||
| 336 | 16 | push @splice_stops, $$pre_splice_stops[$i]; | |||||||||||||
| 337 | } | ||||||||||||||
| 338 | } | ||||||||||||||
| 339 | } | ||||||||||||||
| 340 | 6 | return \@splice_starts, \@splice_stops; | |||||||||||||
| 341 | } | ||||||||||||||
| 342 | |||||||||||||||
| 343 | sub _sorted_array { | ||||||||||||||
| 344 | 8076 | ▶ | my $arrayref = $_; | ||||||||||||
|
Subroutine
_sorted_array: called CC=4 SCAR=13.9
| |||||||||||||||
| 345 | |||||||||||||||
| 346 | 8076 | ▶ | if (@{$arrayref} > 1){ | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 347 | 3488 | ▶ | for (my $i = 1; $i < @{$arrayref}; $i++){ | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 348 | 22184 | ▶ | if ($$arrayref[$i] < $$arrayref[$i-1]){ | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 349 | 20 | return 0; | |||||||||||||
| 350 | } | ||||||||||||||
| 351 | } | ||||||||||||||
| 352 | 3468 | return 1; | |||||||||||||
| 353 | } | ||||||||||||||
| 354 | 4588 | return 1; | |||||||||||||
| 355 | } | ||||||||||||||
| 356 | |||||||||||||||
| 357 | 1 | 1; | |||||||||||||