一键导入
structure-alignment-analysis
Use when comparing protein structures, aligning molecules, calculating RMSD, or visualizing structural differences through PyMOL.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when comparing protein structures, aligning molecules, calculating RMSD, or visualizing structural differences through PyMOL.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when working with PyMOL for molecular visualization tasks including loading structures, creating representations, coloring, selections, and basic analysis.
Use when connecting Claude to PyMOL, troubleshooting socket errors, or setting up the PyMOL integration for the first time
Use when setting up, configuring, running, or inspecting La-Proteina protein generation tasks including unconditional design and motif scaffolding. Helps build configs and visualize outputs through PyMOL.
Use when setting up, configuring, running, or inspecting Proteina-Complexa protein binder design, ligand binder design, AME motif scaffolding, or monomer motif scaffolding. Helps build configs, select targets, and visualize outputs through PyMOL.
Use when validating protein designs with AlphaFold2/AlphaFold3/ESMFold predictions, coloring by pLDDT or pAE, computing self-consistency RMSD, or screening design candidates through PyMOL.
Use when comparing multiple protein designs, ranking design candidates, tracking design iterations, overlaying before/after structures, or performing batch visual QC through PyMOL.
| name | structure-alignment-analysis |
| description | Use when comparing protein structures, aligning molecules, calculating RMSD, or visualizing structural differences through PyMOL. |
| version | 0.1.0 |
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.
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]))
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]))
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.
# 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")
# Calculate RMSD without transformation
rms = cmd.rms("mobile", "target", matchmaker=4)
cmd.fetch("1tim")
cmd.fetch("8tim")
print("Loaded: " + str(cmd.get_names()))
cmd.fetch("1tim", name="reference")
cmd.fetch("8tim", name="variant")
cmd.color("green", "reference")
cmd.color("cyan", "variant")
cmd.show("cartoon")
cmd.hide("lines")
# Create alignment object for visualization
cmd.align("variant", "reference", object="alignment")
cmd.show("cgo", "alignment") # Shows aligned residue connections
# 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")
# 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 loops from alignment
result = cmd.align(
"mobile and ss h+s", # Only helices and sheets
"target and ss h+s"
)
# 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)))
colors = ["green", "cyan", "magenta", "yellow", "orange"]
structures = ["ref", "var1", "var2"]
for i, struct in enumerate(structures):
cmd.color(colors[i], struct)
# 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")
| RMSD (CA) | Interpretation |
|---|---|
| < 0.5 A | Nearly identical |
| 0.5-1.0 A | Very similar (same fold, minor differences) |
| 1.0-2.0 A | Similar fold, some conformational differences |
| 2.0-3.0 A | Same fold family, significant differences |
| > 3.0 A | Different conformations or distant homologs |
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)
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")
Standard two-structure comparison:
Multi-structure comparison:
IMPORTANT: Always use cmd.ray(w, h) then cmd.png(path) without dimensions.
Using cmd.png(path, w, h) causes a view inflation bug.
align for closely related proteinssuper when sequence identity is lowcealign for detecting distant relationshipsrms_cur calculates RMSD of current positions (after alignment)