Professional PDB file processing toolkit with high-performance Rust core.
- PDB Parsing: Read and parse PDB files (X-ray, NMR structures)
- Geometry Calculations: RMSD (Kabsch), distances, angles, dihedrals
- Contact Analysis: Atomic contacts, interchain contacts
- Structure Alignment: Superposition, per-residue comparison
- CLI Interface: Command-line tools for common tasks
- Rust Core: Optional high-performance backend via PyO3
# Using mamba (recommended)
mamba env create -f environment.yml
mamba activate openpdb
pip install -e .
# Using pip
pip install -e .from openpdb import parse_pdb, compute_rmsd
# Parse PDB file
struct = parse_pdb("protein.pdb")
print(f"Atoms: {struct.num_atoms}, Chains: {struct.num_chains}")
# Compute RMSD
import numpy as np
coords1 = struct.coords
coords2 = coords1 + np.random.normal(0, 0.5, coords1.shape)
rmsd = compute_rmsd(coords1, coords2)
print(f"RMSD: {rmsd:.4f} Å")# Show PDB info
openpdb info show protein.pdb
# Calculate RMSD
openpdb rmsd calc ref.pdb mob.pdb
# Find contacts
openpdb contacts find protein.pdb --cutoff 5.0
# Align structures
openpdb align superpose ref.pdb mob.pdb -o aligned.pdb| Command | Description |
|---|---|
openpdb info show <file> |
Display PDB file information |
openpdb info chains <file> |
List all chains |
openpdb info residues <file> |
List all residues |
openpdb rmsd calc <ref> <mob> |
Calculate RMSD between two structures |
openpdb rmsd multi <ref> <mob1> <mob2>... |
RMSD against multiple structures |
openpdb contacts find <file> |
Find atomic contacts |
openpdb contacts interchain <file> |
Find interchain contacts |
openpdb align superpose <ref> <mob> |
Superpose and save aligned structure |
openpdb align compare <ref> <mob> |
Per-residue RMSD comparison |
openpdb search atom <file> --name CA |
Search atoms by name |
openpdb search residue <file> --name ALA |
Search residues by name |
openpdb search range <file> -s 1 -e 100 |
Search residue range |
openpdb search nearby <file> --x 0 --y 0 --z 0 |
Find atoms near a point |
src/openpdb/
├── core/ # PDB data structures and parsing
├── cli/ # Command-line interface
├── formats/ # PDB file writing
├── analysis/ # Structure analysis
├── docking/ # Molecular docking (optional, requires RDKit)
├── md/ # Molecular dynamics (optional, requires OpenMM)
└── utils/ # Logging and validation
# Install dev dependencies
mamba install pytest pytest-cov ruff mypy
# Run tests
pytest tests/
# Lint
ruff check src/
ruff format src/MIT