If you’re building or analyzing large biomolecular systems in SAMSON, chances are you’ve run into situations where you need to quickly identify or isolate segments based on their structural properties. One common challenge is filtering segments by the number of residues they contain—especially when dealing with proteins, nucleic acids, or custom structures. Fortunately, SAMSON’s Node Specification Language (NSL) offers a simple and powerful way to do this.
Why filter by number of residues?
Molecular modelers often need to focus on particular parts of a system. For instance:
- Highlighting peptide fragments with more than a certain number of residues
- Isolating short loop regions in large proteins
- Comparing chains of varying lengths in structural alignments
- Identifying incomplete or unusually large segments in raw experimental data
Manually parsing these structures can be time-consuming. The segment.numberOfResidues attribute in NSL offers a direct solution.
Using segment.numberOfResidues ( s.nr)
In the Node Specification Language, each segment in a molecular model has a set of attributes. One of those, segment.numberOfResidues (or s.nr for short), represents how many residues are in that segment.
Usage examples:
s.nr > 100– selects segments that contain more than 100 residuess.nr 50:75– selects segments that have between 50 and 75 residues (inclusive)s.nr 1:1– identifies peptide segments that may be just a single residue long
This filter comes in handy during modeling, especially when you work with large structures or imported trajectories that include many fragments and chains. Being able to isolate segments by residue count can speed up both data curation and visual analysis.
Combining with other attributes
NSL lets you combine filters for more specific queries. For example:
s.nr > 100 and s.v– selects visible segments with more than 100 residuess.nr 10:30 and s.name "A*"– selects segments with 10–30 residues whose names start with “A”
Such combinations help focus your work on exactly the part of the model you need to explore or visualize.
Where to find this filter
This attribute is part of the segment attribute space in NSL. If you’re creating selection filters in SAMSON’s visual interface or scripting custom workflow tools, including s.nr becomes a natural part of your toolkit.
Mastering NSL queries like this one helps streamline analysis, especially in complex projects involving large biomolecular systems. As always, precise control over selections saves time—and sometimes reveals insights that are easy to miss when browsing visually.
To learn more about other available segment attributes (like number of atoms, charges, or visibility flags), visit the official NSL segment documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON here to start designing, analyzing, and simulating complex molecular systems.
