When working with complex molecular systems, it’s common to generate numerous conformations and simulation states. If you’re using SAMSON for integrative molecular modeling, one common pain is quickly identifying relevant paths—such as conformations with a specific size—for further analysis. This is where the numberOfAtoms attribute comes in handy within the NSL (Node Specification Language).
In SAMSON, molecular paths are represented as conformation nodes. Whether you’re simulating folding, reaction coordinates, or dynamic assemblies, being able to query and filter paths based on their atomic content saves time and avoids visual clutter.
Why filter by number of atoms?
Molecular modelers often generate multiple pathway variants. Some of these may be partial structures, others could be artifacts introduced during import/export or simulations. Filtering for meaningful paths—e.g., that include a full active site or a minimum number of atoms required for a calculation—is often necessary.
Instead of sifting manually through dozens or even hundreds of items in the document, use a simple expression in NSL:
|
1 |
p.nat > 100 |
This filters and selects only the path nodes (in the path attribute space, hence the p) that have more than 100 atoms.
Basic Syntax
To access the numberOfAtoms property for path-type nodes in NSL, use either of the following:
- Full form:
path.numberOfAtoms - Short form:
p.nat
The values used in the expression can be any integer, such as:
p.nat == 150: selects paths with exactly 150 atoms.p.nat 100:200: selects paths with between 100 and 200 atoms inclusive.
Examples
Let’s say you simulated alternate conformations of a flexible loop region on a protein. You may want to isolate only those paths where more than 120 atoms were involved in the deformation since smaller segments might not be relevant. You could simply write:
|
1 |
p.nat > 120 |
If some of your conformations got accidentally truncated due to simulation limits or data errors, they might contain fewer atoms. You could also write:
|
1 |
p.nat < 50 |
which would flag possible issues worth checking.
Combine with other filters
You can combine p.nat with other NSL attributes, such as name or selectionFlag, to get even more precise control. For example:
|
1 |
p.nat > 100 and p.n "Loop*" |
This would select all path nodes with more than 100 atoms, and whose name starts with “Loop” (like Loop1, Loop2, etc.).
Conclusion
This small but powerful filtering method helps declutter your workflow and ensure you’re analyzing meaningful conformations. It’s a good first step before deeper analysis, visualization, or exporting selected results. Next time your scene becomes overwhelming, remember p.nat.
To learn more, visit the official documentation here: https://documentation.samson-connect.net/users/latest/nsl/path/.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download the latest version at https://www.samson-connect.net.
