When working with complex molecular systems, labels can be incredibly helpful to annotate and navigate your scene. However, with growing model complexity, an important challenge emerges: too many visible labels clutter your view, making it hard to focus. The good news is that SAMSON‘s Node Specification Language (NSL) offers a practical way to manage label visibility efficiently.
One particularly handy feature is the ability to control label visibility using the visible (la.v) attribute in NSL. Whether you’re toggling visibility in bulk, preparing a presentation, or scripting selections, this gives you fine-grained control and helps you maintain a clear molecular workspace.
Why visibility control matters 🧬
Imagine you’ve annotated a protein-ligand interaction with dozens of labels for residues, distances, and structural regions. When you switch focus to another part of the system, or zoom out to get the big picture, these labels might overwhelm the scene. Instead of manually toggling visibility one by one in the graphical interface, you can use NSL to filter, show, or hide labels in seconds.
Using la.v to control label visibility
The NSL attribute space for labels is la. The visible attribute has a short name: v. Its possible values are true or false.
Here’s how you can use it:
la.v— selects all labels that are currently visible.not la.v— selects all labels that are currently not visible.la.v false— explicitly refers to invisible labels.
Whether you’re using NSL in selection boxes or scripting contexts, this gives you immediate clarity and control.
Example workflows
Say you want to hide all labels before generating an image of a clean molecular surface. You could use not la.v to select all labels currently visible and then apply a hiding operation in bulk. Conversely, you can selectively reveal just the labels whose names match certain patterns.
For instance, if you wanted to display only labels starting with “L” and make them visible, you could do this:
|
1 |
la.n "L*" and not la.v |
This selects all labels starting with an “L” that are currently invisible. You can then change their visibility using SAMSON’s standard interface or scripts.
Pairing with other attributes
The visibility attribute combines well with other label attributes like name (la.n) and selectionFlag (la.sf). For example:
|
1 |
la.v and la.sf |
This selects visible labels that are also flagged as selected, which is useful for batch editing or exporting.
Conclusion
Smoothly visualizing molecular systems often depends on clean labeling strategies. With the la.v attribute in SAMSON’s Node Specification Language, you can streamline your workflow and reduce visual clutter with just a few typed expressions.
To explore more about label attributes and NSL in general, visit the full 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.
