When working on complex molecular models, a frequent challenge arises: how to quickly identify specific structural groups based on their composition—like groups with fewer than 10 carbon atoms or structures that exceed a certain atom count. If you’re spending too much time manually browsing your structure tree in SAMSON, there’s a faster and more accurate way to achieve this using the Node Specification Language (NSL).
In this post, we’ll focus on a subset of NSL attributes designed for filtering structural groups based on atom count and elemental composition. This is especially useful when analyzing large biomolecules, synthetic compounds, or coarse-grained models where different group types must be identified based on size or content.
Why atom-based filters matter
Let’s say you want to:
- Find all structural groups that contain more than 100 atoms.
- Isolate functional groups with between 10 and 20 nitrogen atoms.
- Filter out coarse-grained groups that exceed a threshold count.
Instead of navigating manually or writing scripts, NSL lets you express these queries concisely. Below are the attributes available specifically for this use case.
Available filters for atom content
Use the sg prefix (short for structuralGroup) to specify that you are targeting structural group nodes. Here are some available attributes:
| Attribute | Short name | Description | Example |
|---|---|---|---|
| numberOfAtoms | nat |
Total number of atoms | sg.nat > 100 |
| numberOfCarbons | nC |
Number of carbon atoms | sg.nC 5:15 |
| numberOfHydrogens | nH |
Number of hydrogen atoms | sg.nH < 10 |
| numberOfNitrogens | nN |
Number of nitrogen atoms | sg.nN 10:20 |
| numberOfOxygens | nO |
Number of oxygen atoms | sg.nO > 10 |
| numberOfSulfurs | nS |
Number of sulfur atoms | sg.nS 0:5 |
| numberOfCoarseGrainedAtoms | ncga |
Number of coarse-grained atoms | sg.ncga 100:200 |
Putting it into practice
All of these NSL expressions can be typed directly in the Find panel in SAMSON (typically accessible with Ctrl+F or ⌘F). The filters work instantly and let you highlight only the nodes that match the criteria.
For instance, typing sg.nH < 10 and sg.nC < 5 finds structural groups that are both hydrogen-deficient and low in carbon content—potentially revealing structural anomalies or specific functional motifs.
Tips
- Ranges like
10:20are inclusive on both ends. - You can combine attributes with
and,or, andnotfor more specific queries. - These filters work on structuralGroup nodes, not individual atoms. For atom-level querying, use atom attribute space instead.
Example: Want to find all structural groups with between 100 and 200 atoms, containing between 10 and 20 oxygen atoms? Simply run:
|
1 |
sg.nat 100:200 and sg.nO 10:20 |
This technique can save hours of manual effort and ensure consistent selection across large systems.
To learn more, check the original documentation: https://documentation.samson-connect.net/users/latest/nsl/structuralGroup/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
