Finding the Right Node Groups Without Losing Track of Selection

When a molecular scene contains many node groups, a small selection mistake can have a big practical cost: you may inspect the wrong group, overlook an unselected one, or spend time checking groups individually. SAMSON’s Node Specification Language (NSL) lets you describe node groups by name or selection state, so you can make these checks directly with short expressions.

Start by narrowing the search to groups

Node group attributes live in the nodeGroup attribute space, whose short name is ng. The important detail is that this attribute space matches only node group nodes. Prefixing an attribute with ng makes your intent explicit: you are asking about groups, not every kind of node in the scene.

For example, to match a group named A, use:

ng.n "A"

Here, n is the short name for the name attribute. If a group’s name follows a recognizable pattern, the documentation also gives this example:

ng.n "L*"

That can be a useful starting point when you want to locate groups whose names share a prefix. Clear, consistent group names make these searches easier to understand later—especially when a scene has accumulated groups for different structures, regions, or stages of an analysis.

Check selection state explicitly

To match selected node groups, use ng.selected. To match groups that are not selected, use not ng.selected.

These two expressions are handy when the immediate question is simply, “Which groups are selected?” or “Which groups are outside the current selection?” They also make a useful quick check before you continue working: you can test the selected and unselected cases separately rather than relying on a visual scan of a crowded scene.

One syntax detail is easy to miss: although the inherited node.selected attribute has the short name s, the node-group form does not. For group selection, write ng.selected, not ng.s. Using the full attribute name avoids confusion and follows the node-group reference.

Use selectionFlag as a separate attribute

Node groups also inherit selectionFlag, with the short name sf. The reference shows examples for both Boolean values:

ng.sf
ng.sf false

It is worth keeping selected and selectionFlag distinct in your expressions: they are documented as separate attributes, even though both accept Boolean values. If you are unsure which one fits a task, check the relevant workflow or the full attribute reference rather than treating the names as interchangeable.

A small, repeatable checking routine

  1. Use ng.n "A" or a suitable name pattern to locate the group you intend to work with.

  2. Check the selection state with ng.selected or not ng.selected.

  3. If your task specifically concerns the selection flag, query ng.sf or ng.sf false instead.

Keeping these checks separate makes each expression easier to read and helps prevent a common source of confusion: mixing up a group’s name, its selected state, and its selection flag. The examples above use only the documented node-group attributes; consult the reference before combining predicates or relying on behavior beyond those definitions.

For the complete attribute list and inheritance notes, see the SAMSON node group attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.