Main Content

rnaplot

Draw secondary structure of RNA sequence

Syntax

rnaplot(RNA2ndStruct)
ha = rnaplot(RNA2ndStruct)
[ha, H] = rnaplot(RNA2ndStruct)
rnaplot(RNA2ndStruct, ...'Sequence', SequenceValue, ...)
rnaplot(RNA2ndStruct, ...'Format', FormatValue, ...)
rnaplot(RNA2ndStruct, ...'Selection', SelectionValue, ...)
rnaplot(RNA2ndStruct, ...'ColorBy', ColorByValue, ...)

Input Arguments

RNA2ndStruct

Secondary structure of an RNA sequence represented by either:

  • Character vector or string specifying bracket notation

  • Connectivity matrix

Tip

Use the rnafold function to create RNA2ndStruct.

SequenceValue

Sequence of the RNA secondary structure being plotted, specified by either of the following:

  • Character vector or string

  • Structure containing a Sequence field that contains an RNA sequence

This information is used in the data tip displayed by clicking a base in the plot of the RNA secondary structure RNA2ndStruct. This information is required if you specify the 'Diagram' format or if you specify to highlight any of the following paired selections: 'AU', 'UA', 'GC', 'CG', 'GU' or 'UG'.
FormatValue

Character vector or string specifying the format of the plot. Choices are:

  • 'Circle' (default)

  • 'Diagram'

  • 'Dotdiagram'

  • 'Graph'

  • 'Mountain'

  • 'Tree'

Note

If you specify 'Diagram', you must also use the 'Sequence' property to provide the RNA sequence.

SelectionValue

Either of the following:

  • Numeric array specifying the indices of residues to highlight in the plot.

  • Character vector or string specifying the subset of residues to highlight in the plot. Choices are:

    • 'Paired'

    • 'Unpaired'

    • 'AU' or 'UA'

    • 'GC' or 'CG'

    • 'GU' or 'UG'

Note

If you specify 'AU', 'UA', 'GC', 'CG', 'GU', or 'UG', you must also use the 'Sequence' property to provide the RNA sequence.

ColorByValue

Character vector or string specifying a color scheme for the plot. Choices are:

  • 'State' (default) — Color by pair state: paired bases and unpaired bases.

  • 'Residue' — Color by residue type (A, C, G, and U).

  • 'Pair' — Color by pair type (AU/UA, GC/CG, and GU/UG).

Note

If you specify 'residue' or 'pair', you must also use the 'Sequence' property to provide the RNA sequence.

Note

Because internal nodes of a tree correspond to paired residues, you cannot specify 'residue' if you specify 'Tree' for the 'Format' property.

Output Arguments

haHandle to the figure axis.
HA structure of handles containing a subset of the following fields, based on what you specify for the 'Selection' and 'ColorBy' properties:
  • Paired

  • Unpaired

  • A

  • C

  • G

  • U

  • AU

  • GC

  • GU

  • Selected

Description

rnaplot(RNA2ndStruct) draws the RNA secondary structure specified by RNA2ndStruct, the secondary structure of an RNA sequence represented by a character vector or string specifying bracket notation or a connectivity matrix.

ha = rnaplot(RNA2ndStruct) returns ha, a handle to the figure axis.

[ha, H] = rnaplot(RNA2ndStruct) also returns H, a structure of handles, which you can use to graph elements in a MATLAB® Figure window.

Tip

Use the handles returned in H to change properties of the graph elements, such as color, marker size, and marker type.

H contains a subset of the following fields, based on what you specify for the 'Selection' and 'ColorBy' properties.

FieldDescription
PairedHandles to all paired residues
UnpairedHandles to all unpaired residues
AHandles to all A residues
CHandles to all C residues
GHandles to all G residues
UHandles to all U residues
AUHandles to all AU or UA pairs
GCHandles to all GC or CG pairs
GUHandles to all GU or UG pairs
SelectedHandles to all selected residues

rnaplot(RNA2ndStruct, ...'PropertyName', PropertyValue, ...) calls rnaplot 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:

rnaplot(RNA2ndStruct, ...'Sequence', SequenceValue, ...) draws the RNA secondary structure specified by RNA2ndStruct, and annotates it with the sequence positions supplied by SequenceValue, the RNA sequence specified by a character vector, string, or a structure containing a Sequence field.

