When a molecular scene contains many groups, the hard part is often not creating another selection—it is expressing exactly which groups you want to find. A query that matches the wrong kind of node can be confusing, especially when similar attributes are available at different levels of the scene. SAMSON’s Node Specification Language (NSL) provides a focused way to describe node groups and filter them by attributes such as name and selection state.
Start by narrowing the node type
Node group attributes live in the nodeGroup attribute space, whose short name is ng. This matters: a query beginning with ng is for node group nodes, rather than an instruction to search every node in the scene. If your goal is to inspect groups, using the appropriate attribute space makes the intent of the expression clear.
For example, the documented expression ng.n "A" uses the short form n for the group’s name attribute. The page also gives ng.n "L*" as an example. Keep the name in quotes, as shown, and adapt the quoted value to the group name you are looking for.
Use the full attribute name when clarity helps
Short names can make repeated queries compact, but full names are often easier to read when you are revisiting an expression or sharing it with a colleague. The name attribute can be written as ng.name "A"; its short form is ng.n. Both refer to the same inherited node attribute.
A useful habit is to begin with the clearest expression, confirm that it describes the intended kind of object, and shorten it only if compactness is valuable. That small pause can prevent a query from becoming difficult to interpret later.
Check selection state deliberately
Node groups inherit two selection-related attributes listed on this page: selected and selectionFlag. For group queries, the documented examples are ng.selected and not ng.selected. In other words, you can express either the selected or the not-selected condition in a readable form.
There is an important naming detail: selected has no short name in the node-group attribute space. Do not assume that the short name s is available here. By contrast, selectionFlag has the short name sf, with examples ng.sf and ng.sf false.
The documentation lists selected and selectionFlag separately, so treat them as distinct attributes rather than interchangeable spellings. If you are unsure which one matches the question you are trying to answer, make that distinction explicit in your expression and consult the attribute reference.
A quick query-writing checklist
- Are you looking for groups? Use the
ngattribute space. - Are you matching a name? Use
ng.nameor its short form,ng.n, and put the value in quotes. - Are you checking selection? Use
ng.selectedornot ng.selected; do not rely on an undocumented short form. - Do you mean selectionFlag? Write it explicitly as
ng.selectionFlagor use its documented short form,ng.sf.
These small distinctions make group queries easier to review and reduce ambiguity when you are working in a crowded molecular scene. For the full attribute list and additional context, see the node group attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
