rnaverse 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rnaverse-0.1.0/LICENSE +21 -0
- rnaverse-0.1.0/PKG-INFO +373 -0
- rnaverse-0.1.0/README.md +319 -0
- rnaverse-0.1.0/pyproject.toml +54 -0
- rnaverse-0.1.0/rnaverse/__init__.py +13 -0
- rnaverse-0.1.0/rnaverse/configuration_rnaverse.py +77 -0
- rnaverse-0.1.0/rnaverse/modeling_outputs.py +158 -0
- rnaverse-0.1.0/rnaverse/modeling_rnaverse.py +1706 -0
- rnaverse-0.1.0/rnaverse/tasks/protein_binding.py +584 -0
- rnaverse-0.1.0/rnaverse/tasks/ss_data.py +150 -0
- rnaverse-0.1.0/rnaverse/tasks/ss_predictor.py +69 -0
- rnaverse-0.1.0/rnaverse/tasks/ss_resnet.py +239 -0
- rnaverse-0.1.0/rnaverse/tokenization_rnaverse.py +273 -0
- rnaverse-0.1.0/rnaverse/utils.py +49 -0
- rnaverse-0.1.0/rnaverse.egg-info/PKG-INFO +373 -0
- rnaverse-0.1.0/rnaverse.egg-info/SOURCES.txt +18 -0
- rnaverse-0.1.0/rnaverse.egg-info/dependency_links.txt +1 -0
- rnaverse-0.1.0/rnaverse.egg-info/requires.txt +7 -0
- rnaverse-0.1.0/rnaverse.egg-info/top_level.txt +1 -0
- rnaverse-0.1.0/setup.cfg +4 -0
rnaverse-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RNAverse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rnaverse-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rnaverse
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A multimodal RNA foundation model that jointly learns from sequence, structural, and functional data to enable both predictive modeling and generative design.
|
|
5
|
+
Author-email: Jianbo Ma <majbchiya@outlook.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 RNAverse
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/Chiyasa/RNAverse
|
|
28
|
+
Project-URL: Repository, https://github.com/Chiyasa/RNAverse
|
|
29
|
+
Project-URL: Documentation, https://github.com/Chiyasa/RNAverse#readme
|
|
30
|
+
Project-URL: Issues, https://github.com/Chiyasa/RNAverse/issues
|
|
31
|
+
Keywords: RNA,foundation model,language model,multimodal,deep learning,bioinformatics,RNA design
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
41
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
License-File: LICENSE
|
|
46
|
+
Requires-Dist: transformers==4.34.0
|
|
47
|
+
Requires-Dist: numpy==1.26.1
|
|
48
|
+
Requires-Dist: h5py==3.10.0
|
|
49
|
+
Requires-Dist: accelerate==0.23.0
|
|
50
|
+
Requires-Dist: scipy==1.11.3
|
|
51
|
+
Requires-Dist: scikit-learn==1.3.1
|
|
52
|
+
Requires-Dist: pandas==2.1.4
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
# :dna: RNAverse
|
|
56
|
+
|
|
57
|
+
This is a [PyTorch](https://pytorch.org/) implementation of our study:
|
|
58
|
+
|
|
59
|
+
## :dart: RNAverse: RNA versatile embedding representation space for engineering
|
|
60
|
+
|
|
61
|
+
## :book: Table of Contents
|
|
62
|
+
|
|
63
|
+
- [Installation](#installation)
|
|
64
|
+
- [Download Model Weights and Benchmark Datasets](#download-model-weights-and-benchmark-datasets)
|
|
65
|
+
- [Inference: Extract Embeddings](#inference-extract-embeddings)
|
|
66
|
+
- [Option 1: Python API](#option-1-python-api)
|
|
67
|
+
- [Option 2: Command Line](#option-2-command-line)
|
|
68
|
+
- [Downstream Task Training](#downstream-task-training)
|
|
69
|
+
- [Zero-Shot In-Painting](#zero-shot-in-painting)
|
|
70
|
+
- [Fine-Tuned In-Painting](#fine-tuned-in-painting)
|
|
71
|
+
- [Iterative Optimization](#iterative-optimization)
|
|
72
|
+
|
|
73
|
+
<a name="installation"></a>
|
|
74
|
+
## :wrench: Installation
|
|
75
|
+
Please run the following command to check your CUDA version before installing RNAverse:
|
|
76
|
+
```bash
|
|
77
|
+
nvidia-smi
|
|
78
|
+
```
|
|
79
|
+
or
|
|
80
|
+
```bash
|
|
81
|
+
nvcc --version
|
|
82
|
+
```
|
|
83
|
+
<!-- Note: All tests were conducted on a **Linux Ubuntu 13.x** operating system with CUDA versions **11.x and 12.x**. -->
|
|
84
|
+
|
|
85
|
+
:heavy_exclamation_mark: Note: To install **Torch** versions compatible with your CUDA setup, please refer to the following URLs:
|
|
86
|
+
- Torch: https://pytorch.org/get-started/previous-versions/
|
|
87
|
+
|
|
88
|
+
The installation commands below reflect the development environment of RNAverse (PyTorch 2.1.0 + CUDA 12.1). If your setup requires a different version (e.g., an older CUDA or a different PyTorch release), please modify the PyTorch installation as needed, but compatibility is not guaranteed.
|
|
89
|
+
```bash
|
|
90
|
+
conda create -n rnaverse python=3.10.12
|
|
91
|
+
conda activate rnaverse
|
|
92
|
+
pip install numpy==1.26.1
|
|
93
|
+
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
|
|
94
|
+
pip install rnaverse-0.1.0-py3-none-any.whl
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
<a name="download-model-weights-and-benchmark-datasets"></a>
|
|
98
|
+
## :arrow_down: Download Model Weights and Benchmark Datasets
|
|
99
|
+
|
|
100
|
+
<p align="justify">
|
|
101
|
+
We have uploaded the model weights and benchmark datasets of RNAverse to Zenodo. Please download them from the links below, place them in the respective directories, and unzip them:
|
|
102
|
+
</p>
|
|
103
|
+
|
|
104
|
+
- **Model weights** (RNAverse, RNAverse-aptamer, RNAverse-UTR, RNAverse-SHAPE) can be downloaded from [Zenodo](https://zenodo.org/records/20527121/) and should be placed into the `./model_weights/` directory.
|
|
105
|
+
- **Benchmark datasets** can be downloaded from [Zenodo](https://zenodo.org/records/20526662) and should be placed into the `./data/` directory.
|
|
106
|
+
|
|
107
|
+
Alternatively, you can use the following commands:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git clone https://github.com/Chiyasa/RNAverse.git
|
|
111
|
+
|
|
112
|
+
cd RNAverse
|
|
113
|
+
# Download model weights (RNAverse, RNAverse-aptamer, RNAverse-UTR, and RNAverse-SHAPE)
|
|
114
|
+
# into the ./model_weights/ directory
|
|
115
|
+
cd ./model_weights
|
|
116
|
+
wget https://zenodo.org/records/20527121/files/rnaverse.zip
|
|
117
|
+
unzip rnaverse.zip
|
|
118
|
+
|
|
119
|
+
wget https://zenodo.org/records/20527121/files/rnaverse_aptamer.zip
|
|
120
|
+
unzip rnaverse_aptamer.zip
|
|
121
|
+
|
|
122
|
+
wget https://zenodo.org/records/20527121/files/rnaverse_utr.zip
|
|
123
|
+
unzip rnaverse_utr.zip
|
|
124
|
+
|
|
125
|
+
wget https://zenodo.org/records/20527121/files/rnaverse_shape.zip
|
|
126
|
+
unzip rnaverse_shape.zip
|
|
127
|
+
|
|
128
|
+
# Download benchmark datasets into the ./data/ directory
|
|
129
|
+
cd ../data
|
|
130
|
+
wget https://zenodo.org/records/20526662/files/benchmarks.zip
|
|
131
|
+
unzip benchmarks.zip
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
<a name="inference-extract-embeddings"></a>
|
|
135
|
+
## :brain: Inference: Extract Embeddings
|
|
136
|
+
|
|
137
|
+
### Option 1: Python API
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
import torch
|
|
141
|
+
import numpy as np
|
|
142
|
+
from rnaverse import RNAverseForMaskedLM, RNAverseTokenizer
|
|
143
|
+
|
|
144
|
+
# 1. Load model & tokenizer
|
|
145
|
+
model_path = "./model_weights/rnaverse" # path to RNAverse
|
|
146
|
+
tokenizer = RNAverseTokenizer.from_pretrained(model_path)
|
|
147
|
+
model = RNAverseForMaskedLM.from_pretrained(model_path)
|
|
148
|
+
model.eval()
|
|
149
|
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
150
|
+
model.to(device)
|
|
151
|
+
|
|
152
|
+
# 2. Prepare input data
|
|
153
|
+
# Each item contains:
|
|
154
|
+
# - 'seq' (required): RNA sequence string (e.g., "AUGC").
|
|
155
|
+
# - 'struct_score_list' (optional): list of floats (length = len(seq)), normalized structural scores (0-1) or null value -1.
|
|
156
|
+
# - 'probe_method' (optional): experimental probing technology (e.g., 'icSHAPE', 'DMS-seq'). Default: 'UNK'.
|
|
157
|
+
# - 'rfam_id' (optional): Rfam family ID (e.g., 'RF00001'). If provided, it overrides 'func_list'.
|
|
158
|
+
# - 'func_list' (optional): list of functional annotation strings (e.g., Rfam IDs). Default: ['UNK'].
|
|
159
|
+
# - 'mask_pos_list' (optional): 0‑based indices in the sequence to be replaced with the MASK token.
|
|
160
|
+
# IMPORTANT: masking only affects the sequence tokens (input_ids). Structural scores (struct_score_list)
|
|
161
|
+
# and functional annotations (func_list) remain unchanged at those positions.
|
|
162
|
+
|
|
163
|
+
input_dict_list = [
|
|
164
|
+
# We demonstrate the different types of inputs accepted by the model.
|
|
165
|
+
# 1) Only sequence -- all other fields take default values
|
|
166
|
+
{
|
|
167
|
+
'seq': 'UGAA',
|
|
168
|
+
},
|
|
169
|
+
# 2) Explicitly writing the defaults for the above (same effect)
|
|
170
|
+
{
|
|
171
|
+
'seq': 'UGAA',
|
|
172
|
+
'struct_score_list': [-1, -1, -1, -1], # null values for all positions
|
|
173
|
+
'probe_method': 'UNK',
|
|
174
|
+
'func_list': ['UNK'],
|
|
175
|
+
'mask_pos_list': [],
|
|
176
|
+
},
|
|
177
|
+
# 3) Sequence with structural scores (some missing, some valid) and a specific probing method
|
|
178
|
+
{
|
|
179
|
+
'seq': 'ACGU',
|
|
180
|
+
'struct_score_list': [0.42, -1, 0.87, 0.12], # -1 indicates missing data
|
|
181
|
+
'probe_method': 'icSHAPE', # overrides default 'UNK'
|
|
182
|
+
# func_list and mask_pos_list use defaults
|
|
183
|
+
},
|
|
184
|
+
# 4) Sequence with functional annotations via func_list
|
|
185
|
+
{
|
|
186
|
+
'seq': 'GGCCU',
|
|
187
|
+
'func_list': ["riboswitch","Cis-reg","RF00167","GO:0009113"],
|
|
188
|
+
# struct_score_list and probe_method default
|
|
189
|
+
},
|
|
190
|
+
# 5) Sequence with Rfam ID -- automatically looks up the corresponding func_list from /path/to/RNAverse/rfam_map.json
|
|
191
|
+
{
|
|
192
|
+
'seq': 'GGCCU',
|
|
193
|
+
'rfam_id': 'RF00167', # overrides any explicit 'func_list' if present
|
|
194
|
+
# If rfam_id is not found in the map, func_list becomes ['UNK'] and a warning is logged.
|
|
195
|
+
},
|
|
196
|
+
# 6) Sequence with masked positions (e.g., for MLM pretraining)
|
|
197
|
+
# Only the sequence tokens at indices 2 and 5 become MASK; structural scores and func_list are untouched.
|
|
198
|
+
{
|
|
199
|
+
'seq': 'AUGCGCAU',
|
|
200
|
+
'mask_pos_list': [2, 5], # positions 0‑based
|
|
201
|
+
# other fields default
|
|
202
|
+
},
|
|
203
|
+
# 7) All fields provided explicitly (full specification)
|
|
204
|
+
{
|
|
205
|
+
'seq': 'UCCGAUUGC',
|
|
206
|
+
'struct_score_list': [0.13, 0.51, 0.32, 0.94, -1, 0.27, 0.88, 0.477, 0.631],
|
|
207
|
+
'probe_method': 'icSHAPE',
|
|
208
|
+
'func_list': ["riboswitch","Cis-reg","RF00167","GO:0009113"],
|
|
209
|
+
'mask_pos_list': [4], # mask the 5th nucleotide (index 4) -- only the sequence token
|
|
210
|
+
},
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
# 3. Tokenize
|
|
214
|
+
inputs = tokenizer(input_dict_list, padding=True, return_tensors="pt")
|
|
215
|
+
inputs = {k: v.to(device) for k, v in inputs.items()}
|
|
216
|
+
|
|
217
|
+
# 4. Run inference
|
|
218
|
+
with torch.no_grad():
|
|
219
|
+
inputs["output_hidden_states"] = True
|
|
220
|
+
outputs = model(**inputs)
|
|
221
|
+
|
|
222
|
+
# 5. Extract embeddings (last hidden state, skip CLS token). RNAverse does not use a SEP token at the end
|
|
223
|
+
hidden_states = outputs.hidden_states[-1][:, 1:, :] # (batch, seq_len, hidden_size)
|
|
224
|
+
|
|
225
|
+
# Option A: per-position embeddings
|
|
226
|
+
embed_per_pos = hidden_states.cpu().numpy() # shape: (batch, seq_len, hidden_size)
|
|
227
|
+
|
|
228
|
+
# Option B: average-pooled embedding per sequence
|
|
229
|
+
embed_ave = hidden_states.mean(dim=1).cpu().numpy() # shape: (batch, hidden_size)
|
|
230
|
+
|
|
231
|
+
# Option C: CLS embedding per sequence
|
|
232
|
+
embed_cls = outputs.hidden_states[-1][:, 0, :]
|
|
233
|
+
|
|
234
|
+
print(f"Per-position embedding shape: {embed_per_pos.shape}")
|
|
235
|
+
print(f"Average-pooled embedding shape: {embed_ave.shape}")
|
|
236
|
+
print(f"CLS embedding shape: {embed_cls.shape}")
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Option 2: Command Line
|
|
240
|
+
|
|
241
|
+
<p align="justify">
|
|
242
|
+
Prepare an input file following the same format as ./examples/input_demo.txt. For demonstration, the example below uses ./examples/input_demo.txt directly. Then run:
|
|
243
|
+
</p>
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Ensure that your current working directory is the 'RNAverse' folder.
|
|
247
|
+
python ./examples/infer_embed.py \
|
|
248
|
+
--model_name_or_path ./model_weights/rnaverse \
|
|
249
|
+
--input_txt ./examples/input_demo.txt \
|
|
250
|
+
--output_dir ./output/embed \
|
|
251
|
+
--output_embed_format ave \
|
|
252
|
+
--batch_size 64
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
:heavy_exclamation_mark: Embeddings will be saved as `.pkl` files in the output directory.
|
|
256
|
+
|
|
257
|
+
<a name="downstream-task-training"></a>
|
|
258
|
+
## :microscope: Downstream Task Training
|
|
259
|
+
|
|
260
|
+
<p align="justify">
|
|
261
|
+
Taking the Structure Score Imputation task on the HEK293 dataset as an example:
|
|
262
|
+
</p>
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Ensure that your current working directory is the 'RNAverse' folder.
|
|
266
|
+
python3 ./benchmarks/multimodal/train_ssi.py \
|
|
267
|
+
--model_name_or_path ./model_weights/rnaverse \
|
|
268
|
+
--data_path ./data/benchmarks/multimodal/SSI \
|
|
269
|
+
--data_train_path 293_train.txt --data_val_path 293_val.txt --data_test_path 293_test.txt \
|
|
270
|
+
--run_name rnaverse_ssi_293_seed42 \
|
|
271
|
+
--per_device_train_batch_size 32 \
|
|
272
|
+
--per_device_eval_batch_size 32 \
|
|
273
|
+
--gradient_accumulation_steps 1 \
|
|
274
|
+
--learning_rate 3e-5 \
|
|
275
|
+
--num_train_epochs 30 \
|
|
276
|
+
--fp16 \
|
|
277
|
+
--save_steps 400 \
|
|
278
|
+
--output_dir ./output/downstream/SSI_293_seed42 \
|
|
279
|
+
--save_strategy steps \
|
|
280
|
+
--eval_strategy steps \
|
|
281
|
+
--eval_steps 200 \
|
|
282
|
+
--warmup_steps 50 \
|
|
283
|
+
--logging_steps 200 \
|
|
284
|
+
--overwrite_output_dir True \
|
|
285
|
+
--log_level info \
|
|
286
|
+
--seed 42 \
|
|
287
|
+
--model_type rnaverse
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
<a name="zero-shot-in-painting"></a>
|
|
291
|
+
## :rocket: Zero-Shot In-Painting
|
|
292
|
+
|
|
293
|
+
<p align="justify">
|
|
294
|
+
RNAverse can directly design RNA functional classes that were included in the multimodal alignment stage using the zero-shot in-painting strategy. Below is an example for the design of RNAverse-gACA19:
|
|
295
|
+
</p>
|
|
296
|
+
|
|
297
|
+
> :heavy_exclamation_mark: **Note:** In the initial FASTA sequence provided to `--init_seq` in `./generation/in_painting.py`, the character `N` denotes positions where new nucleotides will be generated (i.e., masked positions). All other characters (A, U, C, G) remain fixed.
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# Ensure that your current working directory is the 'RNAverse' folder.
|
|
301
|
+
python3 ./generation/in_painting.py \
|
|
302
|
+
--init_seq ./data/design/RNAverse_gACA19_init.fa \
|
|
303
|
+
--model_name_or_path ./model_weights/rnaverse \
|
|
304
|
+
--rfam_id RF00413 \
|
|
305
|
+
--random_seed 42 \
|
|
306
|
+
--seq_num 5000 \
|
|
307
|
+
--max_token_per_iter 5 \
|
|
308
|
+
--output_fa ./output/design/RNAverse_gACA19.fa
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
<a name="fine-tuned-in-painting"></a>
|
|
312
|
+
## :art: Fine-Tuned In-Painting
|
|
313
|
+
|
|
314
|
+
<p align="justify">
|
|
315
|
+
For RNA functional classes that are absent from the alignment corpus, RNAverse can be fine-tuned with the MLM objective using sequences from the target RNA class. Below is an example using IGFBP3 aptamer SELEX sequences.
|
|
316
|
+
</p>
|
|
317
|
+
|
|
318
|
+
> :heavy_exclamation_mark: **Note:** The `func_vocab.json` and `rfam_map.json` files should be edited first to include the novel functional class, as shown in `./model_weights/rnaverse-aptamer/func_vocab.json` and `./model_weights/rnaverse-aptamer/rfam_map.json`.
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Ensure that your current working directory is the 'RNAverse' folder.
|
|
322
|
+
python3 ./examples/ft_mlm.py \
|
|
323
|
+
--batch_size 32 \
|
|
324
|
+
--lr 5e-6 \
|
|
325
|
+
--pad_len 1025 \
|
|
326
|
+
--random_seed 37 \
|
|
327
|
+
--model_path ./model_weights/rnaverse \
|
|
328
|
+
--config_path ./model_weights/rnaverse-aptamer \
|
|
329
|
+
--tokenizer_path ./model_weights/rnaverse-aptamer \
|
|
330
|
+
--save_model_dir ./output/design/ft_mlm/ \
|
|
331
|
+
--max_epoch 200 \
|
|
332
|
+
--tol_epoch 8 \
|
|
333
|
+
--whether_ft 1 \
|
|
334
|
+
--train_txt ./data/design/datasetA_IGFBP3_P6_train_rnaverse.txt \
|
|
335
|
+
--test_txt ./data/design/datasetA_IGFBP3_P6_test_rnaverse.txt
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
<p align="justify">
|
|
339
|
+
We provide the trained model weights of RNAverse-aptamer, which can be directly used for in-painting generation of the IGFBP3 aptamer:
|
|
340
|
+
</p>
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
# Ensure that your current working directory is the 'RNAverse' folder.
|
|
344
|
+
python3 ./generation/in_painting.py \
|
|
345
|
+
--init_seq ./data/design/RNAverse_aptamer_init.fa \
|
|
346
|
+
--model_name_or_path ./model_weights/rnaverse-aptamer \
|
|
347
|
+
--rfam_id IGFBP3_aptamer \
|
|
348
|
+
--random_seed 42 \
|
|
349
|
+
--seq_num 5000 \
|
|
350
|
+
--max_token_per_iter 1 \
|
|
351
|
+
--output_fa ./output/design/RNAverse_aptamer.fa
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
<a name="iterative-optimization"></a>
|
|
355
|
+
## :repeat: Iterative Optimization
|
|
356
|
+
|
|
357
|
+
<p align="justify">
|
|
358
|
+
We provide the model weights of RNAverse-UTR and RNAverse-SHAPE, which can be directly used for iterative optimization to design 5′ UTR sequences:
|
|
359
|
+
</p>
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Ensure that your current working directory is the 'RNAverse' folder.
|
|
363
|
+
python3 ./generation/iterative_optimization.py \
|
|
364
|
+
--out_dir ./output/design/iter_opt_utr5/ \
|
|
365
|
+
--cds ATGGTGAGCAAGGGCGAGGAGCTGTTCACCGGGGTGGTGCCCATCCTGGT \
|
|
366
|
+
--design_length 150 \
|
|
367
|
+
--nbr_sequences 500 \
|
|
368
|
+
--evolved_iter 500 \
|
|
369
|
+
--nbr_bases_to_mutate 6 \
|
|
370
|
+
--rnaverse_shape_model_path ./model_weights/rnaverse-shape \
|
|
371
|
+
--rnaverse_utr_model_file ./model_weights/rnaverse-utr/best_model.pt \
|
|
372
|
+
--bs 32 \
|
|
373
|
+
--random_seed 42
|