When working with complex molecular models, labeling atoms, groups, or other elements is often essential to communicate ideas, track changes, or set up simulations. However, once those labels start to accumulate in a scene, managing them can become difficult: Which ones are visible? Which are selected? Did you accidentally hide something critical?
The Node Specification Language (NSL) in SAMSON includes a set of attributes specifically tailored for managing label nodes. Understanding how to use these label attributes enables fast and precise control over labels in your molecular design workflows—and it can reduce time spent on tedious clicking and scrolling in the GUI.
What are label attributes in NSL?
Each node in SAMSON—be it an atom, bond, label, or otherwise—has a set of attributes. Label attributes, defined in the label attribute space (short name: la), let you target only label nodes when you’re building filters or automation routines with NSL.
Basic examples
Here are some ways you can use label attributes:
la.h: Matches labels that are hidden.not la.v: Matches labels that are not visible.la.n "L*": Matches labels whose names start with the letter ‘L’.
Why this helps
Imagine you’ve labeled important residues in a protein to track binding site mutations. Several iterations into your modeling workflow, you’ve added visual elements, selections, and simulations—and now you can’t find your labels. Manually clicking through the Document view to control visibility or selection becomes inefficient.
With NSL’s label attributes, you can restore clarity in an instant. For instance, use la.selected to find out which labels you’ve already selected, or la.vf false to list all the labels whose visibility flag is currently off—even if the label node itself is technically set to be visible.
Non-obvious power: Filtering with inherited attributes
Label attributes are largely inherited from the general node attribute space. But in the label context, there are a few nuances:
- Selected attribute has no short name: Unlike other nodes where
selectedcan be shortened tos, in labels you must writela.selected. - Standard flags included:
visibilityFlagandselectionFlagare both available, allowing detailed control of what appears in the viewport or is subject to manipulation.
Summary of label attributes
Here’s a quick summary of filterable label attributes you can use in NSL:
| Attribute | Short name | Values | Example query |
|---|---|---|---|
| hidden | h |
true / false | la.h |
| name | n |
string | la.n "LabeledAtom" |
| selected | (none) | true / false | la.selected |
| selectionFlag | sf |
true / false | la.sf false |
| visibilityFlag | vf |
true / false | la.vf |
| visible | v |
true / false | not la.v |
With these tools, your label management workflow can become not just easier, but also reproducible and scriptable—especially helpful when collaborating or preparing figures for publications.
To learn more and explore other capabilities, check the complete documentation: 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.
