CARINA is a deep learning framework for tissue-resolved modeling of RNA–RBP interactions.
It integrates heterogeneous CLIP-seq resources with tissue-level regulatory signals to learn transferable and interpretable RNA-binding grammars across tissues.
- Tissue-aware RBP binding prediction
- Cross-tissue generalization (train in one tissue, test in another)
- Multi-context regulatory inference
- Motif-level interpretability (Integrated Gradients and attention)
CARINA implements a context-calibrated topological grammar network for tissue-resolved RBP binding.
Instead of treating RNA–protein recognition as a purely sequential pattern-matching problem, CARINA decomposes the binding process into four coupled operators that separate transfer-stable grammar construction from context-dependent grammar deployment.
Given an RNA sequence and its base-pair probability matrix, CARINA performs:
- Motif-field initialization
- Probabilistic pairing transport
- Context-calibrated reparameterization
- Multiscale motif energy pooling
These stages progressively transform nucleotide-level signals into a segment-level binding representation, which is then used for prediction.
CARINA first constructs a nucleotide-resolution feature field from the input RNA sequence.
- Local convolutional operators capture short-range compositional patterns
- Batch normalization and nonlinear activation stabilize feature learning
- Channel-wise recalibration selectively enhances informative motif detectors
This stage produces a motif field, representing local binding evidence across the sequence.
To incorporate RNA secondary structure, CARINA lifts the motif field onto a probabilistic pairing graph derived from RNAfold.
- Base-pair probability matrix defines weighted edges between nucleotides
- Graph-based propagation diffuses features along structural connections
- Multi-head self-attention captures long-range and higher-order dependencies
This results in a structure-aware representation that integrates both sequence and topology.
CARINA introduces a context-aware normalization mechanism to model tissue-specific regulatory variability.
- Standard batch normalization is augmented with instance-level channel statistics
- A lightweight gating mechanism modulates feature scaling dynamically
- The same motif field can be reweighted differently across biological contexts
This step enables context-dependent deployment of shared regulatory grammar.
Finally, CARINA aggregates motif signals into a segment-level representation.
- Nucleotide salience is modeled via local interaction operators
- Motif importance is inferred through structured (convolution-like) attention
- Hierarchical pooling integrates signals across multiple spatial scales
The output is a compact latent vector summarizing motif-aware and context-calibrated binding evidence.
The learned representation is used for two prediction tasks:
- Binding prediction (peak vs. background)
- Tissue assignment (multi-label classification across tissues)
Core Python dependencies include:
- PyTorch (torch, torchvision, torchaudio)
- PyTorch Geometric (pyg)
- NumPy, SciPy, Pandas, scikit-learn
- Matplotlib, seaborn
- Captum, SHAP, logomaker
- pybedtools, pysam, pyBigWig, pyranges
- transformers
The following external tools are required:
- ViennaRNA (RNA secondary structure prediction)
- bedtools (genomic interval processing)
Make sure they are installed and available in your system PATH.
git clone https://github.com/zhuhr213/CARINA.git
cd CARINACARINA was developed with Python 3.12. We recommend creating the environment directly from the provided YAML file.
conda env create -f environment.yml
conda activate torch-envBefore training, please ensure that:
- RNA sequences are prepared in FASTA or BED-derived format
- eCLIP peaks and tissue annotations are properly processed
- RNA secondary structures are generated using ViennaRNA (RNAfold)
Example:
RNAfold < input.fa > structure.txtWe also provide dataset construction pipelines in: tutorial
You can train the model using either the main script or the provided shell script.
CUDA_VISIBLE_DEVICES=0 python -u main_CARINA.py \
--train \
--arch CARINA \
--data_dir "$file_dir" \
--p_name "$file_name" \
--batch_size 64 \
--hidden_size 128 \
--num_att_layers 1 \
--lr 0.001 \
--weight_decay 1e-6 \
--dropout 0.3 \
--out_dir ./CARINA_results \
--early_stopping 20 \
Option 2: Using shell script (recommended)
bash run_CARINA_train.sh
In validate mode, users can specify the --model_path parameter to load a pretrained model trained in a different context, enabling train-in-one, test-in-another cross-context prediction.
CARINA provides saliency-based interpretability to identify nucleotide-level contributions to RBP binding predictions. This allows users to uncover motif-like patterns and regulatory signals learned by the model.
Users can generate saliency maps using the main entry script:
CUDA_VISIBLE_DEVICES=0 python -u main_CARINA.py \
--saliency_img \
--arch CARINA \
--data_dir "$file_dir" \
--p_name "$file_name" \
--batch_size 64 \
--hidden_size 128 \
--num_att_layers 1 \
--lr 0.001 \
--weight_decay 1e-6 \
--dropout 0.3 \
--out_dir ./CARINA_results \
--early_stopping 20Alternatively, users can directly run the provided shell script:
bash run_CARINA_saliency_img.shThe generated outputs include:
- Nucleotide-level saliency scores
- Visualization of high-attention binding regions
- Motif-like patterns inferred from model attribution
For RNA sequences outside the provided datasets, we offer a complete workflow in the tutorials: tutorial
This includes:
- Construction of model-compatible input data
- End-to-end saliency generation
- Visualization of interpretability results
The corresponding Jupyter Notebook demonstrates how to process arbitrary RNA sequences and obtain biologically meaningful interpretation from CARINA.
All datasets used in this study, including:
- tissue-resolved RBP binding peaks derived from ENCODE and GTEx integration
- independent validation datasets (e.g., POSTAR)
- processed datasets for tissue-resolved regulatory modeling
are available at:
- Figshare: https://doi.org/10.6084/m9.figshare.31958364
- Zenodo: https://doi.org/10.5281/zenodo.19508834
This project is licensed under the Apache License 2.0.
Thank you for using CARINA! Any questions, suggestions or advice are welcome!
Contact: lixt314@jlu.edu.cn, zhuhr213@gmail.com

