| 1 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Version 4.1 specific functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 VCFv4.1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | VCFv4.1 specific functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | package VCF::V4_1; | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | $VCF::V4_1::VERSION = '1.0'; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use base qw(VCF::V4_0); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | my ($class,@args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | bless $self, ref($class) || $class; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | $$self{_defaults} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | version => '4.1', | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | drop_trailings => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | filter_passed => 'PASS', | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | defaults => | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | QUAL => '.', | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | Flag => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | GT => '.', | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | default => '.', | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | reserved => | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | FILTER => { 0=>1 }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | handlers => | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | Integer => \&VCF::Reader::validate_int, | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Float => \&VCF::Reader::validate_float, | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Character => \&VCF::Reader::validate_char, | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | String => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | Flag => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | regex_snp => qr/^[ACGTN]$|^<[\w:.]+>$/i, | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | regex_ins => qr/^[ACGTN]+$/i, | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | regex_del => qr/^[ACGTN]+$/i, | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | regex_gtsep => qr{[|/]}, # | / | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | regex_gt => qr{^(\.|\d+)([|/]?)(\.?|\d*)$}, # . ./. 0/1 0|1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | regex_gt2 => qr{^(\.|[0-9ACGTNacgtn]+|<[\w:.]+>)([|/]?)}, # . ./. 0/1 0|1 A/A A|A 0|<DEL:ME:ALU> | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | gt_sep => [qw(| /)], | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $$self{ignore_missing_GT} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | for my $key (keys %{$$self{_defaults}}) | |||||||||||||||||||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $$self{$key}=$$self{_defaults}{$key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | sub validate_header | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_header: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $lines = $self->get_header_line(key=>'reference'); | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ( !@$lines ) { $self->warn("The header tag 'reference' not present. (Not required but highly recommended.)\n"); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | sub validate_line | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | my ($self,$line) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_line: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ( !$$self{_contig_validated}{$$line{CHROM}} ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $lines = $self->get_header_line(key=>'contig',ID=>$$line{CHROM}); | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ( !@$lines ) { $self->warn("The header tag 'contig' not present for CHROM=$$line{CHROM}. (Not required but highly recommended.)\n"); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $$self{_contig_validated}{$$line{CHROM}} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if ( index($$line{CHROM},':')!=-1 ) { $self->warn("Colons not allowed in chromosome names: $$line{CHROM}\n"); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Is the ID composed of alphanumeric chars | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if ( !($$line{ID}=~/^\S+$/) ) { $self->warn("Expected non-whitespace ID at $$line{CHROM}:$$line{POS}, but got [$$line{ID}]\n"); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | sub validate_alt_field | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | my ($self,$values,$ref) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_alt_field: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ( @$values == 1 && $$values[0] eq '.' ) { return undef; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@$values == 1 and $values->[0] eq "."
MC/DC0%0/2
@$values == 1 and $values->[0] eq "."
@$values == 1
$values->[0] eq "."
Truth table0%0/3
A and B
A= @$values == 1B= $values->[0] eq "."
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $ret = $self->_validate_alt_field($values,$ref); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if ( $ret ) { return $ret; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $ref_len = length($ref); | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $ref1 = substr($ref,0,1); | |||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my @err; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $msg = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | for my $item (@$values) | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | if ( $item=~/^(.*)\[(.+)\[(.*)$/ or $item=~/^(.*)\](.+)\](.*)$/ ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$item =~ /^(.*)\[(.+)\[(.*)$/ or $item =~ /^(.*)\](.+)\](.*)$/
MC/DC0%0/2
$item =~ /^(.*)\[(.+)\[(.*)$/ or $item =~ /^(.*)\](.+)\](.*)$/
$item =~ /^(.*)\[(.+)\[(.*)$/
$item =~ /^(.*)\](.+)\](.*)$/
Truth table0%0/3
A or B
A= $item =~ /^(.*)\[(.+)\[(.*)$/B= $item =~ /^(.*)\](.+)\](.*)$/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ( $1 ne '' && $3 ne '' ) { $msg=', two replacement strings given (expected one)'; push @err,$item; next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$1 ne "" and $3 ne ""
MC/DC0%0/2
$1 ne "" and $3 ne ""
$1 ne ""
$3 ne ""
Truth table0%0/3
A and B
A= $1 ne ""B= $3 ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $rpl; | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if ( $1 ne '' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $rpl = $1; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ( $rpl ne '.' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $rref = substr($rpl,0,1); | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ( $rref ne $ref1 ) { $msg=', the first base of the replacement string does not match the reference'; push @err,$item; next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $rpl = $3; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if ( $rpl ne '.' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my $rref = substr($rpl,-1,1); | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if ( $rref ne $ref1 ) { $msg=', the last base of the replacement string does not match the reference'; push @err,$item; next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $pos = $2; | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if ( !($rpl=~/^[ACTGNacgtn]+$/) && $rpl ne '.' ) { $msg=', replacement string not valid (expected [ACTGNacgtn]+)'; push @err,$item; next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $rpl =~ /^[ACTGNacgtn]+$/ and $rpl ne "."
MC/DC0%0/2
not $rpl =~ /^[ACTGNacgtn]+$/ and $rpl ne "."
not $rpl =~ /^[ACTGNacgtn]+$/
$rpl ne "."
Truth table0%0/3
not(A) and B
A= not $rpl =~ /^[ACTGNacgtn]+$/B= $rpl ne "."
| |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if ( !($pos=~/^\S+:\d+$/) ) { $msg=', cannot parse sequence:position'; push @err,$item; next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if ( $item=~/^\.[ACTGNactgn]*([ACTGNactgn])$/ ) { next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | elsif ( $item=~/^([ACTGNactgn])[ACTGNactgn]*\.$/ ) { next; } | |||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ( !($item=~/^[ACTGNactgn]+$|^<[^<>\s]+>$/) ) { push @err,$item; next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ( !@err ) { return undef; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return 'Could not parse the allele(s) [' .join(',',@err). ']' . $msg; | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | sub next_data_hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | my ($self,@args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_data_hash: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $out = $self->SUPER::next_data_hash(@args); | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ( !defined $out or $$self{assume_uppercase} ) { return $out; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $out or $self->{"assume_uppercase"}
MC/DC0%0/2
not defined $out or $self->{"assume_uppercase"}
not defined $out
$self->{"assume_uppercase"}
Truth table0%0/3
not(A) or B
A= not defined $outB= $self->{"assume_uppercase"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # Case-insensitive ALT and REF bases | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $$out{REF} = uc($$out{REF}); | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $nalt = @{$$out{ALT}}; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | for (my $i=0; $i<$nalt; $i++) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if ( $$out{ALT}[$i]=~/^</ ) { next; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $$out{ALT}[$i] = uc($$out{ALT}[$i]); | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||
| 160 | sub next_data_array | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my ($self,@args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_data_array: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $out = $self->SUPER::next_data_array(@args); | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ( !defined $out or $$self{assume_uppercase} ) { return $out; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $out or $self->{"assume_uppercase"}
MC/DC0%0/2
not defined $out or $self->{"assume_uppercase"}
not defined $out
$self->{"assume_uppercase"}
Truth table0%0/3
not(A) or B
A= not defined $outB= $self->{"assume_uppercase"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # Case-insensitive ALT and REF bases | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $$out[3] = uc($$out[3]); | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $alt = $$out[4]; | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $$out[4] = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my $pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | while ( $pos<length($alt) && (my $start=index($alt,'<',$pos))!=-1 ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pos < length $alt and (my $start = index($alt, "<", $pos)) != -1
MC/DC0%0/2
$pos < length $alt and (my $start = index($alt, "<", $pos)) != -1
$pos < length $alt
(my $start = index($alt, "<", $pos)) != -1
Truth table0%0/3
A and B
A= $pos < length $altB= (my $start = index($alt, "<", $pos)) != -1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $end = index($alt,'>',$start+1); | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ( $end==-1 ) { $self->throw("Could not parse ALT [$alt]\n") } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ( $start>$pos ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $$out[4] .= uc(substr($alt,$pos,$start-$pos)); | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $$out[4] .= substr($alt,$start,$end-$start+1); | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $pos = $end+1; | |||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | if ( $pos<length($alt) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $$out[4] .= uc(substr($alt,$pos)); | |||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | sub event_type | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | my ($self,$rec,$allele) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
event_type: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $len = length($allele); | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if ( $len==1 ) { return $self->SUPER::event_type($rec,$allele); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my $c = substr($allele,0,1); | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ( $c eq '<' ) { return ('u',0,$allele); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | elsif ( $c eq '[' or $c eq ']' or $c eq '.' ) { return 'b'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$c eq "[" or $c eq "]" or $c eq "."
$c eq "[" or $c eq "]"
MC/DC0%0/3
$c eq "[" or $c eq "]" or $c eq "."
$c eq "["
$c eq "]"
$c eq "."
Truth table0%0/4
A or B or C
A= $c eq "["B= $c eq "]"C= $c eq "."
| |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $c = substr($allele,-1,1); | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | if ( $c eq '[' or $c eq ']' or $c eq '.' ) { return 'b'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$c eq "[" or $c eq "]" or $c eq "."
$c eq "[" or $c eq "]"
MC/DC0%0/3
$c eq "[" or $c eq "]" or $c eq "."
$c eq "["
$c eq "]"
$c eq "."
Truth table0%0/4
A or B or C
A= $c eq "["B= $c eq "]"C= $c eq "."
| |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | elsif ( index($allele,'[')!=-1 or index($allele,']')!=-1 ) { return 'b'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
index($allele, "[") != -1 or index($allele, "]") != -1
MC/DC0%0/2
index($allele, "[") != -1 or index($allele, "]") != -1
index($allele, "[") != -1
index($allele, "]") != -1
Truth table0%0/3
A or B
A= index($allele, "[") != -1B= index($allele, "]") != -1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return $self->SUPER::event_type($rec,$allele); | |||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||