rnaplot(RNA2ndStruct, ...'Format', FormatValue, ...) draws the RNA secondary structure specified by RNA2ndStruct, using the format specified by FormatValue.

FormatValue is a character vector or string specifying the format of the plot. Choices are as follows.

FormatDescription
'Circle' (default)

Each base is represented by a dot on the circumference of a circle of arbitrary size. Lines connect bases that pair with each other.

'Diagram'

Two-dimensional representation of the RNA secondary structure. Each base is represented and identified by a letter. The backbone and hydrogen bonds between base pairs are represented by lines.

Note

If you specify 'Diagram', you must also use the 'Sequence' property to provide the RNA sequence.

'Dotdiagram'

Two-dimensional representation of the RNA secondary structure. Each base is represented and identified by a dot. The backbone and hydrogen bonds between base pairs are represented by lines.

'Graph'

Bases are displayed in their sequence position along the abscissa (x-axis) of a graph. Semi-elliptical lines connect bases that pair with each other. The height of the lines is proportional to the distance between paired bases.

'Mountain'

Each base is represented by a dot in a two-dimensional plot, where the base position is in the abscissa (x-axis) and the number of base pairs enclosing a given base is in the ordinate (y-axis).

'Tree'

Each base is represented by a node in a tree graph. Leaf nodes indicate unpaired bases, while each internal node indicates a base pair. The tree root is a fictitious node, not associated with any base in the secondary structure.

rnaplot(RNA2ndStruct, ...'Selection', SelectionValue, ...) draws the RNA secondary structure specified by RNA2ndStruct, highlighting a subset of residues specified by SelectionValue. SelectionValue can be either:

  • Numeric array specifying the indices of residues to highlight in the plot.

  • Character vector or string specifying the subset of residues to highlight in the plot. Choices are:

    • 'Paired'

    • 'Unpaired'

    • 'AU' or 'UA'

    • 'GC' or 'CG'

    • 'GU' or 'UG'

Note

If you specify 'AU', 'UA', 'GC', 'CG', 'GU', or 'UG', you must also use the 'Sequence' property to provide the RNA sequence.

rnaplot(RNA2ndStruct, ...'ColorBy', ColorByValue, ...) draws the RNA secondary structure specified by RNA2ndStruct, using a color scheme specified by ColorByValue, a character vector or string indicating a color scheme. Choices are:

  • 'State' (default) — Color by pair state: paired bases and unpaired bases.

  • 'Residue' — Color by residue type (A, C, G, and U).

  • 'Pair' — Color by pair type (AU/UA, GC/CG, and GU/UG).

Note

If you specify 'Residue' or 'Pair', you must also use the 'Sequence' property to provide the RNA sequence.

Note

Because internal nodes of a tree correspond to paired residues, you cannot specify 'Residue' if you specify 'Tree' for the 'Format' property.

Examples

  1. Determine the minimum free-energy secondary structure of an RNA sequence and plot it in circle format:

    seq = 'GCGCCCGUAGCUCAAUUGGAUAGAGCGUUUGACUACGGAUCAAAAGGUUAGGGGUUCGACUCCUCUCGGGCGCG';
    ss = rnafold(seq);
    rnaplot(ss)

  2. Plot the RNA sequence secondary structure in graph format and color it by pair type.

    rnaplot(ss, 'sequence', seq, 'format', 'graph', 'colorby', 'pair')

  3. Plot the RNA sequence secondary structure in mountain format and color it by residue type. Use the handle to add a title to the plot.

    ha = rnaplot(ss, 'sequence', seq, 'format', 'mountain',...
                 'colorby', 'residue')
    title(ha, 'Bacillus halodurans, tRNA Arg')

  4. Mutate the first six positions in the sequence and observe the effect the change has on the secondary structure by highlighting the first six residues.

    seqMut = seq;
    seqMut(1:6) = 'AAAAAA';
    ssMut = rnafold(seqMut);
    rnaplot(ss, 'sequence', seq, 'format', 'dotdiagram', 'selection', 1:6);
    rnaplot(ssMut, 'sequence', seqMut, 'format', 'dotdiagram', 'selection', 1:6);

Tip

If necessary, click-drag the legend to prevent it from covering the plot. Click a base in the plot to display a data tip with information on that base.

Version History

Introduced in R2007b