# isblab/disobind architecture

> Architecture diagram of the GitHub repository isblab/disobind, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/isblab/disobind
- Repository: https://github.com/isblab/disobind

## Overview

#### Purpose and operational entry point
Disobind is a Python deep-learning pipeline that predicts partner-dependent inter-protein contact maps and interface residues for a binary complex containing an intrinsically disordered region (IDR). The user-facing entry point is `run_disobind.py`; installation is orchestrated by `install.sh`. Inputs are CSV batches keyed by UniProt fragments or paired FASTA records, with optional AlphaFold2 structure and PAE inputs.

#### Inference orchestration
`run_disobind.py` parses CLI options for input format, output location, CPU/GPU device, contact-map mode, and coarse-graining level. It coordinates sequence acquisition or parsing, embedding generation, model loading, inference, and serialization. Outputs comprise a tabular prediction CSV and `Predictions.npy`, a nested prediction dictionary. Example inputs and AF2 artifacts are under `example/test.csv`, `example/test.fasta`, and `example/`.

#### Input, sequence, and structural boundary
CSV inputs identify UniProt accessions and residue ranges; FASTA supports sequences without accessions. Sequence retrieval and input preparation are implemented in dataset-oriented modules, notably `dataset/from_APIs_with_love.py` and `dataset/prep_idppi_input2.py`. Optional AF2 PDB/PAE paths, chain IDs, and residue offsets establish a separate structural-evidence boundary; the predictor remains sequence-based, while AF2-supported workflows are represented by supplied artifacts such as `example/unrelaxed_model_4_multimer_v3_pred_4.pdb`.

#### Representation and prediction model
The model stack is defined in `src/build_model.py`, `src/models/Epsilon_3.py`, and `src/models/get_model.py`. Pretrained Epsilon_3 checkpoints are versioned beneath `models/Epsilon_3/`, with matching architecture/hyperparameter definitions in `params/Model_config_Epsilon_3_*.yml`. Inference supports CPU or CUDA, with GPU use requiring CUDA 11.8 and NVIDIA drivers. Coarse-grained resolutions 1, 5, and 10 control output granularity; contact-map prediction is optional, while interface predictions are the default.

#### Dataset construction and reproducibility pipeline
Dataset generation is an ordered offline workflow: source aggregation, dataset-file creation, binary-complex derivation, then redundancy reduction. Its core stages are `dataset/1_disobind_databases.py`, `dataset/2_create_database_dataset_files.py`, `dataset/3_create_merged_binary_complexes.py`, and `dataset/4_create_non_redundant_dataset.py`. Inputs include curated disorder/interaction sources and PDB-derived records under `database/raw/` and `database/input_files/`. Embedding preparation is separated in `dataset/create_input_embeddings.py`.

#### Training and evaluation
Training infrastructure is in `src/`, with dataset loading, objectives, metrics, model-version selection, and hyperparameter search separated across `src/dataset_loaders.py`, `src/loss.py`, `src/metrics.py`, and `src/hparams_search.py`. This boundary consumes prepared embeddings/datasets and produces versioned checkpoints/configurations rather than being part of routine CLI inference.

#### Analysis and external integrations
Post-training benchmarking and comparative analysis reside in `analysis/analysis.py` and `analysis/side_analysis.py`. Integration scripts obtain or compare external predictions, including AF2 and DisoBind-related outputs, via `analysis/get_af_prediction.py`, `analysis/get_disobind_predictions.py`, and `analysis/get_other_method_preds.py`. External dependencies include UniProt sequence access, curated biological databases used during dataset assembly, optional AlphaFold2/ColabFold outputs, Zenodo-hosted data, PyTorch model execution, and CUDA-capable hardware.

