We describe a dynamic programming algorithm for predicting optimal RNA seco
ndary structure, including pseudoknots. The algorithm has a worst case comp
lexity of O(N-6) in time and O(N-4) in storage. The description of the algo
rithm is complex, which led us to adopt a useful graphical representation (
Feynman diagrams) borrowed from quantum field theory. We present an impleme
ntation of the algorithm that generates the optimal minimum energy structur
e for a single RNA sequence, using standard RNA folding thermodynamic param
eters augmented by a few parameters describing the thermodynamic stability
of pseudoknots. We demonstrate the properties of the algorithm by using it
to predict structures for several small pseudoknotted and non-pseudoknotted
RNAs. Although the time and memory demands of the algorithm are steep, we
believe this is the first algorithm to be able to fold optimal (minimum ene
rgy) pseudoknotted RNAs with the accepted RNA thermodynamic model. (C) 1999
Academic Press.