Quickly Finding Exactly the Node Groups You Need in Complex Models

If you’ve ever built or analyzed a large molecular model in SAMSON, you know how quickly complexity can escalate. Hundreds or thousands of groups—sometimes with overlapping naming schemes or similar visual features—can make it tricky to select precisely what you want. What if you could pinpoint exactly the node groups you’re interested in with a short, readable expression?

This is where the Node Specification Language (NSL) in SAMSON shines. When working with groups of nodes—also known as node groups—there are specialized attributes designed to help you filter and select them efficiently. These attributes fall under the nodeGroup attribute space (which you can reference using the short name ng).

What Are Node Groups?

Node groups in SAMSON are higher-level containers that organize nodes meaningfully—think domains in proteins, functional substructures in molecules, or even imported datasets that come in logical blocks.

Three Incredibly Useful Attributes

When querying node groups, you have access to the following attributes:

  • name (ng.n) – Match based on name using exact strings or wildcards.
  • selected – Check whether a node group is currently selected.
  • selectionFlag (ng.sf) – Use flags that can be customized during scripting or workflows.

1. Matching Node Group Names

Two examples demonstrate how flexible name-based filtering can be:

The first query selects node groups with the exact name “A”. The second selects any node group whose name starts with “L”. Wildcards make pattern matching intuitive and powerful.

2. Using the selected Attribute

This attribute allows you to build workflows that adapt to the current UI state. If you’ve visually selected some parts of your model, you can filter them programmatically:

This returns all currently selected node groups. You can also use:

…to focus on what’s not selected, which can be helpful when comparing or reverting selections.

3. Tracking Workflow State with selectionFlag

Sometimes, selections are made programmatically. The selectionFlag attribute allows you to track flags applied by previous scripts or logic:

…to get everything with a false selection flag. Or simply:

…to fetch those marked true. This is useful when toggling states inside custom SAMSON applications or extensions.

Why This Matters

You don’t want frustration to get in the way of your analysis. Whether you’re running simulations, organizing structures, or exporting snapshots, fine-grained control over node groups can save hours. Instead of manually clicking through hundreds of groups, a simple query gives you exactly what you need.

This is particularly handy for complex structures like virus capsids or large molecular assemblies where clarity depends on selecting consistent subsets of data for visualization or further computation.

Whether you’re automating with scripts or designing with a GUI, combining ng.n, ng.selected, and ng.sf opens new doors to precise model management that scale elegantly as your projects grow.

To explore more about node group queries, head to the full documentation page at https://documentation.samson-connect.net/users/latest/nsl/nodeGroup/.

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

Comments are closed.