Control what you see: making sense of label visibility in SAMSON

In large molecular models, it’s easy to feel overwhelmed by the sheer number and variety of elements displayed. Labels—while useful—can quickly clutter the view, especially when the model grows in complexity. Turning labels on and off manually for dozens or hundreds of nodes isn’t just tedious; it can also introduce mistakes. This is where understanding label visibility attributes in SAMSON becomes a real time-saver. If you’re working with SAMSON’s Node Specification Language (NSL), learning how to programmatically control label visibility can make your workflow much more efficient and focused.

Label nodes in SAMSON have their own set of attributes in an attribute space called label (or la for short). These attributes can be used to filter and manipulate labels programmatically using NSL. Here’s a closer look at how you can use NSL expressions to make only what matters visible—and hide everything else.

Reducing Visual Clutter with la.v

The visible attribute (la.v) defines whether a label is actually visible in the viewport. For example, this expression:

matches all visible labels. Conversely,

matches all labels that are currently hidden.

If you want to hide all visible labels to declutter your scene:

This expression selects all labels where la.v is true, and sets their visibility to false. You instantly get an uncluttered view of your model.

Use visibilityFlag for Display Preferences

There’s a subtle difference between visibility and visibility flag. The visibilityFlag attribute (la.vf) reflects the user’s intent to keep something visible, which might be overridden by display settings or group visibility states. So la.vf gives you contextual control when combined with la.v.

This would tell SAMSON that the label should be shown, subject to other display settings.

Quick Checks: Is a Label Hidden?

If you find an empty spot where a label should be, the hidden attribute (la.h) can help pinpoint the problem. You can check:

or reverse it:

This can be very helpful when you’re debugging display issues in complex models.

Combining Attributes for Smarter Filters

Let’s say you want to show only labels starting with “L” that are currently hidden but marked as visible by the user. Try this:

Here, you filter labels whose name starts with “L”, are currently not visible, but have their visibility flag set to true. This combined filtering allows precise querying of your model state without manually inspecting each label node.

When and Why to Use This

Working with complex protein systems or molecular assemblies, many researchers add labels to highlight active sites, mutation targets, or ligand positions. But once added, they often stay on the screen regardless of relevance. By controlling visibility programmatically, you can maintain focus and clarity without deleting valuable annotations.

These tools are especially useful when preparing figures or animations for publication or presentations, where the cleaner visual can make a big difference in communicating your findings.

To learn more about label node attributes and how they can improve your workflow, visit the official SAMSON documentation.

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

Comments are closed.