Quickly Filter and Manage Custom Visual Styles in SAMSON Using NSL

Whether you’re working with large biomolecular assemblies or small organic molecules, managing your visual representations in molecular modeling software can often feel overwhelming. In SAMSON, the use of render presets enables users to apply specific visual styles—or presets—to selected parts of their molecular system. This can optimize how you interpret results, identify key interactions, or simply prepare cleaner visuals for presentations and publications.

But how do you *efficiently* select, filter, and query these render presets, especially when working with complex scenes? That’s where the Node Specification Language (NSL) becomes helpful. In this article, we focus on a set of attributes specifically associated with render preset nodes to help you manage them more effectively: name, selected, and selectionFlag.

What is the renderPreset Attribute Space?

The renderPreset attribute space in the NSL (short name: rp) is designed exclusively for addressing render preset nodes. By targeting these nodes directly, you can formulate queries that apply to their visual properties—and not to other types of nodes like atoms or molecules.

Useful Scenarios for Molecular Modelers

  • Identify visual styles quickly: When maintaining multiple view presets in a project, you might want to isolate only those with specific names or flags.
  • Prepare visuals for publication: Quickly check which parts of the scene are using which render presets, and adjust accordingly.
  • Debug or clean up scenes: When your screen becomes crowded with multiple render styles and there’s confusion about what is active or applied where, filtering by selection flags can help.

Attribute Overview

Attribute Short Name Example Usage
name n rp.n "Cartoon Style"
selected rp.selected or not rp.selected
selectionFlag sf rp.sf true or rp.sf false

Diving In: How to Use These in Practice

1. Filtering Render Presets by Name
If your scene contains multiple visual styles named descriptively, you can target them like this:

This will return all render presets whose name exactly matches “Surface Style”. The wildcard is also supported for partial matches:

2. Selecting Currently Active Presets
Want to find out which render presets are currently selected in your scene? Simply use:

To invert the query (i.e., render presets that are not selected):

3. Filtering by Selection Flags
The selectionFlag is useful when you’ve programmatically applied a selection state but haven’t manually selected anything:

This line will filter out any presets that aren’t currently flagged for selection. This is particularly useful during scripted analyses or when running automated workflows.

Putting It All Together

Need a complex query to identify selected render presets named “Cartoon*”? Combine attributes like this:

This helps you refine your workflow without wading through menus or manually inspecting multiple presets—especially valuable in time-sensitive research contexts.

To learn more about working with render presets and other features of the Node Specification Language in SAMSON, visit the official documentation page: 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.