Skip to main content

A unified Python library for structural bioinformatics, MD, protein engineering, and ML.

Project description

molforge

CI PyPI version Python versions License: MIT Code style: ruff

Molforge Logo

A forge for protein workflows. One Python script, every tool in your stack: docking, MD, folding, antibody and nanobody engineering, de novo design — without the format-conversion tax.

molforge is an open-source Python library that lets you compose protein workflows across the tools you already use. Bring your structures and sequences in, plug in your engines of choice (Vina, OpenMM, ESMFold, AlphaFold, RFdiffusion, ProteinMPNN, your own model), and walk out with a coherent pipeline instead of five incompatible Python environments and a graveyard of conversion scripts.


Why molforge exists

Modern protein work is multi-tool by nature. A real antibody-design loop might fold a sequence with ESMFold, identify CDR loops with anarci, score binding with FoldX, dock against a target with AutoDock Vina, relax with OpenMM, then evaluate with Rosetta. Each of those tools speaks its own dialect: different file formats, different atom-naming conventions, different ideas of what "the structure" is. Most of an engineer's day disappears into glue code.

molforge is the connective tissue. It provides:

  • A canonical, NumPy-backed data model that's cheap to convert in and out of — so every engine in your pipeline reads from and writes to the same representation.
  • Thin wrappers around the engines you already trust, with consistent interfaces (so swapping ESMFold for AlphaFold is one line, not a refactor).
  • First-class IO for the messy reality of structural-bio files: PDB, mmCIF, FASTA, PDBQT, PQR, SDF, MOL2, and AlphaFold predictions with pLDDT.
  • A plugin registry so the next docking engine, folding model, or scoring function can slot into your pipeline without forking molforge.

Built as a library, not a framework: there's no orchestrator, no DAG runtime, no decorators you have to import to make things work. Use whatever workflow tool you like — Snakemake, Nextflow, Prefect, a shell script — molforge is just imports.

Design principles

  1. Workflows over silos. Every design decision is judged by "does this make it easier to chain N tools together?"
  2. Wrappers, not reimplementations. We don't rebuild OpenMM or AutoDock. We give them a shared vocabulary.
  3. One data model, two views. Hierarchical (protein.chains["A"].residues[42]) for biology, linear (protein.atom_array.coords) for ML — same data, no conversion.
  4. Heterogeneous content is first-class. Antibodies have glycans. Drug targets have ligands and ions. Membrane proteins have lipids. The data model handles all of it without an awkward special case for "non-protein."
  5. Typed, tested, documented. Strict mypy, ruff-clean, >90% coverage target.

Installation

# minimal core (data model + sequence + basic IO)
pip install molforge

# with structure analysis (RMSD, SASA, contacts)
pip install "molforge[structure]"

# with ML wrappers (torch, transformers, esm)
pip install "molforge[ml]"

# with MD support (openmm, mdtraj)
pip install "molforge[md]"

# with docking (rdkit for small molecules)
pip install "molforge[docking]"

# everything
pip install "molforge[all]"

# development
git clone https://github.com/DoctorDean/molforge.git
cd molforge
pip install -e ".[dev,all]"

Quickstart

The smallest end-to-end example that shows the cross-tool point:

import molforge as mf
from molforge.wrappers.folding import ESMFold
from molforge.wrappers.docking import Vina
from molforge.wrappers.md import OpenMM

# 1. Fold a sequence
folded = ESMFold().predict("MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVS...")

# 2. Save as PDB, save as mmCIF, hand to anything
mf.save(folded, "candidate.pdb")
mf.save(folded, "candidate.cif")

# 3. Dock a ligand against it (Vina-prepared PDBQT files)
result = Vina().dock(
    receptor="receptor.pdbqt",
    ligand="ligand.pdbqt",
    center=(10.0, 5.0, -2.0),
    box_size=(20.0, 20.0, 20.0),
)
top_pose = result.best

# 4. Drop into MD for relaxation
trajectory = OpenMM().simulate(top_pose.complex, steps=10_000)

# 5. Inspect — hierarchical or linear, your call
print(folded.sequence)                            # one-letter per chain
print(folded.atom_array.coords.shape)             # (N, 3) NumPy array
ca = folded.chains["A"].residues[42].atoms["CA"]  # specific atom

Notice what isn't there: file-format conversions, atom-name remapping, hand-rolled PDB parsers, custom data classes per engine. molforge does that work so your script reads like the science you're actually doing.

Repository structure

