agentsclimarketplace

Structure alignment analysis

Skill ANaka/claudemol/claude-plugin/skills/structure-alignment-analysis

Use when comparing protein structures, aligning molecules, calculating RMSD, or visualizing structural differences through PyMOL.From its SKILL.md

Install
npx -y skills add ANaka/claudemol --skill structure-alignment-analysis

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

6.2 KB, as published. Nobody here has run it

Structure Alignment & Analysis

Workflows for structural comparison of proteins and other molecules.

Send all cmd.* code via: ~/.pymol-agent-bridge/bin/pymol-agent-bridge exec "..." (or heredoc for multi-line). See @pymol-fundamentals for details.

Alignment Methods

align - Sequence + Structure

Best for: Homologous proteins with similar sequences.

# Basic alignment (mobile moves to target)
result = cmd.align("mobile", "target")

# Result tuple: (RMSD, aligned_atoms, cycles, RMSD_pre, aligned_pairs, raw_score, align_length)
print("RMSD: " + str(round(result[0], 2)) + " A")
print("Atoms aligned: " + str(result[1]))
print("Refinement cycles: " + str(result[2]))

super - Structure Only

Best for: Proteins with low sequence identity but structural similarity.

result = cmd.super("mobile", "target")
print("RMSD: " + str(round(result[0], 2)) + " A")
print("Atoms aligned: " + str(result[1]))

cealign - Combinatorial Extension

Best for: Detecting distant structural homology.

result = cmd.cealign("target", "mobile")
print("RMSD: " + str(round(result["RMSD"], 2)) + " A")
print("Aligned length: " + str(result["alignment_length"]))

Note: cealign argument order is (target, mobile), opposite of align/super.

RMSD Calculations

After Alignment

# All atoms
rms = cmd.rms_cur("mobile", "target")

# CA atoms only (standard for backbone comparison)
rms = cmd.rms_cur("mobile and name CA", "target and name CA")
print("CA RMSD: " + str(round(rms, 2)) + " A")

Without Moving Structures

# Calculate RMSD without transformation
rms = cmd.rms("mobile", "target", matchmaker=4)

Loading Multiple Structures

From PDB

cmd.fetch("1tim")
cmd.fetch("8tim")
print("Loaded: " + str(cmd.get_names()))

Naming Convention

cmd.fetch("1tim", name="reference")
cmd.fetch("8tim", name="variant")

Visualization

Color by Structure

cmd.color("green", "reference")
cmd.color("cyan", "variant")
cmd.show("cartoon")
cmd.hide("lines")

Show Alignment

# Create alignment object for visualization
cmd.align("variant", "reference", object="alignment")
cmd.show("cgo", "alignment")  # Shows aligned residue connections

Highlight Differences

# Color by RMSD (requires script)
# Simpler approach: color conserved vs variable regions
cmd.select("core", "variant within 1 of reference")
cmd.select("variable", "variant and not core")
cmd.color("white", "core")
cmd.color("red", "variable")

Partial Alignment

Align Specific Regions

# Align only chain A
result = cmd.align("mobile and chain A", "target and chain A")

# Align specific domain
result = cmd.align("mobile and resi 1-100", "target and resi 1-100")

# Align only CA atoms
result = cmd.align("mobile and name CA", "target and name CA")

Exclude Flexible Regions

# Exclude loops from alignment
result = cmd.align(
    "mobile and ss h+s",  # Only helices and sheets
    "target and ss h+s"
)

Multi-Structure Comparison

Sequential Alignment

# Align all to reference
cmd.fetch("1tim", name="ref")
cmd.fetch("2tim", name="var1")
cmd.fetch("3tim", name="var2")

for structure in ["var1", "var2"]:
    result = cmd.align(structure, "ref")
    print(structure + " RMSD: " + str(round(result[0], 2)))

Color Scheme

colors = ["green", "cyan", "magenta", "yellow", "orange"]
structures = ["ref", "var1", "var2"]
for i, struct in enumerate(structures):
    cmd.color(colors[i], struct)

Complete Workflow

Standard Structure Comparison

# 1. Load structures
cmd.delete("all")
cmd.fetch("1tim", name="reference")
cmd.fetch("8tim", name="variant")

# 2. Align
result = cmd.align("variant", "reference")
print("RMSD: " + str(round(result[0], 2)) + " A")
print("Atoms: " + str(result[1]))

# 3. Style
cmd.show("cartoon")
cmd.hide("lines")
cmd.color("green", "reference")
cmd.color("cyan", "variant")

# 4. Calculate backbone RMSD
ca_rms = cmd.rms_cur("variant and name CA", "reference and name CA")
print("CA RMSD: " + str(round(ca_rms, 2)) + " A")

# 5. View
cmd.center("all")
cmd.zoom("all")
cmd.bg_color("white")

Interpretation

RMSD (CA)Interpretation
< 0.5 ANearly identical
0.5-1.0 AVery similar (same fold, minor differences)
1.0-2.0 ASimilar fold, some conformational differences
2.0-3.0 ASame fold family, significant differences
> 3.0 ADifferent conformations or distant homologs

Publication-Quality Figures

Settings for Print

cmd.bg_color("white")
cmd.set("ray_shadows", 0)
cmd.set("spec_reflect", 0.2)
cmd.set("ambient", 0.5)
cmd.set("antialias", 2)
cmd.set("ray_trace_mode", 1)
cmd.set("cartoon_fancy_helices", 1)

Multi-View Strategy

Always create multiple views to tell the complete story:

Overview - Shows full aligned structures:

cmd.orient()
cmd.ray(1200, 900)
cmd.png("comparison_overview.png")

Side View - Rotated 90° to show depth:

cmd.turn("y", 90)
cmd.ray(1200, 900)
cmd.png("comparison_side.png")

Detail View - Focus on key difference regions:

cmd.center("mobile and resi 65-85")  # Hinge region, mutation site, etc.
cmd.zoom("all and resi 60-90", buffer=8)
cmd.ray(1200, 900)
cmd.png("comparison_detail.png")

Color Schemes for Comparison

Standard two-structure comparison:

  • Structure 1: marine (blue)
  • Structure 2: salmon (pink/orange)

Multi-structure comparison:

  • Reference: green
  • Variants: cyan, magenta, yellow, orange

IMPORTANT: Always use cmd.ray(w, h) then cmd.png(path) without dimensions. Using cmd.png(path, w, h) causes a view inflation bug.

Tips

  • Use align for closely related proteins
  • Use super when sequence identity is low
  • Use cealign for detecting distant relationships
  • Always report CA RMSD for standardization
  • Color structures distinctly for clarity
  • rms_cur calculates RMSD of current positions (after alignment)
  • Multiple views tell a more complete story than a single image

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.