When working on complex molecular models in SAMSON, the visualization can quickly become cluttered—especially when labels pile up. Whether you’re labeling specific atoms, groups, or molecular fragments, having too many visible labels can detract from what you’re actually trying to analyze.
Fortunately, the Node Specification Language (NSL) includes dedicated tools for managing label nodes specifically, so you can search for them based on attributes and hide or filter them efficiently. This blog post explores the hidden and visible label attributes, which can help you declutter your workspace when modeling.
Why Control Label Visibility?
Visibility is one of the most useful aspects to manage when you’re dealing with large systems. Labels are essential for identifying key parts of a molecular structure, but after a while, having all of them displayed can overwhelm your view. In some cases, they even hide molecular interactions you’re trying to observe.
Maybe you’ve generated labels for 300 different residues… but now you only care about 3. Instead of manually turning off label visibility one-by-one, the NSL attribute system allows expressive visibility control with just a few keystrokes.
Using NSL for Label Visibility
The label attribute space—label or short la—lets you work specifically with label nodes. To manage which labels are shown or hidden, use the visible (v) and hidden (h) attributes.
Hide All Visible Labels
To find all visible label nodes and hide them:
|
1 |
la.v |
This selects only the label nodes that are visible. You can then hide them using SAMSON’s hide function—or use this within a script or shortcut to automate the action.
Show All Hidden Labels
If you want to re-show all hidden labels, use:
|
1 |
not la.v |
This selects the label nodes that are currently set as not visible.
Filter Named Labels
To act on specific labels based on names, combine visibility with the name (n) attribute. For example:
|
1 |
la.v and la.n "Water*" |
This selects all visible label nodes whose names start with “Water”.
Hidden vs. Visible—What’s the Difference?
label.hidden(orla.h) reflects whether a node is explicitly hidden.label.visible(orla.v) is a more user-friendly way to check visibility.
Typically, you’ll want to use la.v in your expressions when filtering what you see.
Example Use Cases
- Hide all labels except those on active site atoms.
- Temporarily hide name annotations to export a clean visual for publication.
- Toggle visibility of certain label groups during interactive presentations.
The Node Specification Language helps you precisely target what you see, making your work cleaner and faster—without manual toggling.
To explore all available label attributes, visit the original documentation page here: https://documentation.samson-connect.net/users/latest/nsl/label/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
