Easily Filter Labels by Visibility in SAMSON’s NSL

When navigating complex molecular models in SAMSON, one often has to deal with different types of nodes—atoms, bonds, groups, and labels. Labels can clutter the scene or disappear at unexpected times, making it difficult to focus on the information you need. If you’re struggling to filter or manage your label nodes efficiently, the Node Specification Language (NSL) has a few powerful tricks up its sleeve.

In this post, we explore a choice subset of NSL’s functionality—specifically, the label-related attributes that control visibility. Thanks to the NSL’s expressive syntax, you can quickly construct queries to manage and filter labels based on whether they are visible, hidden, or governed by a visibilityFlag.

Why filter by visibility?

Imagine this: You’re preparing a publication-quality image of a complex molecular assembly, and you only want to display certain labels. Or you want to check if previously hidden label annotations are still embedded in your model. Rather than clicking through dozens of nodes, you can write short queries in NSL that isolate exactly the labels you need.

Available attributes at a glance

In the label attribute space of NSL (whose short name is la), you can use several visibility-related attributes:

  • la.v: Matches labels that are currently visible.
  • not la.v: Matches labels that are not visible.
  • la.vf: Matches labels whose visibility flag is set to true.
  • la.h: Matches labels that are hidden.
  • not la.h: Labels that are explicitly not hidden.

This trifecta—visible, hidden, and visibilityFlag—gives you granular control over what appears in your workspace.

Practical examples

Let’s say you want to find all labels that are hidden but still have their visibility flag set. You could write:

Or perhaps you want to check for any visible labels whose names begin with “Note”:

This combination of attributes is extremely helpful when auditing large scenes or collaborating on molecular models where clarity is critical. For example, if a colleague has hidden certain labels for annotation purposes, you can isolate those by using la.h and decide whether to make them visible or adjust them further.

Inherited behavior worth noting

All these attributes are inherited from node-level attributes, which means they’ll behave consistently with how other node types (like atoms or bonds) manage visibility. There’s no need to learn a different logic—just memorize la for label nodes and you’re ready to go.

What about selected?

While this post focuses on visibility, don’t forget that la.selected is also available to you—even though it lacks a short alias. Combine it with visibility filters to do things like:

This matches all visible and selected labels, which can be handy before a group operation or display export.

With these NSL expressions in your toolkit, label management becomes much more efficient—and technical clutter gets out of your way.

To learn more about label attributes and all supported NSL queries, visit the official documentation page.

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

Comments are closed.