Skip to content

Repository files navigation

PhaseFlow: A Unified Multi-Modal Generative Model for Phase-Separating Proteins

PhaseFlow

Python Models Datasets Online Demo License

A unified multi-modal generative model that connects amino-acid sequences, phase diagrams, residue context, structure-derived features, protein graphs, LLPS propensity, DPR localization, and mutation-effect scoring.

Get Started: Quick Start Install PhaseFlow Try PhaseFlow online


Model Overview

PhaseFlow is organized around one modeling goal: learn how sequence-level, phase-diagram, and protein-context signals map into phase-separation behavior, then use those learned mappings for prediction, localization, and design.

Signal family Role in PhaseFlow
Peptide sequence tokens Sequence-to-phase prediction and phase-conditioned sequence generation
4x4 PSSI phase diagrams Compact representation of phase-separation score landscapes
Flow Matching and causal language modeling Fast phase-diagram regression and target-conditioned peptide design
Protein residue context Protein-level LLPS prediction and residue-level DPR scanning
ESM2, physicochemical, disorder, structure, graph, and local-context features Multi-modal protein representations for protein tasks
Ordered bridge tokens Transfer short-peptide sequence-phase knowledge into protein modeling

Application

PhaseFlow application overview

PhaseFlow supports a connected set of phase-separation applications: designing peptide sequences from target phase diagrams, predicting phase diagrams from candidate sequences, scanning proteins for LLPS-driving regions, and estimating mutation effects on phase-separation behavior. These workflows share the same sequence-phase modeling foundation while exposing outputs that map naturally to peptide design, protein annotation, and mutagenesis analysis.

Unified Model Architecture

Short-Peptide Sequence-Phase Generator

Short-peptide PhaseFlow architecture

The short-peptide module is the bidirectional sequence-phase model. For sequence-to-phase prediction, peptide tokens and phase-grid tokens pass through shared Transformer blocks and a Flow Matching velocity head to predict a 4x4 PSSI diagram. For phase-to-sequence design, the same architecture conditions on the target phase diagram and uses causal language modeling to generate peptide sequences.

Protein LLPS And DPR Model

Protein PhaseFlow architecture

The protein module handles protein-scale context separately from the short-peptide task. It combines residue-level ESM2, physicochemical, disorder, structure-derived, graph, and local-context features, then bridges peptide sequence-phase knowledge through ordered bridge tokens and residue-query cross-attention. The outputs are protein-level LLPS probability and DPR scanner profiles that are post-processed into droplet-promoting region calls.


Why Use PhaseFlow?

You should consider PhaseFlow when your phase-separation workflow needs:

🧬 Unified multi-modal generative model Brings sequence, phase-diagram, residue-context, structure-derived, graph, LLPS, DPR, and mutation-effect signals into one PhaseFlow workflow.
🧪 Multi-scale LLPS modeling Covers short-peptide phase diagrams, protein LLPS, DPR localization, and mutation-effect scoring.
🔁 Bidirectional peptide model Learns mappings between amino-acid sequences and 4x4 phase-separation score index (PSSI) diagrams.
Flow Matching for phase diagrams Supports faster phase-conditioned peptide design loops than diffusion-style sampling.
🔎 Protein LLPS and DPR scanning Predicts protein-level LLPS propensity and localizes droplet-promoting regions from residue context.
🌉 Staged transfer bridge Transfers short-peptide sequence-phase knowledge to proteins through 32 ordered bridge tokens.
🧫 Mutation-effect scoring Amino-acid perturbations can be scored for predicted shifts in phase-separation behavior.
🧠 Rich protein features Combines ESM2, physicochemical, disorder, Protenix-derived, graph, and residue-context signals.
📦 Artifact-ready layout Code, configs, docs, figures, local datasets, and local model downloads are separated so GitHub stays lightweight while Hugging Face artifacts can be added cleanly.

Key Results

The values below are summarized from the tracked configs, audit reports, and figure artifacts in this repository. They are included to make the README useful as a project entry point; detailed provenance remains in configs/protein/ and docs/protein/.

Task Evaluation setting PhaseFlow result
Protein LLPS PPMC full panel AUPRC 0.752, AUROC 0.874
Protein LLPS threshold 0.5 MCC 0.549, F1 0.676
Peptide phase prediction complete held-out peptide diagrams Spearman 0.4168, Pearson 0.4219, MSE 0.5652
Flow Matching vs DDPM matched peptide phase-grid comparison mean Spearman 0.559 vs 0.277; MSE 0.570 vs 1.315
DPR localization PhasePro, p257 readout residue AUPRC 0.712, top-5 enrichment 1.813
DPR region calling IoU 0.25 region matching recall 0.580, precision 0.638, segment F1 0.608
Mutation effects TDP-43 point-mutation panels strongest average ranking/classification metrics among compared methods in the included benchmark summary

Key Modules

