bioperl-live icon indicating copy to clipboard operation
bioperl-live copied to clipboard

Bug in is_ter_codon

Open Juke34 opened this issue 4 months ago • 0 comments

is_ter_codon and is_start_codon do not behaves the same. ( with that PR now it does). is_ter_codon was not verifying all unambiguous_codons, but only the first.

I do not get why Matthew Laird that coded is_ter_codon in 2016 did it like that while the _codon_is was existing and used by is_start_codon since 2010.

sub is_start_codon{
   shift->_codon_is( shift, \@STARTS, 'M' );
}

How is_ter_codon was coded was not behaving as explained. Indeed only the first codon for ambiguous codon was tried. It was coded Upside down (between the else and if statement).

       my $result = 0;

       # For all the possible codons, if any are not a stop
       # codon, fail immediately
       for my $c ( $self->unambiguous_codons($value) ) {
	   my $m = substr( $TABLES[$id], $CODONS->{$c}, 1 );
	   if($m eq $TERMINATOR) {
	       $result = 1;
	   } else {
	       return 0;
	   }
       }
       return $result;

Anyway using the _codon_is method as for is_start_codon seems perfectly fine.

Juke34 avatar Feb 16 '24 17:02 Juke34