Abstract
Predicting RNA secondary structure is essential for understanding biological function. Traditional partition function-based methods, which capture the ensemble of possible structures, suffer from $O(n^3)$ time complexity, limiting their application to long sequences. We present LinearPartition, the first algorithm to approximate these values in linear time. By employing a beam pruning heuristic within a left-to-right scanning framework, LinearPartition achieves significant speedups and memory efficiency while maintaining, and in some cases improving, prediction accuracy for long-range base pairs.
Introduction
RNA molecules exist in an equilibrium ensemble of structures rather than a single minimum free energy (MFE) state. Partition function-based methods, such as the McCaskill algorithm, are used to calculate the probability of every possible base pair within this ensemble. However, the cubic scaling ($O(n^3)$) of these classical algorithms makes the analysis of long sequences—like human mRNAs or viral genomes—computationally prohibitive. For instance, a sequence of 30,000 nucleotides can take days to process using standard tools.
Methods
LinearPartition adapts the "beam search" strategy from LinearFold to the partition function problem. Unlike traditional "bottom-up" dynamic programming, LinearPartition utilizes a left-to-right scanning approach. At each nucleotide, the algorithm maintains a "beam" of the top $b$ most promising partial structures, pruning away low-probability states.
As shown in the table above, this pruning reduces complexity from $O(n^3)$ to $O(nb^2)$. With $b$ as a constant, runtime and memory usage scale linearly ($O(n)$). The algorithm computes both "inside" and "outside" phases to derive the full partition function and specific base-pairing probabilities.
Key Results
LinearPartition demonstrates dramatic improvements in computational efficiency without sacrificing accuracy. On a sequence of approximately 32,000 nucleotides, it achieved a 2,771x speedup over CONTRAfold, completing in 1.3 minutes compared to 2.5 days.
The linear scaling of both runtime and memory (Figure 6) allows LinearPartition to handle sequences exceeding 100,000 nucleotides, which typically cause $O(n^3)$ tools to fail. Furthermore, the pruning heuristic acts as a form of regularization, leading to higher accuracy in predicting long-distance base pairs (>500 nt) compared to exact methods, which can be sensitive to "noise" in the full ensemble.
Discussion and Insights
A critical observation of this work is that "linearity is natural" in RNA folding. The number of base pairs with significant probability grows linearly with sequence length, suggesting that the vast majority of the $O(n^3)$ search space in traditional algorithms is irrelevant. Unlike local folding methods that restrict the search window, LinearPartition is a global algorithm, capable of identifying interactions across the entire length of a molecule.
Conclusion
LinearPartition provides a scalable solution for RNA ensemble analysis, enabling the study of long-range interactions in large transcripts and viral genomes. Future work will focus on extending this linear-time framework to pseudoknot prediction and multi-molecule interactions.
Summary updated