Making Smarter Selections with Node Group Attributes in SAMSON

For anyone involved in molecular modeling, especially when working on large systems, selecting and managing groups of atoms, molecules, or molecular subunits efficiently is crucial. Whether you’re editing a protein-ligand complex, analyzing simulation results, or preparing a publication, being able to target the right nodes quickly can save hours of manual work.

In SAMSON, selections can go beyond clicking individual atoms or residues. Thanks to the Node Specification Language (NSL), you can build powerful selection expressions. One particularly useful feature is the concept of node group attributes. In this post, we’ll explore how these attributes can be a practical tool when organizing and filtering complex molecular systems.

What Are Node Group Attributes?

Node group attributes refer to a specific subset of node attributes that apply only to node group nodes within SAMSON. You can think of node groups as collections of nodes (e.g., selections you made earlier, imported structures, or groups created during workflows).

These attributes live in the nodeGroup (or short name ng) attribute space. They allow you to query and filter node groups using specific properties.

Main Attributes You Can Use

Three main attributes are available for selecting node groups:

  • ng.n: the name of the node group (a string, often in quotes).
  • ng.selected: a boolean indicating whether the group is currently selected.
  • ng.sf: the selection flag (short for selectionFlag), also a boolean.

Why This Matters

Here’s a typical scenario: You’ve run a workflow that generates dozens of intermediate groups (e.g., potential binding site clusters), and you want to isolate those starting with “L” in the name. Instead of manually going through each one:

This expression selects all node groups whose name begins with “L”—simple and fast.

Or, let’s say you want to find all node groups that are not currently selected (for example, to prepare a clean visualization):

Combining these expressions makes it possible to construct more intricate selection filters and automate what would otherwise be repetitive tasks.

Working with selectionFlag

The selectionFlag attribute often trips people up. It differs subtly from selected: while selected reflects the current selection state in the user interface, selectionFlag is often used programmatically to persist selection-related states.

To filter for node groups that have not been flagged:

This becomes useful in workflows where you’re grouping nodes for downstream scripts or automation.

Pro Tip 💡

Because these attributes are inherited from the general node space, learning to use them helps you understand broader selection syntax in NSL. If you’re already using node.name or node.selected, adapting them to node groups becomes straightforward.

To explore more about node group attributes and see other use cases, visit the full documentation:

Node Group Attributes Documentation

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

Comments are closed.