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

Jason Stajich jason@cgt.mc.duke.edu
Thu, 31 Oct 2002 09:22:42 -0500 (EST)


Personally I expect valid_aa to do just that - only return valid amino
acid codes.  But if people want it to additionally return stop codes that
- but perhaps the changes should be pushed into CodonTable?

On 31 Oct 2002, Heikki Lehvaslaiho wrote:

> Jamie,
>
> You are right. That fixes that problem. I'll se that this gets fixed
> properly.
>
> 	-Heikki
>
> On Wed, 2002-10-30 at 23:44, Jamie Hatfield wrote:
> > 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
> > >
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l@bioperl.org
> > http://bioperl.org/mailman/listinfo/bioperl-l
>

-- 
Jason Stajich
Duke University
jason at cgt.mc.duke.edu