RiboSignal / README.md
emalek's picture
Release the manuscript models: three seeds per architecture, averaged
3fa4c71 verified
|
Raw History Blame Contribute Delete
5.32 kB
---
license: mit
library_name: pytorch
tags:
- biology
- genomics
- ribosome-profiling
- ribo-seq
- translation
- orf-prediction
- rna
pipeline_tag: other
---
# RiboSignal: per-nucleotide ribosome profiling signal from sequence and RNA-seq
Predicts a **per-nucleotide ribosome P-site profile** for a transcript from its sequence and
matched RNA-seq coverage. It takes any transcript, coding or non-coding, up to 10,000 nt, the
longest in training. No ribosome-profiling experiment is needed at inference. The predicted profile
keeps 3-nucleotide periodicity, so existing ORF callers such as RiboCode run on it unmodified.
These are the models of the manuscript "RiboSignal: a deep learning method for nucleotide-resolution
ribosome profiling signal prediction" (Malekos and Carpenter). Code, pipeline and documentation:
<https://github.com/ericmalekos/ribosignal>.
## Files
Two architectures, three training seeds each. Every seed predicts, and the prediction is their
average: the profile is the mean of the three profiles, and the depth is expm1 of the mean of the
three log1p totals. The repository's `scripts/dump_pred_profiles.py --run <this folder> --arch
<attn|mamba4>` does this.
| files | mixer | params per seed | device |
|---|---|--:|---|
| `mamba4_seed0.pt`, `mamba4_seed1.pt`, `mamba4_seed2.pt` + `mamba4_config.json` | dilated CNN + 4 bidirectional Mamba blocks | 7,521,282 | GPU; CPU through the repository's pure-PyTorch reference |
| `attn_seed0.pt`, `attn_seed1.pt`, `attn_seed2.pt` + `attn_config.json` | dilated CNN + 2 transformer layers | 5,071,362 | CPU or GPU |
Each `.pt` is a plain `state_dict`, the final-epoch weights (epoch 30 of 30) of one training run.
`<arch>_config.json` holds every training argument; the three seeds differ only in `--seed`.
`<arch>_test_metrics.json` holds each seed's metrics on the held-out hepatocytes. `SHA256SUMS`
checks every file.
On held-out human hepatocytes, the averaged models reach median profile correlations of 0.750
(Mamba) and 0.707 (transformer) over mappable positions, on transcripts with at least 50 observed
P-sites. The manuscript reports ORF calling on four held-out human datasets, five other species and
three independent mouse liver studies.
## Inputs
| channels | content |
|---|---|
| 4 | one-hot A/C/G/T of the transcript |
| 5 | ORF-candidate track: frame 0/1/2 occupancy, graded start codon, stop |
| 1 | RNA-seq coverage, log1p(coverage / mean coverage) |
Two output heads: a per-nucleotide profile (a distribution summing to 1) and a per-transcript
depth.
## What must match training
The inputs are built from your own transcripts and RNA-seq with the repository's pack builder; the
tutorial at <https://ribosignal.readthedocs.io> does this for chromosome 22.
- The ORF-candidate track is built with `--mode ext --kozak none`.
- Transcripts longer than 10,000 nt are left out. None was in training.
- The models need the repository's current `scripts/model.py` (the copy here is the same file): the
depth head takes the transcript's total depth-normalized RNA-seq coverage and its length
(`count_features: v2`), so the checkpoints do not load into the earlier model definition.
## Loading
```python
import json, torch
from model import RiboSignalModel # model.py here, or the repository's scripts/model.py
cfg = json.load(open("mamba4_config.json"))
sd = torch.load("mamba4_seed0.pt", map_location="cpu", weights_only=True) # plain state_dict
```
With `mamba_ssm` installed, Mamba runs on its CUDA kernels; the repository's `scripts/model.py`
falls back to a pure-PyTorch reference (`scripts/mamba_ref.py`) where `mamba_ssm` is absent, so the
Mamba models also run on CPU, more slowly.
## Training
- Human data from Chothani et al. 2022: Ribo-seq GEO **GSE182371**, RNA-seq **GSE182372**
(SuperSeries GSE182377). Trained on Fibroblast, VSMC, ES, Fat, HA_EC, HCAEC and HUVEC; hepatocytes
held out; brain excluded.
- 84,472 protein-coding and lncRNA transcripts of at most 10,000 nt. The profile head learns from
(transcript, cell type) pairs with at least 50 P-sites; the depth head also from expressed pairs
below that floor (392,699 pairs).
- Mappability-masked profile loss: positions where a uniquely mapped footprint of 25, 28 or 32 nt
can never be recorded (15.2% of positions) are left out of the profile loss.
- Unique-mapper alignments (`--outFilterMultimapNmax 1`); rRNA, tRNA, miRNA and mitochondrial
loci removed before P-site calling.
- AdamW, learning rate 3e-4, weight decay 0.01, 30 epochs with a 2-epoch warmup and cosine decay,
no early stopping; 256 channels, 10 residual blocks, dropout 0.1.
## Earlier checkpoints
The single checkpoints released before (`attn_best.pt`, `mamba4_best.pt`, an earlier training
recipe) remain available at revision `5e8342ab3d5ebeb603b8ed6ca7999048f60aae28` of this repository.
## License
**MIT.** Full text in `LICENSE`. The weights and `model.py` are covered. The **training data are
not**: they are third-party public datasets (GEO GSE182371 and GSE182372) under their own terms.
## Citation
Malekos E and Carpenter S. RiboSignal: a deep learning method for nucleotide-resolution ribosome
profiling signal prediction. Manuscript submitted. Until it is published, cite
<https://github.com/ericmalekos/ribosignal>.