Skip to main content

ChiralFold

Chirality-correct protein stereochemistry toolkit — audit any PDB, fix AF3 chirality errors, build D-peptides by construction, and generate exact L↔D mirrors.

Tests Hugging Face Space Reproduce D-residue errors (5 min) Quick Demo


Start here

Goal Link
Use in a browser (upload PDB → correct / mirror → download) Hugging Face Space
Reproduce D-residue survey errors (<5 min) Colab notebook · or python benchmarks/reproduce_d_residue_errors.py
Interactive results dashboard Colab dashboard ⚠️ auto-installs (~1–2 min)
Demo: unusual cases + clash-safety Colab notebook

Install

Works on Linux, macOS, and Windows (Python 3.9–3.12).

# Recommended — always current (PyPI package pending Trusted Publisher setup)
pip install -U pip
pip install "chiralfold @ git+https://github.com/Tommaso-R-Marena/ChiralFold.git@v3.5.1"

# Or clone + editable
git clone https://github.com/Tommaso-R-Marena/ChiralFold.git
cd ChiralFold
pip install -e .

Note: Bare pip install chiralfold requires PyPI publishing to succeed. See docs/PYPI_PUBLISHING.md for Trusted Publisher setup (or set secret PYPI_API_TOKEN). Until then, use the Git install above — same package.

Core dependencies: numpy, scipy, pandas, rdkit.
Optional: pip install "chiralfold[web]" (Gradio UI) · pip install "chiralfold[viz]" (matplotlib/seaborn for benchmarks).

If rdkit fails on your platform:

conda install -c conda-forge rdkit
pip install "chiralfold @ git+https://github.com/Tommaso-R-Marena/ChiralFold.git"

Full platform notes: docs/INSTALL.md.

# Verify
python -c "import chiralfold; print(chiralfold.__version__)"
chiralfold --help

Reviewer path (<5 minutes, offline)

Reproduce the 29 D-label / L-coordinate mismatches from the frozen survey CSV — no network, no ChiralFold install required beyond numpy:

git clone --depth 1 https://github.com/Tommaso-R-Marena/ChiralFold.git
cd ChiralFold
pip install numpy   # only dependency for this script
python benchmarks/reproduce_d_residue_errors.py

Expected output: 12,573 checkable residues · 29 errors · 16 structures · rate 0.23%.

Or open the Reproduce D-residue errors Colab.


What ChiralFold does

from chiralfold import audit_pdb, correct_af3_output, mirror_pdb, ChiralFold

report = audit_pdb("protein.pdb")          # chirality, Rama, clashes, score
correct_af3_output("af3.pdb", "fixed.pdb") # fix inverted stereocenters
mirror_pdb("1YCR.pdb", "1YCR_D.pdb")       # exact L↔D (RMSD 0.0 Å)
pred = ChiralFold().predict("AFWKELDR")     # D-peptide, 0% violations by construction

Web UI (local):

pip install "chiralfold[web]"
chiralfold-web   # http://localhost:7860

Key results (at a glance)

Result Number Where
PDB-wide D-residue survey 12,573 residues · 29 errors in 16 structures (0.23%) results/d_residue_verification_summary.json
Experimental validation 14/14 non-borderline pass (2 borderline) results/experimental_validation_report.json
Ramachandran vs wwPDB (paper) n=362 · Spearman ρ=0.52 · Pearson r=0.853 results/ramachandran_279struct_chainfix_summary.json
AF3 synthetic correction 100% detection · 0% residual · ~37 ms results/af3_resource_benchmark.json
Mirror clashscore Unchanged (isometry — distances preserved) tests/test_clash_preservation.py
Lean 4 chirality no-go Distance-only reps cannot recover signed orientation formal/chirality_nogo/

MolProbity does not flag the D-residue annotation errors (L-only Cα check).


Unusual cases

ChiralFold is tested on structures that break naive assumptions:

Case Example What happens
Strained / cyclic macrocycle 1XT7 daptomycin · 2RMI astressin Signed volume still classifies Cα; Stereochem errors detected
Non-standard ligands (CCD) 1OF6 (8× DTY←L-Tyr) · 1BG0 DAR←L-Arg Coordinates match L; CCD InChI confirms mislabel
Ultra-high resolution 1HHZ (0.99 Å) DAL error Not a density/resolution artifact
Low-res / non-protein Rama 5M2K vancomycin glycopeptide Excluded from protein Rama benchmark by pre-specified rule

See demos/Demo_Unusual_Cases_Clash_Safety.ipynb and results/5m2k_benchmark_exclusion.json.

“By construction” does not invent clashes

  • Mirror L↔D is a global isometry: all pairwise distances are preserved → clashscore is identical before and after (tests/test_clash_preservation.py).
  • AF3 chirality correction reflects only the violating Cα across the N–C–Cβ plane, preserving CA–N / CA–C / CA–Cβ bond lengths. Clashscore may change slightly when a bad stereocenter is fixed; residual chirality violations go to 0%.

Repository map

chiralfold/          # Installable Python package
web/                 # Gradio UI (chiralfold-web)
hf_space/            # Hugging Face Space source
demos/               # Colab notebooks (start with Reproduce_PDB_D_Residue_Errors_5min)
benchmarks/          # Reproducible survey / validation / Rama scripts
results/             # Frozen CSV/JSON artefacts (do not hand-edit)
tests/               # pytest suite
paper/submission/    # Bioinformatics Overleaf package
docs/                # Install notes, navigation

Citation

@software{chiralfold2026,
  author = {Marena, Tommaso R.},
  title  = {ChiralFold: Chirality-correct protein stereochemistry toolkit},
  year   = {2026},
  url    = {https://github.com/Tommaso-R-Marena/ChiralFold}
}

AF3 D-peptide context: Childs, Zhou & Donald (2025) bioRxiv 10.1101/2025.03.14.643307.


License

MIT — see LICENSE.

Metadata

Release files for chiralfold 3.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chiralfold 3.5.1
File Size Uploaded
chiralfold-3.5.1.tar.gz 117.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chiralfold 3.5.1
File Interpreter ABI Platform
chiralfold-3.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 216.3 kB

Release files / chiralfold-3.5.1.tar.gz

Download URL chiralfold-3.5.1.tar.gz
Size 117.9 kB
Tags Source
SHA-256 checksum
How to use checksums
20a2790b9222619c031ee16ffad356932edf9c7918861416f1fba89371c3897b
BLAKE2b-256 checksum
How to use checksums
f39a5abb93d06595f8aedebbe13279541c93d8083ba96132e5d3e4bc3dddb2b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / chiralfold-3.5.1-py3-none-any.whl

Download URL chiralfold-3.5.1-py3-none-any.whl
Size 98.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
074cc914bdec482ae81380b64da95acbf37ef0a230f287e195d631a9a7814ed6
BLAKE2b-256 checksum
How to use checksums
6e33e9b8117cec7c2027383cf849b8fd1bf84d190a3780272540c5786284e0c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

3.5.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page