ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

BackboneMorph

Move matched backbone residues in order and fade unmatched residues.

python
from proteinmotion import BackboneMorph

Constructor

python
BackboneMorph(
    source,
    destination,
    *,
    match=None,
    residue_delay=0.008,
    fade_out=(0.0, 0.35),
    fade_in=(0.65, 1.0),
    align=True,
    motion_easing='smooth',
    **match_options,
)

Parameters

ParameterDefaultDescription
sourceRequiredSource Protein.
destinationRequiredDestination Protein.
matchkeyword onlyNoneContactMatch correspondence; None computes one using match_options.
residue_delaykeyword only0.008Delay in seconds between successive residue starts.
fade_outkeyword only(0.0, 0.35)Normalized progress interval for fading unmatched source residues.
fade_inkeyword only(0.65, 1.0)Normalized progress interval for fading unmatched destination residues.
alignkeyword onlyTrueAlign the destination to the source before interpolation.
motion_easingkeyword only'smooth'Per-residue motion: "smooth" or "linear".
**match_optionsOptions passed to match_backbones() when match is None.

Notes

Each matched residue moves for run_time − (matched count − 1) × residue_delay seconds. Unmatched source and destination residues use fade_out and fade_in intervals. Both proteins’ geometry, transforms, and opacity belong to this animation. In ball-and-stick mode, atoms translate with their residue Cα and the atom sets crossfade. Side-chain atoms use their original residue geometry.

Example and output

Run this command from a repository checkout.

Code Render command
bash
proteinmotion render examples/backbone_morph.py BackboneDemo \
  -o morph.mp4 --fps 60
Output Preview · 11.5 s · 30 fps
Calmodulin to troponin C morph

A contact-map match selects 114 Cα pairs. Matched residues move in sequence from N to C; unmatched residues fade out or in.

Methods and properties

NameDescription
targetspropertyObjects whose state this animation changes.
bind()methodCapture starting values when the scene schedules the animation.
apply()methodEvaluate the animation at eased progress alpha. Called by the timeline.
python
BackboneMorph.targets

Objects whose state this animation changes.

python
BackboneMorph.bind()

Capture starting values when the scene schedules the animation.

Returns: None

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

python
BackboneMorph.apply(alpha)

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

ParameterDefaultDescription
alphaRequiredEased animation progress in [0, 1].

Returns: None