« blib/lib/Bio/Tradis/CommandLine/PlotTradis.pm
↑ Summary
blib/lib/Bio/Tradis/CommandLine/CheckTags.pm »
| 1 | package Bio::Tradis::Parser::Cigar; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | $Bio::Tradis::Parser::Cigar::VERSION = '1.4.5'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Take in a cigar string and output start and end relative to the reference sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | has 'cigar' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | has 'coordinate' => ( is => 'ro', isa => 'Num', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | has '_results' => (is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build__results'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | sub _build__results | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build__results: called CC=12 SCAR=25.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 8 | my %results = ( start => 0, end => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 8 | my $current_coordinate = $self->coordinate; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 8 | my @cigar_parts = $self->cigar =~ /(\d+[MIDNSHP=X])/g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 8 | for my $cigar_item (@cigar_parts) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | ▶ | if( $cigar_item =~ /(\d+)([MIDNSHP=X])/) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 19 | my $number = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 19 | my $action = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 19 | ▶ | if($action eq 'M' || $action eq 'X' || $action eq '=' ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%4/6
$action eq "M" or $action eq "X" or $action eq "="
$action eq "M" or $action eq "X"
MC/DC33%1/3
$action eq "M" or $action eq "X" or $action eq "="
$action eq "M"
$action eq "X"
$action eq "="
Truth table50%2/4
A or B or C
A= $action eq "M"B= $action eq "X"C= $action eq "="
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 11 | ▶ | $results{start} = $current_coordinate if($results{start} == 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 11 | $current_coordinate += $number; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 11 | ▶ | $results{end} = $current_coordinate -1 if($results{end} < $current_coordinate); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ▶ | elsif($action eq 'S' || $action eq 'D' || $action eq 'N') | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$action eq "S" or $action eq "D" or $action eq "N"
$action eq "S" or $action eq "D"
MC/DC66%2/3
$action eq "S" or $action eq "D" or $action eq "N"
$action eq "S"
$action eq "D"
$action eq "N"
Truth table75%3/4
A or B or C
A= $action eq "S"B= $action eq "D"C= $action eq "N"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | $current_coordinate += $number; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | elsif($action eq 'I' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # do nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 8 | return \%results; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | sub start | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 8 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 8 | return $self->_results->{start}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | sub end | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 8 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 8 | return $self->_results->{end}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 8 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 8 | ▶ | no Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||