Convert amino acid sequence from letter to integer representation


SeqInt = aa2int(SeqChar)

Input Arguments


One of the following:

Output Arguments

SeqIntAmino acid sequence specified by a row vector of integers.


SeqInt = aa2int(SeqChar) converts SeqChar, a character string of single-letter codes specifying an amino acid sequence, to SeqInt, a row vector of integers specifying the same amino acid sequence. For valid letter codes, see the table Mapping Amino Acid Letter Codes to Integers.

Mapping Amino Acid Letter Codes to Integers

Amino AcidCodeInteger
Alanine A1
Arginine R2
Asparagine N3
Aspartic acid (Aspartate) D4
Cysteine C5
Glutamine Q6
Glutamic acid (Glutamate) E7
Glycine G8
Histidine H9
Isoleucine I10
Leucine L11
Lysine K12
Methionine M13
Phenylalanine F14
Proline P15
Tryptophan W18
Tyrosine Y19
Valine V20
Asparagine or Aspartic acid (Aspartate) B21
Glutamine or Glutamic acid (Glutamate)Z22
Unknown amino acid (any amino acid) X23
Translation stop *24
Gap of indeterminate length -25
Unknown character (any character or symbol not in table) ?0


Converting a Simple Sequence

Convert the sequence of letters MATLAB to integers.

SeqInt = aa2int('MATLAB') 

SeqInt =

   13    1   17   11    1   21

Converting a Random Sequence

  1. Create a random string to represent an amino acid sequence.

    SeqChar = randseq(20, 'alphabet', 'amino')
    SeqChar =
  2. Convert the amino acid sequence from letter to integer representation.

    SeqInt = aa2int(SeqChar)
    SeqInt =
      Columns 1 through 13 
         4  18   5  22  17   7   5   1  12  14   0   7   5
      Columns 14 through 20 
        20  10  14   5   9   4  16
Was this topic helpful?