From 17f4c3b18b35447e93d1ff8349311c5aaff2b199 Mon Sep 17 00:00:00 2001 From: David Miguel Susano Pinto Date: Fri, 26 Apr 2024 15:18:57 +0100 Subject: [PATCH] Bio::Tools::CodonTable: rmeove code duplication in is_ter_codon and _codon_is Back in 260ebb98, is_ter_codon changed and made its own slightly different implementation of _codon_is to handle ambiguous codons, Those changes have now been implemented in _codon_is so go back to use it instead of its own divergent implementation. --- lib/Bio/Tools/CodonTable.pm | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/Bio/Tools/CodonTable.pm b/lib/Bio/Tools/CodonTable.pm index e9f2593ab..8c05aee37 100644 --- a/lib/Bio/Tools/CodonTable.pm +++ b/lib/Bio/Tools/CodonTable.pm @@ -656,7 +656,7 @@ sub reverse_translate_best { =cut sub is_start_codon{ - shift->_codon_is( shift, \@STARTS, 'M' ); + return shift->_codon_is(shift, \@STARTS, 'M'); } =head2 is_ter_codon @@ -674,31 +674,7 @@ sub is_start_codon{ =cut sub is_ter_codon{ - my ($self, $value) = @_; - my $id = $self->{'id'}; - - # We need to ensure U is mapped to T (ie. UAG) - $value = uc $value; - $value =~ tr/U/T/; - - if (length $value != 3 ) { - # Incomplete codons are not stop codons - return 0; - } else { - 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; - } + return shift->_codon_is(shift, \@STARTS, $TERMINATOR); } # desc: compares the passed value with a single entry in the given -- 2.11.4.GIT