[Bioperl-l] Codon Table
Heikki Lehvaslaiho
heikki at nildram.co.uk
Sat Oct 25 10:44:14 EDT 2003
Mick,
The PrimarySeq::translate interface is a mess, so adding one more
attribute the the end of the long list is not going to make much a
difference. I added the code into CVS.
-Heikki
On Fri, 2003-10-17 at 14:51, Heikki Lehvaslaiho wrote:
> Mick,
>
> I really have not thought about this possibility. CodonTable can easily
> be modified, but there is no way of passing the modified codontable
> object to sequence::translate. The translate function has really complex
> argument list already, so there is no way we can add anything in there.
>
> Depending what you want to do, it might be enough to modify the
> codontable object and use its translate function. Compare it to
> Bio::PrimarySeqI::translate to see what I mean. If you need full
> seq::translate functionality, Bio::SeqUtils is the place to put the
> code, e.g. $polypept = Bio::SeqUtils::translate($seq, $codontable);
>
> I wrote the following method to be added into Bio::Tools::CodonTable. If
> you think it is useful, I can commit it.
>
> Yours,
> -Heikki
>
>
> =head2 add_table
>
> Title : add_table
> Usage : $newid = $ct->add_table($name, $table, $starts)
> Function: Add a custom Codon Table into the object.
> Know what you are doing, only the length of
> the argument strings is checked!
> Returns : the id of the new codon table
> Args : name, a string, optional (can be empty)
> table, a string of 64 characters
> startcodons, a string of 64 characters, defaults to standard
>
> =cut
>
> sub add_table {
> my ($self, $name, $table, $starts) = @_;
>
> $name ||= 'Custom'. scalar @NAMES + 1;
> $starts ||= $STARTS[0];
> $self->throw('Suspect input!')
> unless length($table) == 64 and length($starts) == 64;
>
> push @NAMES, $name;
> push @TABLES, $table;
> push @STARTS, $starts;
>
> return scalar @NAMES;
>
> }
>
> usage:
>
> $ct_id = $ct->add_table(@custom_table);
> $ct->id($ct_id);
> $string = $ct->translate($nt_string);
>
>
>
>
>
>
> On Tue, 2003-10-14 at 17:03, michael watson (IAH-C) wrote:
> > Hi
> >
> > I want to use a different codon table than any that are present in CodonTable.pm. Does Bioperl have a way to implement this? Or will I have to hack CodonTable.pm?
> >
> > Thanks
> > Mick
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at portal.open-bio.org
> > http://portal.open-bio.org/mailman/listinfo/bioperl-l
--
______ _/ _/_____________________________________________________
_/ _/ http://www.ebi.ac.uk/mutations/
_/ _/ _/ Heikki Lehvaslaiho heikki_at_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
___ _/_/_/_/_/________________________________________________________
More information about the Bioperl-l
mailing list