PDB & mmCIF 3D Macromolecular Structure (.pdb, .cif, .mmcif)
@modelscript/pdb (languages/pdb) provides native WebAssembly GLR parsing, backbone Ramachandran DAEBuilder lowering, and OpenSCAD / Modelica projections for Protein Data Bank (.pdb) and PDBx/mmCIF (.cif) 3D macromolecular structures.
Supported Extensions & Standards
| Extension | Format | Description |
|---|---|---|
.pdb, .ent | Legacy PDB Format | Fixed-column records (HEADER, TITLE, SEQRES, HELIX, SHEET, SSBOND, ATOM, HETATM, CONECT, END) |
.cif, .mmcif | PDBx / mmCIF | Macromolecular Crystallographic Information File (data_, loop_, _atom_site.*) |
Key Capabilities
1. Atomic Coordinates, Secondary Structure & Disulfide Bridges
- Extracts multi-chain 3D atomic coordinates
, occupancy, isotropic temperature factors ( -factors), -helices ( HELIX),-sheets ( SHEET), disulfide bonds (SSBOND), and ligand connectivity (CONECT). - Computes backbone torsion angles
, center of mass, and mass-weighted radius of gyration .
2. Gaussian Network Model (GNM) Elastic Normal Modes
- Constructs the
Kirchhoff contact matrix ( ) to compute theoretical residue mean-square fluctuations and correlate them against crystallographic -factors.
3. DAE Arena Lowering & 3D CSG / Modelica Export
- Lowers coarse-grained
harmonic spring networks into @modelscript/runtime'sDAEBuilderarena and projects structures into Modelica (pdbToModelica) and OpenSCAD 3D ball-and-stick CSG geometry (pdbToScad).
Pre-Flight Diagnostics
10 rules6 error4 warning
| Code | Rule | Severity | Message |
|---|---|---|---|
M9251 | steric-clash | error | Severe steric clash between non-bonded atoms '<atomA>' (serial '<serialA>') and '<atomB>' (serial '<serialB>') at distance '<distance>' Å (< 1.20 Å). |
M9252 | broken-peptide-backbone | warning | Broken peptide backbone in chain '<chainId>' between '<resA><seqA>' (C) and '<resB><seqB>' (N) at distance '<distance>' Å (> 2.00 Å). |
M9253 | invalid-occupancy | error | Atom '<atomName>' (serial '<serial>') has invalid occupancy '<occupancy>' outside allowed bounds [0.0, 1.0]. |
M9254 | non-positive-b-factor | warning | Atom '<atomName>' (serial '<serial>') has non-positive isotropic temperature factor (B-factor) '<bFactor>' Å^2 (<= 0.0). |
M9255 | ramachandran-outlier | warning | Residue '<resName><resSeq>' in chain '<chainId>' has Ramachandran backbone torsion angles (phi='<phi>' deg, psi='<psi>' deg) in a disallowed steric region. |
M9256 | missing-backbone-atoms | error | Standard amino acid residue '<resName><resSeq>' in chain '<chainId>' is missing required main-chain backbone atoms '<missingAtoms>'. |
M9257 | invalid-disulfide-distance | warning | Disulfide bond (SSBOND) between 'CYS<seq1>' (chain '<chain1>') and 'CYS<seq2>' (chain '<chain2>') has invalid SG-SG distance '<distance>' Å outside [1.80, 2.50] Å. |
M9258 | unresolved-conect-serial | error | CONECT record for atom serial '<conectSerial>' references unresolved atom serial '<missingSerial>'. |
M9259 | duplicate-atom-serial | error | Duplicate atom serial number '<serial>' declared on atom '<atomName>'. |
M9260 | empty-pdb-structure | error | Macromolecular structure '<structureId>' contains zero atomic coordinate records. |
Generated from languages/pdb/src/errors.ts. All languages →
CLI Usage
bash
# Validate steric clashes, peptide bond lengths, occupancy, and B-factors
msx lint CrambeTrypsinInhibitor.pdb
# Parse and inspect PDB or mmCIF macromolecular records
msx parse CrambeTrypsinInhibitor.pdb
