When working on complex molecular systems in SAMSON, labels can be critical for clarity — but too many of them can clutter your visualization. Molecular modelers often face the challenge of managing these label nodes efficiently, especially when preparing clean images or focusing on specific elements during analysis.
Fortunately, SAMSON provides a powerful query tool within the NSL (Node Specification Language) that can help you quickly identify and filter label nodes based on their visibility attributes. This can make your workflows more efficient, especially when automating model inspection, scripting interactions, or just cleaning up your interface.
What Are Label Nodes?
In SAMSON, labels are special node types that can carry annotations, text, or indicators. These nodes are handled separately from atoms, molecules, or groups, and they come with their own set of attributes under the label attribute space, abbreviated as la.
If you’re unsure whether a label node is affecting your workspace or just want to isolate visible or hidden labels, the visible attribute is your tool.
Using the visible Attribute
The visible attribute (v as a short name) lets you filter label nodes based on whether they are currently displayed in the viewport. For example, the following NSL query helps you locate all visible label nodes:
|
1 |
la.v |
Conversely, if you’re looking to isolate hidden labels (perhaps to reveal or delete them), you can use:
|
1 |
not la.v |
These queries can be typed or embedded into scripts for automation, and they help keep your molecular spaces clean and focused.
Difference Between visible and visibilityFlag
You might notice a similarly named attribute: visibilityFlag (short name: vf). It might be tempting to see it as identical to visible, but there’s a subtle difference:
visiblereflects whether the label is currently shown or hidden in the scene, given all visibility conditions.visibilityFlagis an internal setting that can contribute to whether the label is visible, but does not alone determine it.
To ensure you’re truly filtering based on on-screen presence, prefer la.v over la.vf unless you’re specifically working with backend control logic.
Combining Attributes
NSL allows for very expressive queries. For instance, to show all label nodes whose names begin with “Note” and are visible:
|
1 |
la.v and la.n "Note*" |
This is particularly useful if your workflow includes programmatically generated labels following naming conventions (e.g., annotations from simulations or imported data).
On the flip side, to remove all hidden labels (perhaps legacy annotations that are no longer useful):
|
1 |
not la.v |
Select them and delete or hide them permanently as needed — all in seconds.
Summary
By leveraging NSL and the visible attribute, label node management becomes less of a tedious task and more of a precise control mechanism. Whether you’re preparing visuals, curating annotations, or scripting molecular workflows, mastering visibility control can save time and simplify your structure.
For complete information, visit the official documentation 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 at https://www.samson-connect.net.
