[Bioperl-l] Translation routine

Robson Francisco de Souza rfsouza@citri.iq.usp.br
Thu, 25 Apr 2002 13:58:57 -0300 (BRT)


	Hi,

	Thanks Jason and Heikki for your explanations.
	I was thinking that maybe translate's interface could be improved
by adding the possibility to use a hash to pass its arguments. This way
old programs would still work, but a clearer interface would also be
available. I thought of something like changing

sub translate {
    my($self) = shift;
    my($stop, $unknown, $frame, $tableid, $fullCDS, $throw) = @_;

to

sub translate {
    my($self) = shift;
    my @args  = @_;

    my($stop, $unknown, $frame, $tableid, $fullCDS, $throw);
    if (grep { /^\-/ } @args) {
      ($stop, $unknown, $frame, $tableid, $fullCDS, $throw) = 
         $self->_rearrange([qw(STOP,
                               UNKNOWN,
                               FRAME,
                               TABLEID,
                               FULLCDS,
                               THROW,
                               )],@args);                               
    } else {
      ($stop, $unknown, $frame, $tableid, $fullCDS, $throw) = @_;
    }

so that both

$s->translate(undef,undef,0,11);

and 

$s->translate(-tableid => 11, -frame => 0);

would be valid. What do you think?
					Robson

On Thu, 25 Apr 2002, Heikki Lehvaslaiho wrote:

> 
> By default translate works in "informatics" mode where you can translate any
> sequence using the codon table only. The 'fullCDS' takes into account the
> fact that the start codon needs to be translated into M and the removes the
> stop character ('*') as well as checks that there are no stop codons inside
> the poptide sequence.  I think it is best to keep these two modes strictly
> separate, but am happy to discuss it.
> 
> The interfase is horrible, but it is like that to keep older programs happy. 
> 
> What we could do is to  put a new method into our bag of miscellaneous
> tricks module Bio::SeqUtils.
> 
> E.g., if we decide that stop, unknown and frame can have only default values
> ("*", "X", 0) we could write:
> 
> $peptide = Bio::SeqUtils->translateCDS($seq, 11);
> 
> Nucleotide sequence object and codon table number being the only arguments
> that can be given to the method.
> 
> Shall I add this method into Bio::SeqUtils?
> 
> 	-Heikki
> 
> 
> 
> Jason Stajich wrote:
> > 
> > For some reason - I haven't puzzled through it for now (Heikki can
> > probably clarify why) alternate start codons are fixed only when you
> > specify you expect a fullCDS so do this (add another parameter which is a
> > boolean):
> > 
> > $s->translate("*","X",0,11,1);
> > 
> > You'll get warnings about not finding a stop codon, but I you should get
> > the expected translation.
> > 
> > -j
> > On Wed, 24 Apr 2002, Robson Francisco de Souza wrote:
> > 
> > >
> > >       Hi,
> > >
> > >       I've found that translate function from PrimarySeqI apparently
> > > is not tranlating bacterial start codons to 'M' when the start codon
> > > is different from ATG. Please could someone take a look at my code
> > > and data set (below) and see if I'm doing something wrong?
> > >       Thanks,
> > >                       Robson
> > >
> > > CODE:
> > >
> > > use Bio::SeqIO;
> > > $in = new
> > > Bio::SeqIO(-file=>"/home/rfsouza/20020424.fasta",
> > >            -format=>"fasta");
> > > $out = new Bio::SeqIO(-fh=>\*STDOUT,
> > >                       -format=>fasta);
> > > while ($s = $in->next_seq) {
> > >     print $o->write_seq($s->translate("*","X",0,11));
> > > }
> > >
> > > INPUT:
> > > >NC_002488 Xylella fastidiosa 9a5c, gene:XF0677
> > > TTGATGAGTACAACAAGTACGCGCCAGGGTATTCTGTCGCTCACCCTGAAAGACAGGGCG
> > > GCGCTCTATAGCGCCTATATGATGTATATGCAAAATGGAGCGATTTTCGTCCCTACGCCC
> > > AAACGTTATTTCCTTGGTAACGAAGTATTTTTGTTGCTGACCCTCCCTGATTCCAGCGAG
> > > CGCTTACCGGTTGCTGGAAAAGTGGTCTGGTGTACTCCCGTTGGAGCGCAAGGCAATCGT
> > > GTTGCGGGTATCGGTGTGCAACTGCCCGATGGTCCAGGAGGGGAAGTGGTGCGCAATCGC
> > > ATTGAGACGTTGCTTGCCGGCATGTTCAACTCAGATAAGCCAACGCACACAATG
> > >
> > > OUTPUT:
> > > >NC_002488 Xylella fastidiosa 9a5c, gene:XF0677
> > > LMSTTSTRQGILSLTLKDRAALYSAYMMYMQNGAIFVPTPKRYFLGNEVFLLLTLPDSSE
> > > RLPVAGKVVWCTPVGAQGNRVAGIGVQLPDGPGGEVVRNRIETLLAGMFNSDKPTHTM
> > >
> > > EXPECTED OUTPUT:
> > > >NC_002488 Xylella fastidiosa 9a5c, gene:XF0677
> > > MMSTTSTRQGILSLTLKDRAALYSAYMMYMQNGAIFVPTPKRYFLGNEVFLLLTLPDSSE
> > > RLPVAGKVVWCTPVGAQGNRVAGIGVQLPDGPGGEVVRNRIETLLAGMFNSDKPTHTM
> > >
> > > _______________________________________________
> > > Bioperl-l mailing list
> > > Bioperl-l@bioperl.org
> > > http://bioperl.org/mailman/listinfo/bioperl-l
> > >
> > 
> > --
> > Jason Stajich
> > Duke University
> > jason@cgt.mc.duke.edu
> > 
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l@bioperl.org
> > http://bioperl.org/mailman/listinfo/bioperl-l
> 
> -- 
> ______ _/      _/_____________________________________________________
>       _/      _/                      http://www.ebi.ac.uk/mutations/
>      _/  _/  _/  Heikki Lehvaslaiho          heikki@ebi.ac.uk
>     _/_/_/_/_/  EMBL Outstation, European Bioinformatics Institute
>    _/  _/  _/  Wellcome Trust Genome Campus, Hinxton
>   _/  _/  _/  Cambs. CB10 1SD, United Kingdom
>      _/      Phone: +44 (0)1223 494 644   FAX: +44 (0)1223 494 468
> ___ _/_/_/_/_/________________________________________________________
>