multimolecule/ufold
UFold
Pre-trained model for RNA secondary structure prediction using an image-like sequence representation and a U-Net.
Disclaimer
This is an UNOFFICIAL implementation of UFold: fast and accurate RNA secondary structure prediction with deep learning by Laiyi Fu, Yingxin Cao, et al.
The OFFICIAL repository of UFold is at uci-cbcl/UFold.
[!TIP] The MultiMolecule implementation is a direct PyTorch port of the original U-Net architecture and feature construction.
The team releasing UFold did not write this model card for this model so this model card has been written by the MultiMolecule team.
Model Details
UFold predicts RNA base-pair contact maps from single RNA sequences. It represents a sequence as a 17-channel image: 16 channels are outer products of one-hot nucleotide indicators and one channel is a hand-crafted canonical/wobble pairing score. A U-Net predicts a symmetric contact score matrix, and the original constrained post-processing routine can be enabled to enforce base-pairing constraints.
Model Specification
FLOPs and MACs are computed with multimolecule.utils for one 600 nt sequence.
Links
- Code: multimolecule.ufold
- Weights: multimolecule/ufold
- Paper: UFold: fast and accurate RNA secondary structure prediction with deep learning
- Developed by: Laiyi Fu, Yingxin Cao, Jie Wu, Qinke Peng, Qing Nie, Xiaohui Xie
- Original Repository: uci-cbcl/UFold
Usage
The model file depends on the `multimolecule` library. You can install it using pip:
pip install multimoleculeRNA Secondary Structure Pipeline
import multimolecule
from transformers import pipeline
predictor = pipeline("rna-secondary-structure", model="multimolecule/ufold")
output = predictor("GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCUCA")PyTorch Inference
from multimolecule import RnaTokenizer, UfoldModel
tokenizer = RnaTokenizer.from_pretrained("multimolecule/ufold")
model = UfoldModel.from_pretrained("multimolecule/ufold")
sequence = "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCUCA"
inputs = tokenizer(sequence, return_tensors="pt")
output = model(**inputs)
contact_map = output.contact_mapTo run the original constrained post-processing loop:
output = model(**inputs, use_postprocessing=True)
contact_map = output.postprocessed_contact_mapTraining Details
UFold was trained for RNA secondary structure prediction from annotated contact maps and base-pairing rules.
Training Data
- RNAStrAlign: 30,451 unique RNAs from eight RNA families; the paper reports a random split with 24,895 training RNAs and 2,854 test RNAs after redundancy filtering.
- bpRNA-1m: 102,318 RNAs from 2,588 families; CD-HIT was used to remove redundant sequences before splitting the data into TR0 and TS0.
- augmented data: synthetic training examples were generated from bpRNA-new sequences by random mutation and structure prediction.
- PDB training data: high-resolution RNA structures from bpRNA and the PDB were used for fine-tuning/evaluation experiments; test sets TS1, TS2, and TS3 were filtered at 80% sequence identity.
- evaluation data: ArchiveII, TS0, bpRNA-new, and PDB test data were used for benchmark evaluation.
Training Procedure
- input representation: 16 outer-product channels following the MultiMolecule tokenizer order plus one hand-crafted pairing-score channel.
- objective: weighted binary cross entropy over base-pair contact maps.
- optimizer: Adam.
- training epochs: 100.
- batch size: 1.
- positive-class weight: 300.
- post-processing: constrained optimization with canonical/wobble pairing rules, sparsity shrinkage, and a 0.5 threshold.
Citation
@article{fu2022ufold,
author = {Fu, Laiyi and Cao, Yingxin and Wu, Jie and Peng, Qinke and Nie, Qing and Xie, Xiaohui},
title = {UFold: fast and accurate RNA secondary structure prediction with deep learning},
journal = {Nucleic Acids Research},
volume = {50},
number = {3},
pages = {e14},
year = {2022},
doi = {10.1093/nar/gkab1074}
}[!NOTE] The artifacts distributed in this repository are part of the MultiMolecule project. If MultiMolecule supports your research, please cite the MultiMolecule project as follows:
@software{chen_2024_12638419,
author = {Chen, Zhiyuan and Zhu, Sophia Y.},
title = {MultiMolecule},
doi = {10.5281/zenodo.12638419},
publisher = {Zenodo},
url = {https://doi.org/10.5281/zenodo.12638419},
year = 2024,
month = may,
day = 4
}Contact
Please use GitHub issues of MultiMolecule for any questions or comments on the model card.
Please contact the authors of the UFold paper for questions or comments on the paper/model.
License
This model implementation is licensed under the GNU Affero General Public License.
For additional terms and clarifications, please refer to our License FAQ.
SPDX-License-Identifier: AGPL-3.0-or-later