Module Path Description
Peptide core package phaseflow/ Tokenizer, peptide Transformer, Flow Matching/DDPM model, utilities
Protein package phaseflow/protein/ Protein model structure, data contracts, reusable feature/structure functions, objectives, metrics, and post-processing
Peptide configs configs/peptide/ Lightweight peptide training defaults
Protein configs configs/protein/ LLPS and DPR training configurations
Peptide scripts scripts/peptide/ Training, inference, resume, and experiment launchers
Protein scripts scripts/protein/ Reproduction workflows for data construction, training, evaluation, release validation, and benchmark utilities
Examples examples/ Small peptide demo inputs and phase-to-sequence example
Tests tests/ Peptide smoke tests and focused protein tests
Figures figures/ Curated README and paper-result figures
Research workflows research/ Short-peptide experiments and analysis scripts
Local artifacts artifacts/ Placeholder for local datasets, model downloads, and curated result artifacts

Table of Contents


Public Resources

Resource Link Purpose
Source code GitHub: kevinhyj/PhaseFlow Installation, workflows, configurations, and documentation
Unified checkpoint Hugging Face: GENTEL-Lab/PhaseFlow Combined peptide, full-protein, and DPR runtime weights
Training data Hugging Face: GENTEL-Lab/OpenPhase Public peptide, LLPS, and DPR research-data packages
Online demo phaseflow.bio Interactive PhaseFlow usage

Quick Start

Install the source package:

git clone <your-phaseflow-repo-url>
cd PhaseFlow
conda env create -f environment.yml
conda activate phaseflow
python -m pip install -e .
python -c "import phaseflow; print(phaseflow.__version__)"

Download the public training data and the combined runtime checkpoint:

huggingface-cli download GENTEL-Lab/OpenPhase \
  --repo-type dataset \
  --local-dir artifacts/data/peptide

hf download GENTEL-Lab/PhaseFlow PhaseFlow.pt \
  --local-dir artifacts/models

Run peptide sequence-to-phase inference:

bash scripts/peptide/infer.sh \
  artifacts/models/peptide/best_model.pt \
  examples/sequences.txt \
  artifacts/results/peptide/predicted_phases.csv \
  0

The training data are hosted at GENTEL-Lab/OpenPhase. The combined PhaseFlow runtime checkpoint contains peptide, full-protein, and DPR weights. It is intended for the combined runtime; the standalone peptide scripts below still expect a peptide-only best_model.pt checkpoint.

Installation

Local source install

conda env create -f environment.yml
conda activate phaseflow
python -m pip install -e .

Install optional protein and test dependencies:

python -m pip install -e ".[protein,test]"

Install optional feature-generation dependencies:

python -m pip install -e ".[plm,starling]"

The default source install is intended for code reuse, peptide workflows, and lightweight checks. Protein reproduction requires external data, feature stores, and model checkpoints that are not committed to Git.

Repository Layout

phaseflow/                 Peptide and protein packages
phaseflow/protein/         Protein model structure and reusable core components
configs/peptide/           Short-peptide configs
configs/protein/       Protein LLPS and DPR configs
docs/peptide/              Short-peptide documentation
docs/protein/          Protein documentation and audit reports
scripts/peptide/           Short-peptide training and inference launchers
scripts/protein/       Protein reproduction workflows and command adapters
scripts/protein/analysis/      Protein benchmark and threshold analyses
scripts/protein/inference/     Standalone protein DPR inference
tests/peptide/             Short-peptide smoke tests
tests/protein/         Protein focused tests
examples/                  Short-peptide demo inputs
scripts/peptide/workflows/     Short-peptide training, inference, and evaluation entry points
scripts/peptide/analysis/      Short-peptide analysis scripts
artifacts/results/peptide/     Curated short-peptide analysis outputs
artifacts/results/protein/     Protein publication results and renderers
figures/peptide/           Short-peptide figures
figures/protein/       Protein LLPS/DPR figures
artifacts/data/            Local datasets and generated feature stores
artifacts/models/          Local model checkpoints downloaded from Hugging Face
artifacts/results/         Lightweight curated result artifacts

Models And Datasets

Large artifacts are intentionally separated from the source repository.

Suggested local layout:

artifacts/data/
  peptide/                 Phase-diagram CSV/NPZ data and split files
  protein/                 Manifests, feature stores, benchmark inputs
artifacts/models/
  PhaseFlow.pt             Combined peptide, full-protein, and DPR checkpoint
  peptide/                 Optional standalone peptide-only checkpoints

Public peptide training-data download:

huggingface-cli download GENTEL-Lab/OpenPhase \
  --repo-type dataset \
  --local-dir artifacts/data/peptide

hf download GENTEL-Lab/PhaseFlow PhaseFlow.pt \
  --local-dir artifacts/models
Resource Local target Status
OpenPhase training data artifacts/data/peptide/ Available on Hugging Face
Protein feature/data bundle artifacts/data/protein/ Not yet released
Combined peptide, full-protein, and DPR checkpoint artifacts/models/PhaseFlow.pt Available on Hugging Face
Standalone peptide-only checkpoint artifacts/models/peptide/ Not yet released

Short-Peptide Usage

Train

