ProteinMotion
Reference navigation
On this page

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',
    easing=None,
    delay_seconds=None,
    stagger_fraction=None,
    **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".
easingkeyword onlyNoneNamed easing (smooth, linear, ease_in_out_sine, there_and_back) or callable mapping [0, 1] to [0, 1]. Per-item easing preserves stagger timing.
delay_secondskeyword onlyNoneDelay between successive residue, chain, or glyph starts, in seconds. Choose one delay option.
stagger_fractionkeyword onlyNoneTotal clip fraction reserved for staggered starts, in [0, 1).
**match_options—Options passed to match_backbones() when match is None.

Notes

Matched residues move with their Cα (protein) or C1′ (DNA/RNA) in deposited chain order. Each move lasts run_time − (matched count − 1) × residue_delay seconds. Whole residues retain their internal geometry as source and target representations crossfade. Unmatched source and destination residues use fade_out and fade_in intervals. Both objects’ geometry, transforms, and opacity belong to this animation. Each endpoint selects one chain. Explicit pairs require the correct anchor atom.

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
resultpropertyThe destination object to select, label and animate after this morph.
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.
during()method · inherited from AnimationSet this animation duration and start delay in seconds.
python
BackboneMorph.result

The destination object to select, label and animate after this morph.

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

Inherited from animation.Animation.

python
BackboneMorph.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.