Find the Right Node Groups Without Losing Track of Selection

When a molecular scene becomes crowded, filtering the right objects can be as important as building the model. A common source of confusion is that a node group is not simply another name for every node inside it. In SAMSON’s Node Specification Language (NSL), node groups have their own attribute space: nodeGroup, abbreviated ng. Using that scope helps make a query about groups rather than a broader search for nodes.

This distinction is useful when you want to inspect or work with groups by name or selection state. The node-group attribute space matches only node group nodes. Its documented attributes include name, selected, and selectionFlag. These are inherited from the general node attribute space, but there is one notable detail: selected has no short name in the node-group space.

Start with a group name

To specify a group by name, use ng.n or the full attribute name, ng.name. For example:

  • ng.n "A" specifies a name of A.
  • ng.n "L*" is another documented name expression.

The quotes matter: the documented values for name are strings in quotes. If you are checking a query, begin with a simple name expression and confirm that it refers to the intended group. The reference lists "L*" as an example, but does not define additional pattern-matching rules here, so avoid assuming behavior beyond what your NSL setup documents.

Be precise about selection

Selection-related attributes are easy to mix up because their names sound similar. ng.selected tests the inherited selected attribute; the documented forms include:

  • ng.selected
  • not ng.selected

By contrast, ng.sf is the short form of selectionFlag. The reference gives both ng.sf and ng.sf false as examples. In practice, keep the distinction visible in your query: use selected when that is the state you mean to check, and use sf when you specifically mean the selection flag. They are separate attributes in the reference, not interchangeable spellings.

A small query-planning habit

When a result is unexpected, check the query in this order:

  1. Scope: Does the expression start with ng because you mean to match node groups?
  2. Attribute: Are you checking name, selected, or selectionFlag?
  3. Value: Is the name written as a quoted string, or is the Boolean value written as true or false?
  4. Negation: If you mean groups that are not selected, use the documented form not ng.selected.

This simple checklist can prevent a subtle but costly kind of modeling friction: writing a plausible-looking expression that asks about the wrong kind of node or the wrong selection attribute. The short prefix ng also makes the intended scope easier to spot when reviewing expressions later.

For the complete attribute reference and additional NSL examples, see the node group attributes documentation.

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

Comments are closed.