function a = getMnemonic(s)
% Returns the 3-letter mnemonic of an amino acid.
% s is a length 3 row vector of chars. If it specifies an amino acid, then
% a is the amino acid's 3-letter mnemonic. Otherwise a is empty char array.

a= '';
C= codonDictionary(); % C is matrix of chars
nr= size(C, 1);
r= 1;
while r <= nr && ~strcmp(s, C(r, 1:3))
r= r+1;
end
if r <= nr
a= C(r, 5:7);
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function C = codonDictionary()
% C is a 61-by-7 character array.
% For r=1:61, C(r,1:3) specifies a codon and C(r,5:7) is the
% corresponding amino acid.
C = [ 'GCT Ala' ; 'GCC Ala' ; 'GCA Ala' ; 'GCG Ala' ;...
'CGT Arg' ; 'CGC Arg' ; 'CGA Arg' ; 'CGG Arg' ; 'AGA Arg' ; 'AGG Arg';...
'AAT Asn' ; 'AAC Asn' ;...
'GAT Asp' ; 'GAC Asp' ;...
'TGT Cys' ; 'TGC Cys' ;...
'CAA Glu' ; 'CAG Glu' ;...
'GAA Gln' ; 'GAG Gln' ;...
'GGT Gly' ; 'GGC Gly' ; 'GGA Gly' ; 'GGG Gly' ;...
'CAT His' ; 'CAC His' ;...
'ATT Ile' ; 'ATC Ile' ; 'ATA Ile' ;...
'CTT Leu' ; 'CTC Leu' ; 'CTA Leu' ; 'CTG Leu' ; 'TTA Leu' ; 'TTG Leu' ;...
'AAA Lys' ; 'AAG Lys' ;...
'ATG Met' ;...
'TTT Phe' ; 'TTC Phe' ;...
'CCT Pro' ; 'CCC Pro' ; 'CCA Pro' ; 'CCG Pro' ;...
'TCT Ser' ; 'TCC Ser' ; 'TCA Ser' ; 'TCG Ser' ; 'AGT Ser' ; 'AGC Ser' ;...
'ACT Thr' ; 'ACC Thr' ; 'ACA Thr' ; 'ACG Thr' ;...
'TGG Trp' ;...
'TAT Tyr' ; 'TAC Tyr' ;...
'GTT Val' ; 'GTC Val' ; 'GTA Val' ; 'GTG Val' ];