Skip to content

Commit

Permalink
Prevent inf loop when REF eq ALT
Browse files Browse the repository at this point in the history
  • Loading branch information
ckandoth committed Sep 1, 2016
1 parent cccebe6 commit 0b9fc73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion maf2maf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
my $var = (( defined $al1 and $al1 and $al1 ne $ref ) ? $al1 : $al2 );

# Remove any prefixed reference bps from alleles, using "-" for simple indels
while( substr( $ref, 0, 1 ) eq substr( $var, 0, 1 )) {
while( $ref and $var and substr( $ref, 0, 1 ) eq substr( $var, 0, 1 ) and $ref ne $var ) {
( $ref, $var ) = map{$_ = substr( $_, 1 ); ( $_ ? $_ : "-" )} ( $ref, $var );
++$pos unless( $ref eq "-" );
}
Expand Down
2 changes: 1 addition & 1 deletion vcf2maf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ sub GetBiotypePriority {
my ( $ref_length, $var_length ) = ( length( $ref ), length( $var ));
# Remove any prefixed reference bps from all alleles, using "-" for simple indels
my $vcf_pos = $pos;
while( substr( $ref, 0, 1 ) eq substr( $var, 0, 1 )) {
while( $ref and $var and substr( $ref, 0, 1 ) eq substr( $var, 0, 1 ) and $ref ne $var ) {
( $ref, $var, @alleles ) = map{$_ = substr( $_, 1 ); ( $_ ? $_ : "-" )} ( $ref, $var, @alleles );
--$ref_length; --$var_length; ++$pos;
}
Expand Down

0 comments on commit 0b9fc73

Please sign in to comment.