Main entry points: [`run_disobind.py`](https://github.com/isblab/disobind/blob/main/run_disobind.py) (DisoBind CLI), [`src/build_model.py`](https://github.com/isblab/disobind/blob/main/src/build_model.py) (Model loading), [`dataset/4_create_non_redundant_dataset.py`](https://github.com/isblab/disobind/blob/main/dataset/4_create_non_redundant_dataset.py) (Nonredundant dataset), [`src/hparams_search.py`](https://github.com/isblab/disobind/blob/main/src/hparams_search.py) (Training & tuning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["CLI Inference"]
  node_cli["DisoBind CLI<br/>Python entry point<br/>[run_disobind.py]"]
  node_inputs["CSV / FASTA batches<br/>user input<br/>[test.csv]"]
  node_sequence_prep["Sequence preparation<br/>dataset module"]
  node_embeddings["Input embeddings<br/>representation stage"]
  node_af2_evidence["Optional AF2 evidence<br/>structural artifact"]
  node_predictions["Prediction outputs<br/>serialized results"]
end

subgraph group_data["Dataset Pipeline"]
  node_source_data[("Curated source records<br/>biological data")]
  node_dataset_aggregation["Source aggregation<br/>offline stage"]
  node_dataset_files["Dataset-file creation<br/>offline stage"]
  node_binary_complexes["Binary complex derivation<br/>offline stage"]
  node_nonredundant_data[("Nonredundant dataset<br/>training dataset")]
end

subgraph group_model["Model &amp; Training"]
  node_predictor["Epsilon_3 predictor<br/>PyTorch model<br/>[Epsilon_3.py]"]
  node_model_builder["Model loading<br/>model factory<br/>[build_model.py]"]
  node_checkpoints[("Pretrained checkpoints<br/>model artifacts")]
  node_model_configs["Model configurations<br/>hyperparameters"]
  node_training["Training &amp; tuning<br/>training pipeline<br/>[hparams_search.py]"]
end

subgraph group_analysis["Analysis &amp; Integrations"]
  node_benchmarking["Benchmarking &amp; comparisons<br/>analysis pipeline<br/>[analysis.py]"]
  node_external_services{{"External services<br/>external dependency"}}
end

node_inputs -->|"submitted to"| node_cli
node_cli -->|"prepares sequences"| node_sequence_prep
node_sequence_prep -->|"sequences"| node_embeddings
node_af2_evidence -.->|"optional structural inputs"| node_cli
node_embeddings -->|"representations"| node_predictor
node_cli -->|"loads model"| node_model_builder
node_model_builder -->|"constructs"| node_predictor
node_checkpoints -->|"weights"| node_model_builder
node_model_configs -->|"architecture settings"| node_model_builder
node_predictor -->|"interface/contact predictions"| node_predictions
node_cli -->|"serializes"| node_predictions
node_external_services -.->|"UniProt access"| node_sequence_prep
node_external_services -.->|"curated sources"| node_source_data
node_source_data -->|"records"| node_dataset_aggregation
node_dataset_aggregation -->|"assembled data"| node_dataset_files
node_dataset_files -->|"dataset files"| node_binary_complexes
node_binary_complexes -->|"reduce redundancy"| node_nonredundant_data
node_nonredundant_data -->|"training representations"| node_embeddings
node_nonredundant_data -->|"training data"| node_training
node_training -->|"produces"| node_checkpoints
node_training -->|"selects settings"| node_model_configs
node_predictions -->|"evaluates"| node_benchmarking
node_external_services -.->|"external predictions"| node_benchmarking

click node_cli "https://github.com/isblab/disobind/blob/main/run_disobind.py"
click node_inputs "https://github.com/isblab/disobind/blob/main/example/test.csv"
click node_sequence_prep "https://github.com/isblab/disobind/blob/main/dataset/from_APIs_with_love.py"
click node_embeddings "https://github.com/isblab/disobind/blob/main/dataset/create_input_embeddings.py"
click node_af2_evidence "https://github.com/isblab/disobind/blob/main/example/unrelaxed_model_4_multimer_v3_pred_4.pdb"
click node_predictor "https://github.com/isblab/disobind/blob/main/src/models/Epsilon_3.py"
click node_model_builder "https://github.com/isblab/disobind/blob/main/src/build_model.py"
click node_dataset_aggregation "https://github.com/isblab/disobind/blob/main/dataset/1_disobind_databases.py"
click node_dataset_files "https://github.com/isblab/disobind/blob/main/dataset/2_create_database_dataset_files.py"
click node_binary_complexes "https://github.com/isblab/disobind/blob/main/dataset/3_create_merged_binary_complexes.py"
click node_nonredundant_data "https://github.com/isblab/disobind/blob/main/dataset/4_create_non_redundant_dataset.py"
click node_training "https://github.com/isblab/disobind/blob/main/src/hparams_search.py"
click node_benchmarking "https://github.com/isblab/disobind/blob/main/analysis/analysis.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_inputs,node_sequence_prep,node_embeddings,node_af2_evidence,node_predictions toneBlue
class node_source_data,node_dataset_aggregation,node_dataset_files,node_binary_complexes,node_nonredundant_data toneAmber
class node_predictor,node_model_builder,node_checkpoints,node_model_configs,node_training toneMint
class node_benchmarking,node_external_services toneRose
```

## Components

### CLI Inference

- [DisoBind CLI](https://github.com/isblab/disobind/blob/main/run_disobind.py): Python entry point · Coordinates end-to-end prediction. · `run_disobind.py`
- [CSV / FASTA batches](https://github.com/isblab/disobind/blob/main/example/test.csv): user input · UniProt fragments or paired sequences. · `example/test.csv`
- [Sequence preparation](https://github.com/isblab/disobind/blob/main/dataset/from_APIs_with_love.py): dataset module · Retrieves UniProt sequences and prepares IDPPI inputs. · `dataset/from_APIs_with_love.py`
- [Input embeddings](https://github.com/isblab/disobind/blob/main/dataset/create_input_embeddings.py): representation stage · `dataset/create_input_embeddings.py`
- [Optional AF2 evidence](https://github.com/isblab/disobind/blob/main/example/unrelaxed_model_4_multimer_v3_pred_4.pdb): structural artifact · PDB/PAE, chains, and offsets supplement the workflow without driving prediction. · `example/unrelaxed_model_4_multimer_v3_pred_4.pdb`
- **Prediction outputs**: serialized results · Prediction CSV and nested Predictions.npy dictionary.

### Dataset Pipeline

- **Curated source records**: biological data · Disorder, interaction, and PDB-derived inputs.
- [Source aggregation](https://github.com/isblab/disobind/blob/main/dataset/1_disobind_databases.py): offline stage · `dataset/1_disobind_databases.py`
- [Dataset-file creation](https://github.com/isblab/disobind/blob/main/dataset/2_create_database_dataset_files.py): offline stage · `dataset/2_create_database_dataset_files.py`
- [Binary complex derivation](https://github.com/isblab/disobind/blob/main/dataset/3_create_merged_binary_complexes.py): offline stage · `dataset/3_create_merged_binary_complexes.py`
- [Nonredundant dataset](https://github.com/isblab/disobind/blob/main/dataset/4_create_non_redundant_dataset.py): training dataset · `dataset/4_create_non_redundant_dataset.py`

### Model & Training

- [Epsilon_3 predictor](https://github.com/isblab/disobind/blob/main/src/models/Epsilon_3.py): PyTorch model · Predicts interface residues and optional contact maps. · `src/models/Epsilon_3.py`
- [Model loading](https://github.com/isblab/disobind/blob/main/src/build_model.py): model factory · `src/build_model.py`
- **Pretrained checkpoints**: model artifacts
- **Model configurations**: hyperparameters
- [Training & tuning](https://github.com/isblab/disobind/blob/main/src/hparams_search.py): training pipeline · Loads datasets, optimizes objectives, evaluates metrics, and selects model versions. · `src/hparams_search.py`

### Analysis & Integrations

- [Benchmarking & comparisons](https://github.com/isblab/disobind/blob/main/analysis/analysis.py): analysis pipeline · Evaluates DisoBind alongside external prediction methods. · `analysis/analysis.py`
- **External services**: external dependency · UniProt, curated databases, Zenodo, and optional AlphaFold2/ColabFold.

## Connections

- CSV / FASTA batches → DisoBind CLI: submitted to
- DisoBind CLI → Sequence preparation: prepares sequences
- Sequence preparation → Input embeddings: sequences
- Optional AF2 evidence → DisoBind CLI: optional structural inputs
- Input embeddings → Epsilon_3 predictor: representations
- DisoBind CLI → Model loading: loads model
- Model loading → Epsilon_3 predictor: constructs
- Pretrained checkpoints → Model loading: weights
- Model configurations → Model loading: architecture settings
- Epsilon_3 predictor → Prediction outputs: interface/contact predictions
- DisoBind CLI → Prediction outputs: serializes
- External services → Sequence preparation: UniProt access
- External services → Curated source records: curated sources
- Curated source records → Source aggregation: records
- Source aggregation → Dataset-file creation: assembled data
- Dataset-file creation → Binary complex derivation: dataset files
- Binary complex derivation → Nonredundant dataset: reduce redundancy
- Nonredundant dataset → Input embeddings: training representations
- Nonredundant dataset → Training & tuning: training data
- Training & tuning → Pretrained checkpoints: produces
- Training & tuning → Model configurations: selects settings
- Prediction outputs → Benchmarking & comparisons: evaluates
- External services → Benchmarking & comparisons: external predictions