bash scripts/peptide/train.sh \
  --config configs/peptide/peptide.yaml \
  --data artifacts/data/peptide/phase_diagram_original_scale.csv \
  --output-dir outputs/peptide \
  --gpu 0 \
  --foreground

Predict phase diagrams from sequences

bash scripts/peptide/infer.sh \
  artifacts/models/peptide/best_model.pt \
  examples/sequences.txt \
  artifacts/results/peptide/predicted_phases.csv \
  0

Generate sequences from target phase diagrams

python examples/phase2seq_demo.py \
  --checkpoint artifacts/models/peptide/best_model.pt \
  --input_csv artifacts/data/peptide/test_set.csv \
  --num_samples 5

Evaluate peptide models

python scripts/peptide/workflows/evaluate_seq2phase.py \
  --test_path artifacts/data/peptide/test_set.csv \
  --models_dir outputs/peptide

Protein Usage

The protein code is packaged under phaseflow.protein. It expects downloaded model checkpoints and feature/data bundles under artifacts/models/protein/ and artifacts/data/protein/.

Protein training configurations:

  • configs/protein/llps.yaml
  • configs/protein/dpr.yaml

IDR sliding-window peptide PhaseFlow helper

python scripts/protein/inference/predict_protein_dpr.py \
  --input artifacts/data/protein/idr_sequences.xlsx \
  --checkpoint artifacts/models/peptide/best_model.pt \
  --output runs/protein/idr_phaseflow_profiles.jsonl \
  --csv runs/protein/idr_phaseflow_profiles.csv

DPR training entry point

torchrun --nproc_per_node=8 scripts/protein/run.py train-dpr \
  --config configs/protein/dpr.yaml \
  --arm dpr \
  --updates 50 \
  --output-root runs/dpr

This command requires the protein data package, reconstructed feature stores, and checkpoints referenced by the config.

Protein figures

python artifacts/results/protein/scripts/figures/plot_llps_benchmark.py --help
python artifacts/results/protein/scripts/figures/plot_dpr_benchmark.py --help
python artifacts/results/protein/scripts/figures/plot_model_architecture.py \
  --output-dir runs/figures/protein

Evaluation And Checks

Short-peptide checks:

python -m compileall phaseflow scripts/peptide examples tests/peptide
python -m unittest discover tests/peptide

Protein checks:

python -m compileall phaseflow/protein scripts/protein tests/protein
python -m pytest tests/protein/test_imports.py tests/protein/test_phaseflow_fusion.py

Install test dependencies if pytest is unavailable:

python -m pip install -e ".[test]"

Input And Output Formats

Peptide sequence input

scripts/peptide/infer.sh accepts a text file with one amino-acid sequence per line, or the underlying Python script can read a CSV column named AminoAcidSequence.

ACDEFGHIKLMNPQRSTVWY
GGGGGSSSSSQQQQQNNNNN

Peptide phase output

Sequence-to-phase inference writes a CSV with the sequence and 16 PSSI columns:

AminoAcidSequence,group_11,group_12,...,group_44
ACDEFGHIKLMNPQRSTVWY,0.12,-0.08,...,0.31

Protein IDR helper output

The IDR helper writes JSONL profiles and an optional compact CSV:

{"id":"IDR_000","length":120,"window_sizes":[20],"pssi_mean":0.14}

Artifact Policy

Git tracks code, configs, docs, tests, and curated lightweight figures/results. It does not track raw datasets, generated feature stores, model checkpoints, training logs, or large runtime outputs.

Local artifact paths:

  • artifacts/data/peptide/ and artifacts/data/protein/ for datasets and feature stores.
  • artifacts/models/peptide/ and artifacts/models/protein/ for Hugging Face model downloads.
  • outputs/ and logs/ for regenerated training or inference outputs.

The repository .gitignore excludes common checkpoint formats such as .pt, .pth, .ckpt, and .safetensors, and also ignores local model files under artifacts/models/.

Figures

Protein LLPS

Protein LLPS benchmark
Protein-level LLPS benchmark.
Protein LLPS ablation
Input-stream and weak-supervision ablations.

DPR Localization

DPR benchmark
Residue- and region-level DPR benchmark.
DPR ablation
DPR scanner input and bridge ablations.

PhaSePro DPR examples
Representative DPR profiles on PhasePro proteins.

Peptide Phase Prediction And Design

Peptide model comparison
Flow Matching and DDPM phase-diagram comparison.
Inference-time optimization
Phase-conditioned generation and rescoring loop.
Top tendency de novo peptide analysis
Generated high-tendency peptide candidates.
Low tendency de novo peptide analysis
Generated low-tendency peptide candidates.

Mutation Effects

Mutation benchmark metrics
TDP-43 point-mutation benchmark summary.
Multi-mutation dose response
Within-panel W-to-G multi-mutant trend.

Citation

Citation information will be added after the public manuscript and artifact release are finalized.

License

This project is licensed under the Apache License, Version 2.0. See LICENSE for details.

About

PhaseFlow: Multi-Scale Modeling and Design of Phase-Separating Proteins

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages