Faster Algorithms for RNA-folding using the Four-Russians method

Balaji Venkatachalam, Dan Gusfield, Yelena Frid

Abstract

Predicting RNA secondary structure is a computationally intensive task, traditionally handled by the $O(n^3)$ Nussinov algorithm. This paper introduces a "two-vector" refinement of the Four-Russians method that optimizes this process by pre-calculating subproblem solutions into lookup tables. This approach simplifies the algorithm, avoids redundant computations, and enables efficient GPU parallelization. Experimental results show a 20x speedup over the standard Nussinov algorithm and a 3x improvement over previous Four-Russians implementations, with a GPU-based version processing 6,000-base sequences in just 2.5 seconds.

Introduction

Predicting how an RNA molecule folds—its secondary structure—is a fundamental task in bioinformatics because a molecule's shape largely dictates its biological function. The standard tool for this is the Nussinov algorithm, a dynamic programming (DP) approach that maximizes the number of base pairs. However, the Nussinov algorithm has a computational complexity of $O(n^3)$, where $n$ is the sequence length. As genomic datasets grow, this cubic scaling becomes a massive bottleneck.

While previous researchers (Frid and Gusfield) applied the "Four-Russians" technique to reduce this complexity to $O(n^3 / \log n)$, their implementation was complex and involved interleaving the preprocessing with the main computation, leading to significant redundant work. This paper proposes a simplified "two-vector" method that streamlines the Four-Russians application for both serial and parallel environments.

The Two-Vector Method

The authors propose a more efficient application of the Four-Russians technique based on several key innovations:

  1. The Unit-Change Property: The authors prove that consecutive cells in the Nussinov DP table differ by at most 1. This allows them to represent a block of $q$ cells using a single base value and a binary "difference vector."
  2. One-Pass Preprocessing: Unlike previous versions that preprocessed data on the fly, this method exhaustively solves all possible pairs of difference vectors of length $q$ and stores them in a lookup table ($R$) before starting the main algorithm. This avoids the overhead of interleaved computation.
  3. Lookup vs. Calculation: During the main DP phase, instead of calculating every cell individually, the algorithm takes "longer strides," retrieving the maximum values for entire blocks from the lookup table in constant time.
Partitioning of the Nussinov dynamic programming table into blocks for the Four-Russians method.
  1. Parallelization (CUDA): The authors adapted this logic for GPUs, achieving a theoretical bound of $O(n^2 / \log n)$. To satisfy the hardware requirements of NVIDIA's CUDA architecture, they organized data structures to ensure "memory coalescence"—arranging row-vectors in row-major order and column-vectors in column-major order so the GPU can fetch data for multiple threads in a single cycle.

Experimental Evaluation

The algorithms were evaluated using complete mouse non-coding RNA sequences, random substrings from real RNA, and synthetic random strings. Sequence lengths ranged from 2,000 to 6,150 bases.

Key Results

  • Serial Performance: The two-vector method is roughly 20x faster than the standard Nussinov algorithm and 3x faster than the previous state-of-the-art Four-Russians (FG) algorithm. This confirms that moving preprocessing to the start significantly reduces practical overhead.
  • GPU Performance: On an NVIDIA Tesla C2070, the parallel algorithm folded a 6,000-base sequence in 2.5 seconds. For comparison, the standard serial Nussinov algorithm took over 17 minutes (1,027 seconds) on a desktop CPU for a similar length.
  • Scaling: The speedup factor improves as the sequence length increases, confirming that the $1 / \log n$ reduction in complexity provides real-world benefits for large-scale genomic data.

Discussion and Future Work

While the two-vector method provides a significant performance leap, it currently focuses on the Nussinov model, which only counts the number of base pairs. Most modern RNA folding tools use more complex "Nearest Neighbor" energy models (like the Zuker algorithm). Extending the two-vector method to these energy-based models is a logical next step. Additionally, the current algorithm does not account for pseudoknots, though the authors suggest their method could potentially be adapted for such complex structures. Finally, while the lookup table is small, the memory requirements for the DP table itself remain $O(n^2)$, which may limit the maximum sequence length on GPUs with limited RAM.

Summary updated

BibTeX
@article{venkatachalam2014faster,
  author = {Balaji Venkatachalam and Dan Gusfield and Yelena Frid},
  title = {{Faster Algorithms for RNA-folding using the Four-Russians method}},
  journal = {Algorithms Mol. Biol.},
  year = {2014},
  doi = {10.1186/1748-7188-9-5},
}
Figure