This is machine translation

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


Count n-mers in nucleotide or amino acid sequence


Nmer = nmercount(Seq, Length)
Nmer = nmercount(Seq, Length, C)

Input Arguments


One of the following:


Integer specifying the length of n-mer to count.

Output Arguments

NmerCell array containing the n-mer counts in Seq.


Nmer = nmercount(Seq, Length) counts the n-mers or patterns of a specific length in Seq, a nucleotide sequence or amino acid sequence, and returns the n-mer counts in a cell array.

Nmer = nmercount(Seq, Length, C) returns only the n-mers with cardinality of at least C.


  1. Use the getgenpept function to retrieve the amino acid sequence for the human insulin receptor.

    S = getgenpept('AAA59174','SequenceOnly',true);
  2. Count the number of four-mers in the amino acid sequence and display the first 20 rows in the cell array.

    nmers = nmercount(S,4);
    ans = 
        'APES'    [2]
        'DFRD'    [2]
        'ESLK'    [2]
        'FRDL'    [2]
        'GNYS'    [2]
        'LKEL'    [2]
        'SHCQ'    [2]
        'SLKD'    [2]
        'SVRI'    [2]
        'TDYL'    [2]
        'TSLA'    [2]
        'TVIN'    [2]
        'VING'    [2]
        'VPLD'    [2]
        'YALV'    [2]
        'AAAA'    [1]
        'AAAP'    [1]
        'AAEI'    [1]
        'AAEL'    [1]
        'AAFP'    [1]

Introduced before R2006a

Was this topic helpful?