Making Labels Work for You: A Practical Guide to Label Attributes in SAMSON

When working with complex molecular models in SAMSON, staying organized is crucial. Labels can help add clarity at just the right places, but they can also become distracting or overwhelming if not managed carefully. Have you ever found yourself struggling to filter, hide, or selectively modify labels among many nodes in a scene? In this post, we’ll walk through how to take better control of label nodes using label attributes in SAMSON’s Node Specification Language (NSL).

The label attribute space (short name: la) in NSL is precisely designed for this purpose. It matches only label nodes and allows you to query, select, and modify these nodes based on specific attributes. This gives you powerful tools to efficiently manage label visibility, selection status, and more, especially when working with large or dynamic models in structural biology, materials science, or drug discovery.

Getting to know label attributes

Here’s a breakdown of some essential label attributes you can use in NSL, all prefixed with la to indicate the label node context.

Attribute Short Name Example What it does
hidden h la.h Matches labels that are currently hidden.
name n la.n "Label1" Selects labels by name. Wildcards like "L*" are supported.
selected la.selected Finds label nodes that are selected. Note: this one does not have a short name.
selectionFlag sf la.sf false Checks if the selection flag is off.
visibilityFlag vf la.vf Matches labels where visibility is enabled.
visible v not la.v Finds label nodes that are invisible.

Example use case: Cleaning up your workspace

Suppose you’ve added a number of labels to annotate important residues or structural features, but now your model looks cluttered. You only want to keep labels that contain the word “Active” and hide the rest:

This selects all label nodes that contain “Active” in their name. You can then apply batch operations like changing color or toggling visibility. To hide labels that do not contain this keyword, simply invert the selection:

Filtering by state

Looking for labels that are visible and selected? Combine conditions like so:

This can be especially useful when preparing presentations or snapshots of your model.

Conclusion

Label attributes in NSL give you fine-grained control over your annotation workflow. Whether you’re building presentations, cleaning up a model, or just trying to focus, understanding how to use these attributes can make your modeling process smoother and more efficient.

To learn more, visit the documentation page on label attributes in SAMSON.

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

Comments are closed.