When working with complex molecular models, one of the most recurring tasks is selecting the correct subset of structures. Whether you’re isolating a ligand, identifying functional groups, or analyzing a molecular sub-assembly, manual selection is tedious and error-prone. Fortunately, the Node Specification Language (NSL) in SAMSON offers powerful tools to streamline this task, particularly through Node Group attributes.
This post walks through how to leverage the selected and selectionFlag attributes in the nodeGroup (ng) attribute space to efficiently identify and act upon molecular subgroups.
Why Node Group Selection Matters
As molecular systems scale up, working at the atomic or bond level becomes less practical. Say you’re handling a large macromolecule with hundreds of components—what you often want is to select entire groups, like a protein domain or a ligand cluster. Instead of selecting individual atoms or residues manually, you can use NSL to describe what you want and let SAMSON do the work for you.
Using ng.selected to Identify Currently Selected Groups
The selected attribute lets you filter node groups based on their current selection state in SAMSON.
|
1 |
ng.selected |
This expression matches all node groups that are currently selected in the SAMSON interface. Conversely,
|
1 |
not ng.selected |
returns those that are not selected. Simple, but highly effective when scripting or building workflows!
Filtering with ng.sf: Persistent State Across Sessions
Unlike selected, which is fleeting and tied to the current user interaction, selectionFlag (short name: sf) allows you to mark Node Groups as selected in a more persistent way. For example:
|
1 |
ng.sf true |
The above tells SAMSON to match all node groups where the selection flag is set. Flags can be useful for tagging groups as active across workflows, even when you deselect them manually.
Also, note that these two attributes are not the same: one reflects UI selection (selected), while the other (selectionFlag) is a more persistent tagging mechanism.
Practical Example
Suppose you want to isolate all unselected node groups so you can apply an operation (like changing visual styles or exporting them separately):
|
1 |
not ng.selected |
Need to clear flags from all currently flagged groups?
|
1 |
ng.sf true |
Combined with scripting and other tools, you can create powerful routines around these expressions.
Putting It All Together
Here’s a compact use case: To find all the node groups named with a prefix “L” that are not currently selected, try:
|
1 |
ng.n "L*" and not ng.selected |
This could apply, for example, if you’ve selected some ligand groups but want to double-check that none were missed.
For more information about node group selection and a detailed attribute reference, see the official documentation:
https://documentation.samson-connect.net/users/latest/nsl/nodeGroup/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
