This repository contains a deep learning tool for predicting intrinsically disordered regions (IDRs) in protein sequences.
This tool generates embeddings from raw protein sequences using a pre-trained protein language model (pLM) and predicts disorder probabilities using a deep learning model that was trained with the DisProt dataset (2023_12) and tested on the CAID3v3 benchmarks. The output of the tool includes per-residue disorder scores, plots of disorder along the sequence and summary statistics.
- Clone the repository:
git clone https://github.com/sinc-lab/emb2dis.git
cd emb2dis- Create a virtual environment:
conda create -n emb2dis python=3.11
conda activate emb2dis- Install required packages:
pip install -r requirements.txtThe main script is predict_disorder.py. You can provide a FASTA file containing one or more protein sequences:
python predict_disorder.py --fasta data/samples.fasta
This script will:
- Read all sequences from the FASTA file.
- Generate embeddings using the specified pLM (ProtT5 by default).
- Predict disorder scores for each residue using a sliding window approach.
- Save results (CSV and plots) to the output directory (
./results/by default). - Print disorder statistics to the console.
| Argument | Short | Description |
|---|---|---|
--fasta |
-f |
Path to input FASTA file (required). |
--model |
-m |
Protein language model: ProtT5 (by default) or ESM2 |
--output-dir |
-o |
Directory to save predictions (.csv) and plots (.png) (./results/ by default). |
--device |
-d |
Device: cpu, cuda (by default), cuda:0, etc. |
--verbose |
-v |
Enable verbose output for detailed progress (False by default). |
1. Specify output directory and verbose mode:
python predict_disorder.py --fasta data/samples.fasta --output-dir my_results/ --verbose
2. Use ESM2 model on CPU:
python predict_disorder.py --fasta data/samples.fasta --model ESM2 --device cpu
3. Use a specific GPU:
python predict_disorder.py --fasta data/samples.fasta --device cuda:1
| Model | Description | Embedding Size | Reference | Repository |
|---|---|---|---|---|
| ESM2 | ESM-2 (650M parameters) | 1280 | Lin et al., 2023 | facebookresearch/esm |
| ProtT5 | ProtT5-XL (half precision) | 1024 | Elnaggar et al., 2021 | rostlab/ProtTrans |
The disorder prediction models are trained specifically for each pLM.
Protein embeddings must be available locally before training and evaluating the models. You can generate them using the corresponding pLMs or download the precomputed embeddings provided in the shared Google Drive folder.
Precomputed embeddings are distributed as .tar.gz archives, with one archive for each protein language model. To download and extract them, run:
mkdir -p data/embeddings
gdown --folder 1iwfAr7ZHY9SbnCLqobRpuzMWcmcv_z3p -O data/embeddings
for archive in data/embeddings/*.tar.gz; do tar -xzf "$archive" -C data/embeddings/; doneAfter extraction, make sure that the embedding directories are located under the path specified by emb_path in config/env.yaml (default: data/embeddings/).
Once the embeddings are available, train and evaluate the proposed disorder models by running the train_test_model.py script from the repository root:
python -m train_test_modelMake sure the configuration files point to your local paths:
config/base.yaml: setdata_pathto the directory containing the training and evaluation data.config/env.yaml: setemb_pathto the directory containing the protein embeddings andcaid_pathto the directory containing the CAID benchmark data.
The script will train the models and evaluate them on the CAID3v3 benchmark datasets. The results will be saved in the results/ directory.
- Sequence preprocessing: Non-canonical amino acids (U, Z, O, B) are automatically converted to 'X' before generating embeddings.
