
Compare RNA secondary structures by base-pair and tree distance. Learn more
Input
What is RNAdistance?
RNAdistance is a ViennaRNA command-line program for comparing RNA secondary structures as edit distances. It converts dot-bracket structures into one of several structural representations, then measures how many tree or string editing operations separate them. Its P representation instead reports base-pair distance, the count of base pairs present in one structure but absent from the other.
The program is useful when a predicted structure must be compared with a reference, or when two folding conditions, sequence variants, or prediction methods produce alternative folds. A distance of zero means the two inputs are identical under the selected representation. Larger values mean more structural dissimilarity, but they are not free energies, probabilities, or a universal quality score.
RNAdistance originated in the ViennaRNA Package, which provides secondary-structure prediction and analysis methods. The ProteinIQ tool runs ViennaRNA 2.7.2 and retains its native distance and comparison directives.
How to use RNAdistance online
ProteinIQ compares two RNA secondary structures online. Enter one valid dot-bracket structure in each input, select the native distance representation and comparison mode, then receive a results table containing the distance value for each requested code. Optional backtracking returns a downloadable alignment that highlights matched structural subtrees.
Inputs
| Input | Description |
|---|---|
Structure 1 | First RNA secondary structure in dot-bracket notation. Use ( and ) for paired nucleotides and . for unpaired nucleotides. |
Structure 2 | Second dot-bracket structure to compare. For a direct base-pair comparison, it should describe the same aligned RNA and have the same length as Structure 1. |
For example, (((...))) and ((.....)) describe structures of the same nine-nucleotide RNA with different stem lengths. The inputs contain structure notation only, not RNA sequences. Both strings must have balanced parentheses and no unsupported symbols.
RNAdistance is commonly run after RNAfold has generated an MFE structure, or alongside RNAsubopt to quantify how much suboptimal folds differ from a selected reference. When a sequence and a proposed structure need an energy check before comparison, RNAeval evaluates their thermodynamic compatibility.
Settings
| Setting | Description |
|---|---|
Distance | One or more native distance codes. The default, f, calculates tree-edit distance on the full secondary-structure representation. Multiple characters request multiple measures. |
Compare mode | Native comparison directive. p is the default pairwise comparison of Structure 1 and Structure 2. |
Write backtrack output | Writes the native edit alignment to a downloadable file. It is meaningful for tree or string edit representations, not the P base-pair distance. |
The available distance codes describe two separate choices: structural representation and comparison algorithm.
| Code | Representation and algorithm |
|---|---|
f | Full secondary structure, compared by tree editing. This is the default. |
h | HIT representation, which groups structural elements such as hairpins, interior loops, bulges, multiloops, stacks, and exterior regions, compared by tree editing. |
w | Weighted coarse representation, compared by tree editing. Structural element counts contribute to the representation. |
c | Coarse representation, compared by tree editing. |
F, H, W, C | The corresponding full, HIT, weighted coarse, or coarse representation compared by string alignment instead of tree editing. |
P | Base-pair distance. Each differing base pair contributes one unit. |
The code string is order-sensitive in the results table. For example, fP returns one row for full-tree edit distance and one row for base-pair distance.
p fits ProteinIQ's two-structure form and should be used for a direct comparison. ViennaRNA also defines m for an all-against-all lower-triangular matrix, f for comparing every later input against the first, and c for consecutive comparisons. Those directives are designed for a stream of more than two structures, while this page supplies exactly one structure in each slot.
Results
| Result column | Meaning |
|---|---|
Structure 1 ID | Identifier assigned to the first submitted structure. |
Structure 2 ID | Identifier assigned to the second submitted structure. |
Distance Code | The requested native representation code, such as f or P. |
Compare Mode | The native comparison directive used for the run. |
Distance Value | Numeric distance returned for that representation. Lower values indicate greater structural similarity within the same code. |
When backtracking is enabled, the Files tab includes the native alignment output. Gaps in that file show the edit path selected for matching structural subtrees or strings. It explains how the selected edit algorithm relates the representations, but it is not a nucleotide sequence alignment and should not be read as a base-by-base biological homology result.
How RNAdistance works
Dot-bracket notation encodes base pairs directly. RNAdistance can retain that detailed structure, transform it into the hierarchy of loops and stems used by the HIT and coarse representations, or reduce the comparison to its base-pair set. Tree-edit modes measure the cost of changing one structural tree into another through insertions, deletions, and relabeling operations. Uppercase codes use string alignment on the same representations instead.
Base-pair distance is the most direct option when both inputs annotate the same nucleotide positions. It counts nonshared pairs and ignores how those differences are organized into larger motifs. Tree and string measures can be more informative when the question concerns topology, such as whether a mutation has converted one multiloop arrangement into another, but their values depend on the chosen representation and should only be compared across runs using the same code.
Interpreting structural distances
There is no general cutoff for a “good” RNAdistance result. A value must be judged against the RNA length, the chosen representation, and the comparison question.
- Use
Pfor exact base-pair disagreement: It provides a transparent count for two structures of the same length. APvalue of6means six base pairs are present in only one of the two structures. - Use
fwhen fine structural detail matters: The full tree representation preserves more detail than the coarse forms, so it is a useful default for comparing predicted folds of the same RNA. - Use
h,w, orcfor motif-level comparisons: Coarser representations reduce sensitivity to individual pair changes and emphasize the arrangement of stems and loops. - Do not compare values across codes as if they share units: A lower
cvalue thanfvalue does not establish that the structures are more similar under one method. The values arise from different representations and edit calculations.
For a visual inspection of either submitted structure, RNAplot renders a supplied sequence-structure pair. RNAdistance quantifies a structural difference; it does not determine which structure is thermodynamically favored or experimentally correct.
Related tools

RAxML-NG
Perform maximum-likelihood phylogenetic tree inference with RAxML-NG for aligned protein, DNA, or binary character data. Supports ML search, bootstrap analysis, and native automatic model-family selection.

RNAdos
RNAdos calculates density-of-states summaries for RNA sequences, reporting representative structures and state counts across energy bands.

RNAduplex
RNAduplex computes the hybridization structure between two RNA sequences. Predicts the optimal duplex formation and binding energy.

RNAeval
RNAeval calculates the free energy of an RNA secondary structure for a given sequence. Evaluates if a proposed structure is thermodynamically favorable.

RNAfold
RNAfold predicts RNA secondary structure using minimum free energy (MFE) algorithms and optionally returns partition-function ensemble metrics when explicitly enabled.

RNALfold
RNALfold reports locally stable RNA secondary structures within a sliding window and returns their start and end positions on the input sequence.

RNAplex
RNAplex predicts fast query-target RNA interactions, reporting parsed hit coordinates, structures, and energies.

RNAplfold
RNAplfold computes local base pair probabilities using a sliding window approach. Useful for analyzing accessibility and identifying binding sites in long RNA sequences.

RNAplot
RNAplot renders ViennaRNA secondary-structure plot files from a supplied RNA sequence and dot-bracket structure.

RNAsubopt
RNAsubopt enumerates all RNA secondary structures within a specified energy range above the minimum free energy (MFE). Useful for exploring the structural ensemble and identifying alternative conformations.