When working with complex molecular models, it’s common to want to isolate specific structural paths—like chains, ligands, or pathways—that meet certain criteria. One frequent need is to find paths based on their size, that is, the number of atoms they contain. Doing this manually in large systems can be time-consuming and error-prone.
If you’re using the SAMSON platform and leveraging the Node Specification Language (NSL), there’s a clean and efficient way to filter paths by their atom count using the path attribute space.
Why you might need this
Let’s say you are analyzing a large molecular assembly and want to focus only on ligands or fragments composed of more than 100 atoms. Or you might want to quickly locate small molecule fragments with fewer than 50 atoms, or focus on a subset ranging from 150 to 200 atoms.
Instead of clicking through each path or guessing based on structure, you can use NSL expressions to directly query your model and focus only on what matters. Let’s see how.
Using p.nat to Filter Paths
The path.numberOfAtoms attribute (short form: p.nat) lets you match only those paths whose atom counts fall within a range or meet specific limits.
Examples:
p.nat > 100: Matches all paths containing more than 100 atoms.p.nat 100:200: Matches paths containing between 100 and 200 atoms.p.nat <= 50: Matches paths with 50 atoms or fewer.
This functionality becomes even more powerful when combined with other filters, such as name patterns or selection flags:
p.nat > 100 and p.n "L*": Matches large paths (>100 atoms) whose name starts with the letter “L”.p.sf and p.nat 50:150: Matches selected paths whose size falls within a specific range.
A Time Saver for Complex Systems
For large assemblies such as protein-ligand complexes or supramolecular structures, sorting through paths manually is not viable. The p.nat filter gives you a quick and programmable way to access the information you need. It’s also very handy for scripting repetitive tasks or filtering conformational data for further analysis or visualization.
Supported Value Types
The p.nat attribute only uses integer values, which makes it straightforward to work with. Use ranges (100:200), logic-based expressions (> 150, <= 300), or exact values depending on what you’re looking for.
Conclusion
The ability to filter molecular paths by atom count in SAMSON using the p.nat attribute is a helpful feature for any structural modeler. Whether you’re analyzing fragments, validating model completeness, or exploring specific structural motifs, this simple filter can save a significant amount of manual work.
To learn more about path attributes in NSL, visit the official documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
