bio-structural-biology-geometric-analysis
Measures geometric properties of protein structures with Biopython Bio.PDB - interatomic distances, distance matrices, bond and dihedral angles (phi/psi/chi…
by lilinji★ 18 GitHub stars
Install bio-structural-biology-geometric-analysis in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Version Compatibility
Reference examples tested with: biopython 1.83+, numpy 1.26+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Geometric Analysis
"Calculate the RMSD between two conformations" -> superimpose on a defined atom correspondence, then report deviation.
- Python:
Bio.PDB.Superimposer(SVD/Kabsch);Bio.PDB.qcprotfor speed in tight loops "How buried is this residue?" -> compute solvent accessible surface area and normalize to a per-residue maximum. - Python:
Bio.PDB.SASA.ShrakeRupley, then relative SASA against a max-ASA scale
Governing Principle: the metric IS the question
RMSD is NOT a property of two structures. It is a property of two structures GIVEN a superposition AND an atom selection - change either and the number changes. Report what was aligned (CA-only? a defined core? all-atom?) or the number is uninterpretable.
Global all-atom RMSD is a mean of SQUARED per-atom deviations after a least-squares rigid-body fit, so it is dominated by the worst-fitting atoms. A structure whose 150-residue core is essentially identical but whose 10-residue loop or a hinge-rotated domain swings out by 15A reports a "bad" whole-molecule RMSD (often 4-8A) that hides a near-perfect core. RMSD is also length-dependent (longer proteins accumulate larger RMSD for the same local quality) and is NOT a cross-protein similarity metric - it is only meaningful when a genuine 1:1 correspondence exists (same protein, two states; a model vs its native).
Superimposer requires an equal-length, ORDERED atom-to-atom correspondence. Feeding it mismatched or unequal atom lists is the classic error; it computes the optimal fit (Kabsch via SVD), it does NOT solve which atom maps to which. Structures with different sequences need a structure-based alignment FIRST to establish the correspondence (see alignment/structural-alignment), then superposition.
SASA depends on the PROBE RADIUS (1.4A water is a convention, not a constant of nature), the algorithm (Bio.PDB ShrakeRupley is Shrake-Rupley only; freesasa offers Lee-Richards and LCPO), and whether hydrogens are present. A SASA number without its probe radius is meaningless, and absolute SASA in A^2 is not portable across tools. Prefer RELATIVE SASA (residue SASA / max-ASA of that residue type) using the Tien et al 2013 max-ASA scale.
Backbone phi/psi and omega/cis-peptides are a VALIDATION signal, not a description: a residue in a sterically disallowed Ramachandran region usually means a modeling error, not exotic biology. This skill computes the angles; interpreting outliers as quality flags belongs to structural-biology/structure-validation.
Decision: which comparison metric
| Metric | Answers (use for) | Caveat | Who reports it |
|---|---|---|---|
| RMSD on a defined core | same molecule, how far did it move after best-fit | needs a real 1:1 correspondence; outlier-dominated (squared mean); length- and selection-dependent; NOT cross-protein | Bio.PDB Superimposer.rms |
| TM-score (>0.5 = same fold) | different proteins - same fold? fold recognition | length-normalized and outlier-resistant, but asymmetric (state the reference chain); needs an alignment first | TM-align / US-align (alignment/structural-alignment) |
| GDT-TS / GDT-HA | CASP-style full-model accuracy vs native | superposition-based but fraction-within-cutoff, not a squared mean | LGA / CASP assessors |
| lDDT (0-100; pLDDT for AlphaFold models) | local model quality, multi-domain, without picking a superposition | superposition-free, immune to domain motion; the quantity pLDDT predicts | OpenStructure lDDT / AlphaFold pLDDT |
For cross-protein or fold-similarity work, do not stretch RMSD - route to alignment/structural-alignment (TM-align / Foldseek / DALI). For Ramachandran/omega as a quality gate, route to structural-biology/structure-validation.
Distance Between Atoms
from Bio.PDB import PDBParser
import numpy as np
parser = PDBParser(QUIET=True)
structure = parser.get_structure('protein', 'protein.pdb')
chain = structure[0]['A']
atom1, atom2 = chain[100]['CA'], chain[200]['CA']
distance = atom1 - atom2 # Atom subtraction returns the distance directly
print(f'Distance: {distance:.2f} A')
print(np.linalg.norm(atom1.coord - atom2.coord)) # Equivalent via numpy on the .coord arrays
Distance Matrix
import numpy as np
from Bio.PDB import PDBParser
parser = PDBParser(QUIET=True)
structure = parser.get_structure('protein', 'protein.pdb')
ca_atoms = [r['CA'] for r in structure.get_residues() if r.has_id('CA') and r.id[0] == ' '] # id[0]==' ' drops waters/hetero
n = len(ca_atoms)
dist = np.zeros((n, n))
for i in range(n):
fo
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- examples/measure_distance.py
- examples/relative_sasa.py
- examples/superimpose.py
- usage-guide.md
FAQ
What does the bio-structural-biology-geometric-analysis skill do?
Measures geometric properties of protein structures with Biopython Bio.PDB - interatomic distances, distance matrices, bond and dihedral angles (phi/psi/chi, Ramachandran), superposition and RMSD, center of mass, radius of gyration, and solvent accessible surface area (SASA). Use when deciding that RMSD depends on BOTH the superposition and the atom selection (a global all-atom RMSD is dominated by flexible loops and hinge motion and is NOT a cross-protein similarity metric); choosing the metric that matches the question (RMSD for same-molecule displacement, TM-score for same-fold, lDDT for superposition-free local model quality - the quantity pLDDT predicts); recognizing Superimposer needs an equal-length ordered atom-to-atom correspondence; and reporting SASA only alongside its probe radius (1.4A water, Shrake-Rupley) with a preference for relative SASA. Keywords RMSD, TM-score, lDDT, SASA, Shrake-Rupley, superposition, Kabsch, dihedral, Ramachandran, radius of gyration.
How do I install the bio-structural-biology-geometric-analysis skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the bio-structural-biology-geometric-analysis skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…