Reference navigation
On this page
StructureMorph
Morph between two experimental structures of the same protein, moving residues along screw paths.
from proteinmotion import StructureMorphConstructor
StructureMorph(
source,
target,
*,
align=None,
chains=None,
match=None,
fade_out=(0.0, 0.35),
fade_in=(0.65, 1.0),
style='source',
secondary='auto',
easing='smooth',
)Parameters
| Parameter | Default | Description |
|---|---|---|
source | Required | Structure shown before the morph. |
target | Required | Structure that replaces the source at the end; chains, residues, ligands, and atoms may differ. |
alignkeyword only | None | Region of the source whose matched Cα/C4′ atoms superpose the target; None uses the rigid core; False keeps the target where it is, for structures already superposed. |
chainskeyword only | None | Source-to-target chain ID mapping; None pairs chains automatically. |
matchkeyword only | None | StructureMatch to reuse; None calls match_structures(). |
fade_outkeyword only | (0.0, 0.35) | Interval of the clip, as fractions, in which source-only atoms fade out. |
fade_inkeyword only | (0.65, 1.0) | Interval of the clip, as fractions, in which target-only atoms fade in. |
stylekeyword only | 'source' | "source" gives the target the source's representation and colors; "target" keeps its own. |
secondarykeyword only | 'auto' | "auto" blends residues whose DSSP state differs between the structures; "keep" leaves the cartoon unchanged. |
easingkeyword only | 'smooth' | Easing of the whole morph. |
Notes
Rigid domains rotate along arcs and keep their bond lengths; side chains turn through their χ angles; bond lengths then relax toward interpolated values. The path illustrates the difference between two endpoints, not a calculated pathway.
Example and output
Run this command from a repository checkout.
proteinmotion render examples/structure_morph.py HemoglobinMorph \
-o hemoglobin-morph.mp4 --fps 60Deoxyhemoglobin (2DN2) morphs to oxyhemoglobin (2DN1, expanded to its tetramer), superposed on α1β1. α2β2 turns 14° in the image plane while O₂ appears at each heme. A heatmap shows Cα–Cα distances changing between the αβ dimers but not within them. The path illustrates the difference between the two structures.
Methods and properties
| Name | Description |
|---|---|
| targetsproperty | Objects whose state this animation changes. |
| resultproperty | The target structure, which replaces the source when the morph ends. |
| bind()method | Capture starting values when the scene schedules the animation. |
| apply()method | Evaluate the animation at eased progress alpha. Called by the timeline. |
| during()method · inherited from Animation | Set this animation duration and start delay in seconds. |
StructureMorph.targetsObjects whose state this animation changes.
StructureMorph.resultThe target structure, which replaces the source when the morph ends.
StructureMorph.bind()Capture starting values when the scene schedules the animation.
Returns: None
Called by ProteinScene.play(). An animation instance can be bound once.
StructureMorph.apply(alpha)Evaluate the animation at eased progress alpha. Called by the timeline.
| Parameter | Default | Description |
|---|---|---|
alpha | Required | Eased animation progress in [0, 1]. |
Returns: None
Inherited from animation.Animation.
StructureMorph.during(seconds, *, delay=0)Set this animation duration and start delay in seconds.
| Parameter | Default | Description |
|---|---|---|
seconds | Required | Positive animation duration in seconds. |
delaykeyword only | 0 | Nonnegative animation start delay in seconds. |