molforge/
├── src/molforge/             # Library source (src-layout)
│   ├── core/                 # Hierarchical + linear data model
│   ├── sequence/             # Sequence operations, alignment, mutations
│   ├── structure/            # RMSD, SASA, contacts, geometry
│   ├── md/                   # MD trajectories and analysis
│   ├── docking/              # Docking abstractions and pose handling
│   ├── ml/                   # ML utilities, featurizers, tensor views
│   ├── io/                   # PDB, mmCIF, FASTA, PDBQT, PQR, SDF, MOL2
│   ├── plugins/              # Plugin registry and entry-point discovery
│   ├── metrics/              # TM-score, lDDT, GDT-TS, docking metrics
│   └── wrappers/             # Thin interfaces to external engines
│       ├── folding/          # AlphaFold, ESMFold, Boltz, Rosetta
│       ├── docking/          # AutoDock Vina, DiffDock
│       └── md/               # OpenMM, GROMACS
├── tests/                    # pytest suite (unit + integration)
├── docs/                     # Architecture docs and reference
├── notebooks/                # Walkthroughs and worked examples
├── plugins/                  # Example external plugins
├── pyproject.toml            # Build config, deps, tool config
└── ACKNOWLEDGEMENTS.md       # Prior art and intellectual debts

A deeper architecture walkthrough is in docs/architecture/overview.md.

Status

molforge is pre-1.0 and under active development. What's working today:

  • Core data modelProtein / Chain / Residue / Atom over a canonical NumPy-backed AtomArray, with first-class heterogeneous content (ligands, water, ions, modified residues).
  • File I/O — full read/write for PDB (with NMR ensembles, altlocs, insertion codes) and mmCIF (the modern format for large structures); FASTA sequence I/O; AlphaFold loader that surfaces pLDDT as a first-class field. PDBQT, PQR, SDF, MOL2 are stubbed with committed APIs.
  • Sequence operations — pairwise alignment (Needleman-Wunsch / Smith-Waterman with BLOSUM62 / PAM250), point mutations with protein-engineering notation (A123V, A123V/T56K, H:K42N), composition and property helpers (MW, GRAVY, aromaticity).
  • Structural analysis — Kabsch/Umeyama superposition, RMSD (whole-structure and per-residue, multiple atom subsets), contact and distance maps, radius of gyration, centroid / center of mass, in-place translate / rotate, DSSP secondary-structure assignment (8-state and 3-state, no external binary).
  • Two engine wrappers working end-to-endESMFold (sequence → folded Protein, pip install 'molforge[ml]') and AutoDock Vina (receptor + ligand → ranked docking poses, pip install vina meeko). The wrapper pattern is now validated across both folding and docking categories; the rest follow the same template.

Coming next: SASA, backbone dihedrals (φ/ψ/ω), meeko-based receptor/ligand prep for Vina, additional engine wrappers (AlphaFold, OpenMM). See CHANGELOG.md for the full picture.

Acknowledgements

molforge is inspired by Protkit (SilicoGenesis), which pioneered the idea of a unified, hierarchical representation for protein structures in Python. molforge extends that direction toward cross-tool, cross-format workflows and a different internal architecture (NumPy-backed linear store, hierarchical views as accessors). See ACKNOWLEDGEMENTS.md for the longer list of projects we've learned from.

Contributing

We welcome contributions. See CONTRIBUTING.md and the Code of Conduct before opening an issue or PR.

License

MIT — see LICENSE.

Citation

If you use molforge in academic work, please cite us (BibTeX coming with the first tagged release).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molforge-0.0.1.tar.gz (98.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

molforge-0.0.1-py3-none-any.whl (90.5 kB view details)

Uploaded Python 3

File details

Details for the file molforge-0.0.1.tar.gz.

File metadata

  • Download URL: molforge-0.0.1.tar.gz
  • Upload date:
  • Size: 98.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for molforge-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b04690f955c3b37e5c319a881f960743136946c566878526e94fa1c770fab92d
MD5 3546fdd914a300fd06f60e2f836282ea
BLAKE2b-256 1e79b02568858fddf93b16e0054f2c4f121f851fd7a3636a640641c648653a95

See more details on using hashes here.

File details

Details for the file molforge-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: molforge-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 90.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for molforge-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c664c3d43d3e87febaad248340f109ea2478c7337bc5224331a1fb987eb72d3d
MD5 9c8133861daacf19b27164518551c68b
BLAKE2b-256 9e2f2ffa635eca635299a0afff4eda0538dc8d25cf1e46bb2faeae77878e2f9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page