[Bioperl-l] rev translating stop codons with Bio::Tools::CodonTable

Jamie Hatfield jamie@genome.arizona.edu
Wed, 30 Oct 2002 16:44:48 -0700


I'm new to Bioperl myself, but after looking through the source for
Bio::SeqUtils->valid_aa (which Bio::Tools::CodonTable uses to generate
its $VALID_PROTEIN list), the following code seems to be suspect...

sub valid_aa {
   my ($self,$code) = @_;

   if( ! $code ) { 
       my @codes;
       foreach my $c ( sort values %ONECODE ) {
	   push @codes, $c unless ( $c =~ /[BZX\*]/ );
       }
       push @codes, qw(B Z X); # so they are in correct order ?
return @codes;
  } 
  :
  :
  :
}

We don't push on codes B, Z, X, or *, and then we put B, Z, and X on at
the end.  '*' will never be pushed on, and therefore, the check in
Bio::Tools::CodonTable->revtranslate 

if ( defined $value and $value =~ /$VALID_PROTEIN/ ...

Will fail for '*'.


> -----Original Message-----
> From: bioperl-l-admin@bioperl.org 
> [mailto:bioperl-l-admin@bioperl.org] On Behalf Of David Messina
> Sent: Wednesday, October 30, 2002 4:04 PM
> To: bioperl-l@bioperl.org
> Subject: [Bioperl-l] rev translating stop codons with 
> Bio::Tools::CodonTable
> 
> 
> Hi all,
> 
> I looked in the email archive, and I couldn't find any mention of a 
> similar problem. Would you please take a moment to examine the 
> following?
> 
> I can't get Bio::Tools::CodonTable to reverse translate stop 
> symbols (* 
> or Ter) to codons (TAA, TAG, TGA). It works fine in the other 
> direction, translating TAA, TAG, and TGA to *.
> 
> Please see the sample code and its output:
> 
> #!/usr/local/bin/perl -w
> 
> use Bio::Tools::CodonTable;
> $myCodonTable = Bio::Tools::CodonTable->new();
> 
> # This loop tests rev translation of stops.
> # I've put just A and C for this example, but I've tested all 20 
> standard amino acids.
> foreach my $aa ('A', 'C', 'Ter', '*')
> {
>      my @codons = $myCodonTable->revtranslate($aa);
>      if (! @codons) { print "WARNING: no codons for $aa!\n"; }
> 
>          foreach my $codon (@codons)
>          {
>              print $aa, " ", $codon, "\n";
>          }
> }
> 
> # This loop tests regular forward translation of stops.
> foreach my $codon ('TAA', 'TAG', 'TGA')
> {
>      print $codon, " ", $myCodonTable->translate($codon), "\n";
> }
> 
> PROGRAM OUTPUT
> ----------------------------
> A gct
> A gcc
> A gca
> A gcg
> C tgt
> C tgc
> WARNING: no codons for Ter!
> WARNING: no codons for *!
> TAA *
> TAG *
> TGA *
> 
> I am running BioPerl 1.0.2 with Perl 5.8.0 under Mac OS X 
> 10.1.2. Your 
> help is greatly appreciated.
> 
> 
> David Messina
>    Division of Human Genetics
>    Washington Univ. in St. Louis
>    dmessina@genetics.wustl.edu
>    314/747-1063 fx 314/747-2489
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>