[Bioperl-l] Help in Programming a substitution routine

Torsten Seemann torsten.seemann at infotech.monash.edu.au
Mon Mar 9 15:31:44 EDT 2009


Markus

> #the complete hash is not shown for the sake of clarity
> my(%cod2aa) = (
>    'TCA' => 'S',    # Serine
>    'TCC' => 'S',    # Serine
>    'TCG' => 'S',    # Serine
>    'TCT' => 'S',    # Serine
>    'TTC' => 'F',    # Phenylalanine
>    'TTT' => 'F',    # Phenylalanine
>    'TTA' => 'L',    # Leucine
> );
> my %aa2cod = reverse %cod2aa;

Your hash %cod2aa is many-to-one - it has many keys (codons) which map
to the same value (amino acid).
When you reverse this hash, it will NOT become one-to-many; it will
become one-to-one.
$aa2cod{'S'} will only return ONE value (which one is random and
depends on how Perl orders them).

Is this what you intended?

-- 
--Torsten Seemann
--Victorian Bioinformatics Consortium, Dept. Microbiology, Monash
University, AUSTRALIA



More information about the Bioperl-l mailing list