Class: GeneticCode

Inherits:
Object
  • Object
show all
Defined in:
lib/genetic_code.rb

Constant Summary collapse

MAP =
{
  :alanine => [ :GCT, :GCC, :GCA, :GCG ],
  :leucine => [ :TTA, :TTG, :CTT, :CTC, :CTA, :CTG ],
  :arginine => [ :CGT, :CGC, :CGA, :CGG, :AGA, :AGG ],
  :lysine => [ :AAA, :AAG ],
  :asparagine => [ :AAT, :AAC ],
  :methionine => [ :ATG ],
  :aspartic_acid => [ :GAT, :GAC ],
  :phenylalinine => [ :TTT, :TTC ],
  :cysteine => [ :TGT, :TGC ],
  :proline => [ :CCT, :CCC, :CCA, :CCG ],
  :glutamine => [ :CAA, :CAG ],
  :serine => [ :TCT, :TCC, :TCA, :TCG, :AGT, :AGC ],
  :glutamic_acid => [ :GAA, :GAG ],
  :threonine => [ :ACT, :ACC, :ACA, :ACG ],
  :gylcine => [ :GGT, :GGC, :GGA, :GGG ],
  :tryptophan => [ :TGG ],
  :histidine => [ :CAT, :CAC ],
  :tyrosine => [ :TAT, :TAC ],
  :isoleucine => [ :ATT, :ATC, :ATA ],
  :valine => [ :GTT, :GTC, :GTA, :GTG ],
  :stop => [ :TAA, :TGA, :TAG ]
}

Class Method Summary collapse

Class Method Details

.aa_for(codon) ⇒ Object



32
33
34
35
36
37
# File 'lib/genetic_code.rb', line 32

def aa_for codon
  aa = MAP.keys.find do |aa|
    MAP[aa].include? codon
  end
  AminoAcid[aa] if aa
end

.codons_for(aa) ⇒ Object



28
29
30
# File 'lib/genetic_code.rb', line 28

def codons_for aa
  MAP[aa]
end