When a molecular structure contains many segments, locating the ones that matter can become a small but persistent source of friction. You may need to identify unusually long segments, narrow a search to a particular size range, or distinguish a segment’s residue count from its atom count. SAMSON’s Node Specification Language (NSL) lets you express these criteria as queries instead of relying on visual inspection.
This guide focuses on a practical starting point: filtering segments by their size and composition. The key is to choose the measurement that matches your question. A segment’s number of residues, number of structural groups, and number of atoms describe different things; they should not be treated as interchangeable.
Start with the segment attribute space
Segment attributes use the segment attribute space, abbreviated s. That prefix matters: it makes the query target segment nodes. For example, s.nr > 100 looks for segments with more than 100 residues. The full attribute name is segment.numberOfResidues; the short form is quicker to type.
If you already know a useful cutoff, a comparison can make the search direct:
s.nr > 130matches segments with more than 130 residues.s.nsg > 10matches segments with more than 10 structural groups.s.nat < 1000matches segments with fewer than 1,000 atoms.
These queries answer different questions. Residue count can help locate segments by their number of residues; structural-group count measures the number of structural groups; atom count provides a count of atoms. Choosing the right attribute first prevents a common mistake: applying a sensible-looking threshold to the wrong kind of count.
Use ranges when a cutoff is too broad
A single threshold may return too many candidates, or may not describe the interval you actually want. NSL supports range expressions for integer attributes. For example, s.nr 100:130 matches segments with a residue count between 100 and 130. Similarly, s.nsg 10:12 finds segments with between 10 and 12 structural groups, and s.nat 100:200 specifies an atom-count range.
Ranges are useful when comparing structures of similar scale or when you want to inspect a narrower group of candidates rather than every segment above a minimum. The documentation describes these as values “between” the endpoints; if endpoint behavior matters for your analysis, verify it in your SAMSON workflow rather than assuming a boundary convention.
Refine the question with inherited attributes
Segments also inherit attributes from the structuralGroup and node attribute spaces. This gives you additional ways to describe what you are looking for. For example, the segment reference lists atom counts by element—s.nC for carbons, s.nH for hydrogens, s.nN for nitrogens, s.nO for oxygens, and s.nS for sulfurs—as well as total atom count (s.nat). It also lists formal charge (s.fc) and partial charge (s.pc).
For instance, s.nC < 10 expresses a carbon-count criterion, while s.pc > 1.5 expresses a partial-charge criterion. These examples are useful when segment size alone is not enough to describe the candidate you need. Name is another inherited attribute: the reference gives s.n "A" and s.n "L*" as examples of quoted string expressions.
A simple way to build a reliable query
- Decide what you mean by “size”: residues, structural groups, atoms, or a particular element count.
- Start with one attribute and a clear comparison or range, such as
s.nr 100:130. - Check the returned segments, then adjust the measurement or threshold if it does not reflect your intended selection.
- Use inherited attributes—such as name, charge, or elemental counts—to describe the candidates more specifically.
This step-by-step approach makes the query easier to interpret and troubleshoot. It also keeps the biological or structural question in view: a segment with many residues is not necessarily the same thing as one with many atoms or structural groups.
For the complete attribute list and additional examples, see the SAMSON segment attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
