uci-cbcl / UFold

MIT License
59 stars 29 forks source link

News 🌟

We have update our backend-server to v1.3 and provide a CPU-based version of UFold-CPU online platform. Please check it out!!!

UFold: Fast and Accurate RNA Secondary Structure Prediction with Deep Learning

For many RNA molecules, the secondary structure is essential for the correct function of the RNA. Predicting RNA secondary structure from nucleotide sequences is a long-standing problem in genomics, but the prediction performance has reached a plateau over time. Traditional RNA secondary structure prediction algorithms are primarily based on thermodynamic models through free energy minimization, which imposes strong prior assumptions and is slow to run. Here we propose a deep learning-based method, called UFold, for RNA secondary structure prediction, trained directly on annotated data and base-pairing rules. Ufold proposes a novel image-like representation of RNA sequences, which can be efficiently processed by Fully Convolutional Networks (FCNs). UFold improves upon previous models, with approximately 10~30% improvement over traditional thermodynamic models and up to 27% improvement over other learning-based methods in terms of base-pair prediction accuracy on an RNA structure prediction benchmark dataset. UFold is also fast with an inference time of about 160ms per sequence up to 1600bp in length.

Prerequisites

--python >= 3.11

--torch >= 2.0.1 with cudnn >=11.8

--munch

--subprocess

--collections

Installation

Clone the repository.

git clone https://github.com/uci-cbcl/UFold.git

Navigate to the root of this repo and setup the conda environment.

!!!Noted:

1. Please change prefix path into your own path in the last line of UFold.yaml file.

2. Please match your python version ,cuda version and torch version with the package.

conda env create -f UFold.yaml

Activate conda environment.

conda activate UFold

Check if the installation succeed.

Please check the predicting section to further validate whether the installation is succeeded and the software works as expected.

Pre-trained models

Pre-trained models are deposited in our drive. Please download them and put them into models folder.

Usage

Recommended

We recommend users use our UFold webserver, which is user-friendly and easy to use. Everyone could upload or typein your own candidate RNA sequence in our web without further installation, our backend server will calculate and give the prediction result to the user. User can choose to download the predict ct file result as well as visualize them online directly.

Data generator

You can put their bpseq formatted files in their own directory and specify it in this process by running:

$ python process_data_newdataset.py your_own_directory_containing_bpseq_files

After that you will get a pickle file format, which is compatible with our model. Then put the data into data folder.

Training

You can train our model using pre-defined data, or use our customed data generate script to generate your own data(Mentioned before). After that, you can run the model training script:

$ python ufold_train.py --train_files dataset_A dataset_B 
--train_files: optinal parameter, default is all the datasets mentioned in the paper.

Noted that this script will include all the data for training as default.

Evaluating & Predicting

We provide test script for users to evaluate the prediction result and predict their own sequence using pre-trained model. Users can predict their own sequences and get ct file as output from the webserver. The script is for evaluating the results.

$ python ufold_test.py --test_files TS2 
--test_files: optional parameter, set the test set name from one of test sets(['ArchiveII','TS0','bpnew','TS1','TS2','TS3']).

After running the above example, you will genarate the example output as the following shows:

If the above output pops up, then you have succeeded installed our software.

We have also provided an offline version of our prediction tool for users to directly predict RNA secondary structure using their own fasta sequences. All they need to do is put their fasta file (named input.txt) into data folder. And then run the following codes:

$ python ufold_predict.py --nc False
--nc: optional parameter, whether to predict non-canonical pair or not, default is False.

After running the above command, you will get the output ct file,bpseq file, and figures in the results folder.

Contribute

We love your input! We want to make contributing to UFold as easy and transparent as possible. Please see our Contributing Guide to get started. Thank you to all our contributors!

Citation

If you use our tool, please cite our work:

UFold: Fast and Accurate RNA Secondary Structure Prediction with Deep Learning

Laiyi Fu, Yingxin Cao, Jie Wu, Qinke Peng, Qing Nie, Xiaohui Xie, UFold: fast and accurate RNA secondary structure prediction with deep learning, Nucleic Acids Research, 2021;, gkab1074, https://doi.org/10.1093/nar/gkab1074