[Bioperl-l] How to access an array of codons

Bruno Vecchi vecchi.b at gmail.com
Wed Mar 11 10:15:07 UTC 2009


Hi,

I think this will print out what you want.

[%aa2cod declaration here]

foreach my $key (keys %aa2cod) {
   print "@{$aa2cod{$key}}\n";
}

Cheers,

Bruno.

2009/3/11 manni122 <markus.liebscher at gmx.de>

>
> Hi there, if I want to access my hash of arrays %aa2cod I can print out the
> array key and the first value by
>
> for my $key (keys %aa2cod) {
> print "$key => $aa2cod{$key}[0]\n";
> }
>
> How can I find a specific codon within this hash of arrays and extract the
> corresponding array. For instance I am looking for GCA and want to get the
> whole array [GCA GCC GCG GCT].
>
> I appreciate any comment!!
>
>
> my %aa2cod = (
>        'A' => ['GCA', 'GCC', 'GCG', 'GCT'], # Alanine
>        'C' => ['TGC', 'TGT'], # Cysteine
>        'D' => ['GAC', 'GAT'], # Aspartic Acid
>        'E' => ['GAA', 'GAG'], # Glutamic Acid
>        'F' => ['TTC', 'TTT'], # Phenylalanine
>        'G' => ['GGA', 'GGC', 'GGG', 'GGT'], # Glycine
>        'H' => ['CAC', 'CAT'], # Histidine
>        'I' => ['ATA', 'ATC', 'ATT'], # Isoleucine
>        'K' => ['AAA', 'AAG'], # Lysine
>        'L' => ['TTA', 'TTG', 'CTA', 'CTC', 'CTG', 'CTT'], # Leucine
>        'M' => ['ATG'], # Methionine
>        'N' => ['AAC', 'AAT'], # Asparagine
>        'P' => ['CCA', 'CCC', 'CCG', 'CCT'], # Proline
>        'Q' => ['CAA', 'CAG'], # Glutamine
>        'R' => ['CGA', 'CGC', 'CGG', 'CGT', 'AGA', 'AGG'], # Arginine
>        'S' => ['TCA', 'TCC', 'TCG', 'TCT', 'AGC', 'AGT'], # Serine
>        'T' => ['ACA', 'ACC', 'ACG', 'ACT'], # Threonine
>        'V' => ['GTA', 'GTC', 'GTG', 'GTT'], # Valine
>        'W' => ['TGG'], # Tryptophan
>        'Y' => ['TAC', 'TAT'], # Tyrosine
>        '_' => ['TAA', 'TAG', 'TGA'] # Stop
>        );
>
> --
> View this message in context:
> http://www.nabble.com/How-to-access-an-array-of-codons-tp22451211p22451211.html
> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>



More information about the Bioperl-l mailing list