A Streamlit app for predicting RNA secondary structure using QAOA (Quantum Approximate Optimization Algorithm) on PennyLane.
Based on Jiang et al. (2023).
# Install dependencies
pixi install
# Run the app
pixi run streamlit run qrna_folding/main.pyOpen http://localhost:8501 in your browser.
The app follows a 3-step workflow:
- Enter an RNA sequence using valid bases:
A,U,G,C - Set minimum stem length (default: 3)
- Click Perform Preprocessing
- View the adjacency matrix showing potential base pairs (AU/GU = 2 H-bonds, GC = 3 H-bonds)
- Choose number of stems to analyze
- Select method:
longest— prioritize stems with most base pairsrandom— random selection
- Click Select Stems
- View network graphs of selected stems
- Set QAOA layers (2–9, default: 5)
- Choose device:
default.qubit— standard PennyLane simulatorlightning.qubit— high-performance C++ simulator
- Click Run Experiment
- Monitor optimization in terminal (100 Adam steps)
qrna_folding/
├── main.py # Streamlit UI
├── preprocessors.py # RNA processing, stem detection
├── experiments.py # QAOA circuit and optimization
├── visualisation.py # Adjacency matrix and network plots
└── utils.py # Hamiltonian utilities
Runtime dependencies managed via Pixi — see pixi.toml.
Dev dependencies defined in pyproject.toml:
ruff— linter and formatterpre-commit— git hooks