codoncount

Count codons in nucleotide sequence

Syntax

Codons = codoncount(SeqNT)
[Codons, CodonArray] = codoncount(SeqNT)

... = codoncount(SeqNT, ...'Frame', FrameValue, ...)
... = codoncount(SeqNT, ...'Reverse', ReverseValue, ...)
... = codoncount(SeqNT, ...'Ambiguous', AmbiguousValue, ...)
... = codoncount(SeqNT, ...'Figure', FigureValue, ...)
... = codoncount(SeqNT, ...'GeneticCode', GeneticCodeValue, ...)

Input Arguments

SeqNT

One of the following:

Examples: 'ACGT' or [1 2 3 4]

FrameValue

Integer specifying a reading frame in the nucleotide sequence. Choices are 1 (default), 2, or 3.

ReverseValue

Controls the return of the codon count for the reverse complement sequence of the nucleotide sequence specified by SeqNT. Choices are true or false (default).

AmbiguousValue

String specifying how to treat codons containing ambiguous nucleotide characters (R, Y, K, M, S, W, B, D, H, V, or N). Choices are:

  • 'ignore' (default) — Skips codons containing ambiguous characters

  • 'bundle' — Counts codons containing ambiguous characters and reports the total count in the Ambiguous field of the Codons output structure.

  • 'prorate' — Counts codons containing ambiguous characters and distributes them proportionately in the appropriate codon fields containing standard nucleotide characters. For example, the counts for the codon ART are distributed evenly between the AAT and AGT fields.

  • 'warn' — Skips codons containing ambiguous characters and displays a warning.

FigureValue

Controls the display of a heat map of the codon counts. Choices are true or false (default).

GeneticCodeValue

Integer or string specifying a genetic code number or code name from the table Genetic Code. Default is 1 or 'Standard'. You can also specify 'None'.

    Tip   If you use a code name, you can truncate the name to the first two letters of the name.

Output Arguments

CodonsMATLAB structure containing fields for the 64 possible codons (AAA, AAC, AAG, ..., TTG, TTT), which contain the codon counts in SeqNT.
CodonArrayA 4-by-4-by-4 array containing the raw count data for each codon. The three dimensions correspond to the three positions in the codon, and the indices to each element are represented by 1 = A, 2 = C, 3 = G, and 4 = T. For example, the element (2,3,4) in the array contains the number of CGT codons.

Description

Codons = codoncount(SeqNT) counts the codons in SeqNT, a nucleotide sequence, and returns the codon counts in Codons, a MATLAB structure containing fields for the 64 possible codons (AAA, AAC, AAG, ..., TTG, TTT).

  • For sequences that have codons containing the character U, these codons are added to the corresponding codons containing a T.

  • If the sequence contains gaps indicated by a hyphen (-), then codons containing gaps are ignored.

  • If the sequence contains unrecognized characters, then codons containing these characters are ignored, and the following warning message appears:

    Warning: Unknown symbols appear in the sequence. These will be ignored.

[Codons, CodonArray] = codoncount(SeqNT) returns CodonArray, a 4-by-4-by-4 array containing the raw count data for each codon. The three dimensions correspond to the three positions in the codon, and the indices to each element are represented by 1 = A, 2 = C, 3 = G, and 4 = T. For example, the element (2,3,4) in the array contains the number of CGT codons.

... = codoncount(SeqNT, ...'PropertyName', PropertyValue, ...) calls codoncount with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:


... = codoncount(SeqNT, ...'Frame', FrameValue, ...)
counts the codons in the reading frame specified by FrameValue, which can be 1 (default), 2, or 3.

... = codoncount(SeqNT, ...'Reverse', ReverseValue, ...) controls the return of the codon count for the reverse complement sequence of SeqNT. Choices are true or false (default).

... = codoncount(SeqNT, ...'Ambiguous', AmbiguousValue, ...) specifies how to treat codons containing ambiguous nucleotide characters. Choices are:

  • 'ignore' (default)

  • 'bundle'

  • 'prorate'

  • 'warn'

... = codoncount(SeqNT, ...'Figure', FigureValue, ...) controls the display of a heat map of the codon counts. Choices are true or false (default).

... = codoncount(SeqNT, ...'GeneticCode', GeneticCodeValue, ...) controls the overlay of a grid on the heat map figure. The grid groups the synonymous codons according to GeneticCodeValue.

Examples

  • Count the codons in a nucleotide sequence.

    codons = codoncount('AAACGTTA')
    
    codons = 
    
           AAA: 1  ATC: 0  CGG: 0  GCT: 0  TCA: 0 
           AAC: 0  ATG: 0  CGT: 1  GGA: 0  TCC: 0
           AAG: 0  ATT: 0  CTA: 0  GGC: 0  TCG: 0
           AAT: 0  CAA: 0  CTC: 0  GGG: 0  TCT: 0
           ACA: 0  CAC: 0  CTG: 0  GGT: 0  TGA: 0
           ACC: 0  CAG: 0  CTT: 0  GTA: 0  TGC: 0
           ACG: 0  CAT: 0  GAA: 0  GTC: 0  TGG: 0
           ACT: 0  CCA: 0  GAC: 0  GTG: 0  TGT: 0
           AGA: 0  CCC: 0  GAG: 0  GTT: 0  TTA: 0
           AGC: 0  CCG: 0  GAT: 0  TAA: 0  TTC: 0
           AGG: 0  CCT: 0  GCA: 0  TAC: 0  TTG: 0
           AGT: 0  CGA: 0  GCC: 0  TAG: 0  TTT: 0
           ATA: 0  CGC: 0  GCG: 0  TAT: 0  
    
  • Count the codons in the second frame for the reverse complement of a sequence.

    r2codons = codoncount('AAACGTTA','Frame',2,'Reverse',true)
    
    r2codons = 
    
           AAA: 0  ATC: 0  CGG: 0  GCT: 0  TCA: 0 
           AAC: 1  ATG: 0  CGT: 0  GGA: 0  TCC: 0
           AAG: 0  ATT: 0  CTA: 0  GGC: 0  TCG: 0
           AAT: 0  CAA: 0  CTC: 0  GGG: 0  TCT: 0
           ACA: 0  CAC: 0  CTG: 0  GGT: 0  TGA: 0
           ACC: 0  CAG: 0  CTT: 0  GTA: 0  TGC: 0
           ACG: 0  CAT: 0  GAA: 0  GTC: 0  TGG: 0
           ACT: 0  CCA: 0  GAC: 0  GTG: 0  TGT: 0
           AGA: 0  CCC: 0  GAG: 0  GTT: 1  TTA: 0
           AGC: 0  CCG: 0  GAT: 0  TAA: 0  TTC: 0
           AGG: 0  CCT: 0  GCA: 0  TAC: 0  TTG: 0
           AGT: 0  CGA: 0  GCC: 0  TAG: 0  TTT: 0
           ATA: 0  CGC: 0  GCG: 0  TAT: 0  
    
  • Create a heat map of the codons in a random nucleotide sequence and overlay a grid that groups the synonymous codons according to the Standard genetic code.

    a = randseq(1000);
    codoncount(a,'Figure', true);

Was this topic helpful?