Reference navigation
On this page
BackboneMorph
Move matched backbone residues in order and fade unmatched residues.
from proteinmotion import BackboneMorphConstructor
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
| Parameter | Default | Description |
|---|---|---|
source | Required | Source Protein. |
destination | Required | Destination Protein. |
matchkeyword only | None | ContactMatch correspondence; None computes one using match_options. |
residue_delaykeyword only | 0.008 | Delay 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 only | True | Align the destination to the source before interpolation. |
motion_easingkeyword only | 'smooth' | Per-residue motion: "smooth" or "linear". |
easingkeyword only | None | Named 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 only | None | Delay between successive residue, chain, or glyph starts, in seconds. Choose one delay option. |
stagger_fractionkeyword only | None | Total 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.
proteinmotion render examples/backbone_morph.py BackboneDemo \
-o morph.mp4 --fps 60A 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
| Name | Description |
|---|---|
| resultproperty | The destination object to select, label and animate after this morph. |
| targetsproperty | Objects whose state this animation changes. |
| 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. |
BackboneMorph.resultThe destination object to select, label and animate after this morph.
BackboneMorph.targetsObjects whose state this animation changes.
BackboneMorph.bind()Capture starting values when the scene schedules the animation.
Returns: None
Called by ProteinScene.play(). An animation instance can be bound once.
BackboneMorph.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.
BackboneMorph.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. |