Quickly Show or Hide Molecular Presentations with NSL Filters

Working on complex biomolecular systems often requires navigating through dozens — sometimes hundreds — of graphical elements: molecules, representations, overlays, labels, and more. When viewing becomes cluttered, productivity and clarity drop. That’s why visibility control is essential in molecular modeling platforms like SAMSON.

In this post, we highlight how to filter molecular presentation nodes based on visibility attributes using NSL (Node Specification Language). If you’ve ever wanted a fast way to toggle visual components on or off programmatically — without manually hiding nodes one by one — this is for you.

Understanding the Presentation Attribute Space

In SAMSON, visual elements are called presentation nodes. These are governed by a specific attribute space in NSL: the presentation attribute space, or pr for short. This means any visibility-related filters must be prefixed accordingly, like pr.v for checking visibility.

Key Visibility Attributes

There are three key attributes related to visibility in the pr attribute space:

  • pr.v: Short for visible. This is a straightforward way to check whether a presentation node is currently visible.
  • pr.vf: Short for visibilityFlag. This indicates whether the visibility flag was set on the presentation object.
  • pr.h: Short for hidden. This helps you determine or set whether a node should be excluded from rendering.

All of these accept boolean values: true or false.

Practical Use Cases

Imagine you’re working on a large molecular assembly and you’d like to script a quick NSL selection to isolate only what’s currently shown to reduce rendering overhead. Here’s how:

This selects only visible presentation nodes.

Need to find all presentation nodes that aren’t hidden?

Looking to manipulate visibility flags directly? For example, to find things whose visibility was toggled manually or programmatically:

Combining with Other Filters

You can combine visibility filters with other criteria. For example, to select visible nodes whose name starts with “L”:

This is especially helpful when scripting workflows or preparing datasets for visualization or export.

Why This Matters

Molecular modelers often spend time cleaning up views manually before image capture or exporting scenes. Having precise control over visibility makes the process faster, consistent, and automatable. With NSL filters like pr.v or pr.vf, you gain the ability to programmatically apply or reverse visual filtering as part of your daily workflow.

Even better — since NSL filters can be used in combination with selection tools in SAMSON — these visibility attributes aren’t just for display optimization. You can use them to drive selections, simplifications, or representation changes at scale.

Learn More

For more details, check out the full documentation page on presentation node attributes in NSL.

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

Comments are closed.