Reference navigation
On this page
HideAtoms
Fade ball-and-stick detail atoms back into the cartoon, ribbon, or surface.
from proteinmotion import HideAtomsConstructor
HideAtoms(target, **kwargs)Parameters
| Parameter | Default | Description |
|---|---|---|
target | Required | Protein or Region whose detail atoms to hide. |
**kwargs | — | Additional keyword options described below or in the linked constructor. |
Additional keyword arguments
| Parameter | Default | Description |
|---|---|---|
residue_delaykeyword only | 0 | Delay in seconds between successive residue starts. |
reversekeyword only | False | Reverse residue or glyph order. |
easingkeyword only | 'smooth' | 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. |
Notes
Use HideAtoms(protein) to remove the default ligand, ion, and water detail.
Example and output
This excerpt runs inside a scene’s construct() method. The full example file includes imports, structure loading, and camera setup. Run it from a repository checkout.
"""Show 1CLL Ca²⁺ ions on the cartoon and grow the side chains that coordinate them."""
from pathlib import Path
from proteinmotion import Protein, ProteinScene, ShowSideChains, Unwrite, Write
DATA = Path(__file__).parent / "data"
class LigandsAndSideChains(ProteinScene):
def construct(self):
# Ions and ligands outside the traced chain draw as ball-and-stick detail.
p = Protein.from_file(DATA / "1cll.cif").cartoon().center()
self.add(p)
self.camera.frame(p, margin=1.0, aspect=self.width / self.height)
self.camera.theta, self.camera.phi = 0.4, 0.15
self.camera.depth_cue = 0.3
self.play(self.camera.animate.orbit(0.4), run_time=1.5)
# Whole residues with an atom within 3 Å of the first Ca²⁺ ion.
ion = p.select(ions=True, residues=149)
site = p.select(within=3.0, of=ion)
self.focus(site | ion, margin=1.3, run_time=1.5)
self.play(ShowSideChains(site, residue_delay=0.2), run_time=1.8)
labels = p.label_residues(
residues=[20, 22, 24, 26, 31],
font_size=30,
color="#f2ba67",
offsets={20: (-260, 90), 22: (-300, -40), 24: (-120, -170), 26: (260, -130), 31: (300, 70)},
)
self.play(Write(labels, lag_ratio=0.1), run_time=1.2)
self.play(self.camera.animate.orbit(0.5), run_time=2.5)
self.play(Unwrite(labels), run_time=0.6)
# Every residue within 3 Å of any of the four ions, staggered N to C.
self.focus(p, margin=1.0, run_time=1.5)
self.play(
ShowSideChains(p.select(within=3.0, of=p.select(ions=True)), residue_delay=0.04),
self.camera.animate.orbit(0.5),
run_time=2.5,
)1CLL Ca²⁺ ions on the cartoon, and the side chains within 3 Å of each ion.
Methods and properties
| Name | Description |
|---|---|
| bind()method · inherited from _AppearanceAnimation | Capture starting values when the scene schedules the animation. |
| apply()method · inherited from _AppearanceAnimation | 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. |
| targetsproperty · inherited from Animation | Objects whose state this animation changes. |
Inherited from styling._AppearanceAnimation.
HideAtoms.bind()Capture starting values when the scene schedules the animation.
Returns: None
Called by ProteinScene.play(). An animation instance can be bound once.
Inherited from styling._AppearanceAnimation.
HideAtoms.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.
HideAtoms.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. |
Inherited from animation.Animation.
HideAtoms.targetsObjects whose state this animation changes.