A Closer Look at Label Attributes in SAMSON’s Node Specification Language

Molecular modelers often face challenges in effectively visualizing and categorizing molecular components. In an extensive system, managing labels for nodes can help organize information, but without proper tools, this can become overwhelming. SAMSON’s Node Specification Language (NSL) provides label attributes that bring precision and flexibility to managing label nodes. If you’ve been looking for ways to manipulate and fine-tune node labels in your projects, this post is for you.

Why Label Attributes Matter

Label attributes in NSL allow users to define attributes specific to label nodes. This is especially useful if you are working with large molecular systems and need to refine node-level properties for better visualization, selection, or categorization.

The label attribute space, shortened to la, includes several key attributes such as:

  • hidden: Toggles whether a node is hidden.
  • name: Defines or filters labels by their names.
  • selected: Checks if a node is selected.
  • selectionFlag: Manages selection states.
  • visibilityFlag: Manages visibility states.
  • visible: Toggles whether the label node is visible.

Working With Individual Attributes

Let’s break down the most useful attributes and see how they can improve your workflow:

1. Hidden and Visible

Similar yet complementary, the hidden and visible attributes allow you to control the appearance of label nodes:

  • Hidden: Use la.h or not la.h to toggle hidden states of label nodes.
  • Visible: Use la.v or not la.v for direct visibility toggles.

These attributes are essential for controlling what is displayed, ensuring your workspace remains clean and focused on relevant labels.

2. Name Attribute

Working with node names is even more convenient with the name attribute. You can filter labels based on text string comparisons. For example:

  • la.n "A": Matches labels named exactly A.
  • la.n "L*": Matches labels starting with L (wildcard filter).

This can help you quickly locate specific labels in large models.

3. Selected and Selection Flags

To manage selections programmatically, use the selected and selectionFlag attributes:

  • Selected: Use la.selected or not la.selected to check the current selection of labels.
  • SelectionFlag: Use la.sf or la.sf false to directly set selection flags.

These attributes streamline workflows by enabling batch selection or deselection of label nodes.

4. Visibility Flags

With visibilityFlag (short code: vf), users can manage visibility states programmatically. This works in conjunction with hidden and visible to refine control over what is shown in your workspace.

Example: Practical Use in NSL Expressions

Consider the case where you want to make all labels starting with L visible:

Or, hide any label nodes that were currently visible:

Such powerful expressions help streamline your process by reducing manual work, improving efficiency, and keeping you focused on the task at hand.

Learn More

The label attributes in NSL are just one part of the extensive options available in SAMSON. To dive deeper into their utility or explore further examples, check out 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. If you haven’t already, download SAMSON today at https://www.samson-connect.net.

Comments are closed.