Make Visual Selection Easier in SAMSON with Render Preset Attributes

When working with complex molecular systems, molecular modelers often have to visually isolate specific parts of their structures using consistent rendering styles. This is especially useful when preparing figures for publications or presentations, or when exploring specific substructures during a modeling session. However, in large documents, keeping track of rendering styles and selections can become confusing — especially when dealing with multiple presets and attempting to automate tasks.

Fortunately, SAMSON provides a convenient and expressive way to handle this: the renderPreset attribute space in the Node Specification Language (NSL). It allows users to query and filter render preset nodes — the nodes responsible for customizing how parts of a molecular system are displayed.

What are render preset attributes?

Render presets let you group visual styles (like surface color, shading, or representation) into reusable containers — for instance, to render all proteins in transparent blue and ligands as licorice. The renderPreset attribute space provides precise control over these nodes using NSL. The short name for this space is rp, which lets you write concise queries such as rp.n "MyPreset".

Quick Filtering with Attributes

The key attributes you can use to filter render presets are:

  • name (n): Match by names using strings or patterns like wildcards. For example:
    rp.n "*Ligand*" matches presets with names containing “Ligand”.
  • selected: True if the preset is selected in the document. You can use:
    rp.selected or not rp.selected.
  • selectionFlag (sf): A boolean used to simulate selection status. Helps when running scripts or building automation pipelines without actually selecting nodes. Examples:
    rp.sf true or more simply rp.sf.

Why this helps

This filtering system helps you quickly find presets from large systems where multiple styles are active. For example, suppose you’re preparing a figure and want to verify every preset that applies to ligands. You could use:

Or if you’re debugging a script and only want to act on currently selected presets:

This becomes even more powerful when combined with Python scripting or in complex automation workflows, allowing you to temporarily flag presets using selectionFlag without disrupting your current GUI selection.

Inherited but adapted

It’s worth noting that these attributes are inherited from the general node attribute space, but with small adjustments. For example, unlike node.selected, which allows the short name s, rp.selected does not support a short form — so use the full word.

This subtlety prevents ambiguity and keeps your expressions clear and readable, especially important when collaborating with others or integrating into repeatable scripts.

If you’re working with macromolecular systems, trying to stay organized, or building automation tools, learning to harness render preset attributes can save time and reduce model complexity.

Learn more about render preset attributes in the official documentation: https://documentation.samson-connect.net/users/latest/nsl/renderPreset/

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.

Comments are closed.