Quickly Toggle Label Visibility in SAMSON Using NSL

When working with complex molecular systems in SAMSON, labels can become both essential and overwhelming. Whether you’re trying to annotate specific atoms, highlight interactions, or trace functional groups, label visibility plays a key role in clearly communicating your molecular model. But if you’ve ever found yourself buried in overlapping labels or wished you could quickly isolate just a few—you’re definitely not alone.

Fortunately, SAMSON’s Node Specification Language (NSL) offers a precise and simple way to query and adjust label visibility directly.

Use case: Focus on only the visible labels

Imagine you’re reviewing a molecular dynamics simulation and want to display only those labels that are currently marked as visible. Instead of manually checking visibility toggles across your label nodes, you can use the NSL query:

This will return all label nodes with the visibility flag set to true. If, instead, you want to filter out all visible labels and isolate hidden ones (to potentially unhide or relabel them), you’re covered too:

What does la.v mean?

In NSL:

  • la refers to the label attribute space (short for label nodes only).
  • v stands for the visible attribute—whether or not the label is displayed.

So la.v simply filters all label nodes that are visible.

Compose clearer scenes with better control

You can combine the visible flag with other attributes to dive deeper. For example, this query gives you only the visible labels that have names starting with “A”:

Or, if you’re only interested in non-visible labels that are also marked as selected:

These queries are especially helpful to script preprocessing for figures, presentations, or videos. You can hide a group of labels based on name, selection status, and visibility in a couple of lines, keeping the scene focused and easily interpretable.

Why this matters

Simple control mechanisms like these are more than just convenience—they help reduce visual clutter, save time, and let you work at the scale of your dataset. Whether you’re modeling a small organic molecule or a biomolecular complex, being able to quickly select and toggle label visibility can significantly improve your workflow.

And if you’re managing large molecular scenes with many overlapping annotations, try coupling visibility control with selectionFlag or hidden attributes to fine-tune your models.

Next steps

You can find the full list of label-specific attributes and how they’re used in NSL syntax in the official documentation. To explore more advanced combinations and learn how these attributes inherit behavior from general node attributes, head over to the full page:

https://documentation.samson-connect.net/users/latest/nsl/label/

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.

Comments are closed.