Downloads · 30 days
0
SilenceZong/DDI_single
DDI_single is a other model from SilenceZong. Use it for the other task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
[](https://www.python.org/downloads/) [](https://pytorch.org/) [](https://www.apache.org/licenses/LICENSE-2.0)
Downloads · 30 days
0
Access
Public
Updated Jun 6, 2026
Repo size
5.1 GB
Likes
0
Public
Click a slice to open those files.
.pth5.1 GB · 100%
From the Hugging Face model README
Single-sequence domain assembly for multi-domain proteins
中文文档请参阅 README_ch.md
DDI_single (Domain Distance Inference, single-sequence) is a domain assembly method for multi-domain proteins that relies solely on the amino acid sequence. It uses the protein language model ESM-1b to extract sequence features and an improved Gated Cross-Attention module to predict inter-domain residue pair distances and orientations, enabling correct spatial assembly of structural domains.
The pipeline takes a protein sequence and domain definitions as input. ESM-1b extracts per-residue embeddings, which are split by domain and refined through 4 Gated Cross-Attention layers with 4 recycle iterations. The model predicts inter-domain distance and orientation distributions (d, ω, θ, φ), which are combined with intra-domain constraints and fed into Rosetta for 3D structure assembly.
| Feature | Description |
|---|---|
| Single-sequence input | No MSA or homologous templates required; uses ESM-1b for sequence embeddings |
| Gated cross-attention | Bidirectional cross-attention with gating to capture inter-domain residue interactions |
| Recycle refinement | 4 rounds of iterative feature extraction to strengthen inter-domain relationship modeling |
| Multi-task prediction | Outputs distance (d) and dihedral angle (ω, θ, φ) distributions for inter-domain residue pairs |
| Rosetta integration | Predictions serve as spatial constraints for domain assembly and energy minimization |
Inter-domain residue pair distance prediction accuracy (given known domain definitions):
| Method | Top-10 | Top-5 | Top-1 |
|---|---|---|---|
| trRosettaX_single | 50.6% | 55.6% | 61.3% |
| DDI_single | 74.5% | 78.6% | 83.2% |
Domain assembly success rate (TM-score > 0.5):
| Scenario | DDI_single | trRosettaX_single |
|---|---|---|
| Known domain conformations | 74.4% (681 samples) | 44.5% |
| Unknown domain conformations | 73.9% (115 samples) | 58.3% |
pip install torch fair-esm numpy einops huggingface_hub
ESM-1b pretrained weights (~2.5 GB) will be downloaded automatically on first run.
Model checkpoints are hosted on this repository (~4.7 GB):
huggingface-cli download SilenceZong/DDI_single DDI_single.pth --local-dir .
<details>
<summary>Or download with Python</summary>
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="SilenceZong/DDI_single", filename="DDI_single.pth", local_dir=".")
</details>
;Example FASTA:
>protein
MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSG...
Example domain definitions:
1-150;200-280 (two discontinuous segments)151-199;281-400python predict.py <fasta> <domain1> <domain2> <output.npz> [--weights PATH] [--device cpu|cuda]
# CPU (default)
python predict.py protein.fasta "1-150" "151-300" result.npz
# GPU
python predict.py protein.fasta "1-150" "151-300" result.npz --device cuda
# Custom weights path
python predict.py protein.fasta "1-150" "151-300" result.npz --weights /path/to/DDI_single.pth
Results are saved as .npz with the following fields:
| Field | Shape | Description |
|---|---|---|
dist | [1, 37, L1, L2] | Inter-domain Cβ distance distribution (2–20 &Angst;) |
omega | [1, 25, L1, L2] | Ω dihedral angle distribution |
theta | [1, 25, L1, L2] | θ dihedral angle distribution |
phi | [1, 13, L1, L2] | φ dihedral angle distribution |
domain1_index | [L1] | 0-based indices of Domain 1 residues |
domain2_index | [L2] | 0-based indices of Domain 2 residues |
import numpy as np
data = np.load("result.npz")
dist = data["dist"] # shape: [1, 37, L1, L2]
d1_idx = data["domain1_index"]
d2_idx = data["domain2_index"]
Inter-domain constraints predicted by DDI_single can be combined with Rosetta for energy-minimization-based domain assembly:
| Module | Description |
|---|---|
Single_DDI_sESM | Wraps ESM-1b and the domain assembly network |
GAU | Gated cross-attention unit with Pre-LN and GELU feed-forward layers |
feature_extractor | Bidirectional cross-attention updating both domain representations |
inter_head | Predicts d / ω / θ / φ from attention maps |
| Parameter | Value |
|---|---|
| GAU layers | 4 |
| Attention heads | 16 |
| Head channels (GAU) | 256 |
| Prediction heads | 40 |
| Prediction head channels | 128 |
| Recycle iterations | 4 |
DDI_single/
├── config.py # Model and training hyperparameters
├── model.py # Network architecture (GAU, Single_DDI, Single_DDI_sESM)
├── predict.py # Inference script
├── pipeline.png # Full pipeline diagram
├── DDI_single.pth # Model weights
├── README.md # English documentation
└── README_ch.md # Chinese documentation
If you use DDI_single in your research, please cite:
@article{ddi_single,
title = {DDI_single: Single-sequence-based Domain Assembly via Gated Cross-Attention},
author = {Shengyi Zong},
journal = {},
year = {}
}