This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


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 vector 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


collapse all

Create a random amino acid sequence.

seq = randseq(20,'alphabet','amino')
seq =


Convert the sequence from letter to integer representation.

seqInt = aa2int(seq)
seqInt =

  1×20 uint8 row vector

  Columns 1 through 15

   17   19    3   19   13    2    6   11   20   20    4   20   20   10   17

  Columns 16 through 20

    3    9   19   16   20

Introduced before R2006a

Was this topic helpful?