I wish to use a library to give me all consecutive folded windows of an RNA. It seems like RNALfold from the ViennaRNA suite cherry picks a few structures and displays them. What I want is the whole set of windows, from index 0..end-windowSize. Is there any library that can provide this? Or a way I can make RNALfold give me this information?
1 answer
Hello. Reviving another close-for-a-bit BioStars thread to share that I made a DNA/RNA folding library that has a function for something like this. The library, seqfold, is based on the same algo as mfold/unafold, etc, and returns comparable minimum free energies (see: examples). seqfold.dg_cache is the function that generates a cache that could be used for window querying.
Documentation
https://github.com/Lattice-Automation/seqfold
Examples
https://github.com/Lattice-Automation/seqfold/tree/master/examples
Python
The example below includes dg_cache which is the function for generating a 2D matrix for querying windows, as you asked about in your question.
from seqfold import dg, dg_cache
# just returns minimum free energy
dg("GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC", temp = 37.0) # -12.94
# `dg_cache` returns a 2D array where each (i,j) combination returns the MFE from i to j inclusive
cache: List[List[float]] = dg_cache("GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC")
CLI
seqfold has a CLI but I can't think of an intuitive way to expose this 2D matrix other than to write it to a CSV externally. If anyone wants a windows/cache function exposed through a CLI let me know and I'll add something like CSV export (so this is available through the CLI in addition to the Python interface).
Log in to answer this question.