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

manni122 markus.liebscher at gmx.de
Thu Mar 12 04:36:28 EDT 2009


>From the first entries I thought it wasn't possible ...
But now!
Thank you for helping,
Markus



Smithies, Russell wrote:
> 
> Might be a bit hacky but how about a temp hash for the reverse lookup?
> 
> 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
> 	);
> 
> 
> foreach $cod (keys %aa2cod) {
>     map{$cod2aa{$_} = $cod }(@{$aa2cod{$cod}});
> }
> 
> print join ",", @{$aa2cod{$cod2aa{GCA}}} ,"\n";
> 
> 
> 
> --Russell Smithies 
> 
> Bioinformatics Applications Developer 
> T +64 3 489 9085 
>russell.smithies at agresearch.co.nz 
> 
> Invermay  Research Centre 
> Puddle Alley, 
> Mosgiel, 
> New Zealand 
> T  +64 3 489 3809   
> F  +64 3 489 9174  
> www.agresearch.co.nz 
> 
> 
> --Russell
> 
> 
> 
>> -----Original Message-----
>> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
>> bounces at lists.open-bio.org] On Behalf Of manni122
>> Sent: Thursday, 12 March 2009 1:37 a.m.
>> To: Bioperl-l at lists.open-bio.org
>> Subject: Re: [Bioperl-l] How to access an array of codons
>> 
>> 
>> thanks for helping me. I understand!
>> Cheers, Markus.
>> 
>> 
>> 
>> manni122 wrote:
>> >
>> > 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-tp22451211p22454228.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
> =======================================================================
> Attention: The information contained in this message and/or attachments
> from AgResearch Limited is intended only for the persons or entities
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipients is prohibited by AgResearch
> Limited. If you have received this message in error, please notify the
> sender immediately.
> =======================================================================
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-access-an-array-of-codons-tp22451211p22471256.html
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.




More information about the Bioperl-l mailing list