Skip to content

Commit

Permalink
is_ter_codon and is_start_codon do not behaves thesame. Now it does. …
Browse files Browse the repository at this point in the history
…is_ter_codon was not verifying all unambiguous_codons, but only the first.
  • Loading branch information
Juke34 committed Feb 16, 2024
1 parent d622ca4 commit 120a20a
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions lib/Bio/Tools/CodonTable.pm
Original file line number Diff line number Diff line change
Expand Up @@ -735,41 +735,18 @@ sub is_start_codon{
=head2 is_ter_codon
Title : is_ter_codon
Usage : $obj->is_ter_codon('GAA')
Usage : $obj->is_ter_codon('TGA')
Function: returns true (1) for all codons that can be used as a
translation tarminator, false (0) for others.
Example : $myCodonTable->is_ter_codon('ATG')
Example : $myCodonTable->is_ter_codon('TGA')
Returns : boolean
Args : 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;
}
shift->_codon_is( shift, \@STARTS, '*' );
}

# desc: compares the passed value with a single entry in the given
Expand Down

0 comments on commit 120a20a

Please sign in to comment.