ProteinMotion
Reference navigation
On this page

StructureMorph

Morph between two experimental structures of the same protein, moving residues along screw paths.

python
from proteinmotion import StructureMorph

Constructor

python
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

ParameterDefaultDescription
sourceRequiredStructure shown before the morph.
targetRequiredStructure that replaces the source at the end; chains, residues, ligands, and atoms may differ.
alignkeyword onlyNoneRegion 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 onlyNoneSource-to-target chain ID mapping; None pairs chains automatically.
matchkeyword onlyNoneStructureMatch 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.

Code Render command
bash
proteinmotion render examples/structure_morph.py HemoglobinMorph \
  -o hemoglobin-morph.mp4 --fps 60
Output Preview · 17.7 s · 60 fps
Hemoglobin from T to R

Deoxyhemoglobin (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

NameDescription
targetspropertyObjects whose state this animation changes.
resultpropertyThe target structure, which replaces the source when the morph ends.
bind()methodCapture starting values when the scene schedules the animation.
apply()methodEvaluate the animation at eased progress alpha. Called by the timeline.
during()method · inherited from AnimationSet this animation duration and start delay in seconds.
python
StructureMorph.targets

Objects whose state this animation changes.

python
StructureMorph.result

The target structure, which replaces the source when the morph ends.

python
StructureMorph.bind()

Capture starting values when the scene schedules the animation.

Returns: None

Called by ProteinScene.play(). An animation instance can be bound once.

python
StructureMorph.apply(alpha)

Evaluate the animation at eased progress alpha. Called by the timeline.

ParameterDefaultDescription
alphaRequiredEased animation progress in [0, 1].

Returns: None

Inherited from animation.Animation.

python
StructureMorph.during(seconds, *, delay=0)

Set this animation duration and start delay in seconds.

ParameterDefaultDescription
secondsRequiredPositive animation duration in seconds.
delaykeyword only0Nonnegative animation start delay in seconds.