When a molecular structure contains many segments, a simple question can turn into a tedious inspection task: Which segments contain roughly the right number of residues? Which are unusually large, or contain a particular number of carbon or oxygen atoms? In SAMSON, the Node Specification Language (NSL) lets you describe these properties as expressions, so you can search by segment-level measurements instead of checking each segment manually.
This is especially useful when you are narrowing down a structure for inspection or trying to identify segments that merit closer attention. The key is to start with the property that best expresses your question, then use the matching NSL attribute.
Start with the number of residues
For a segment’s residue count, use s.nr, the short form of segment.numberOfResidues. To find segments with more than 100 residues, write:
s.nr > 100
If you have a target interval instead, use a range:
s.nr 100:120
This matches segments with a number of residues between 100 and 120. A range can be a convenient first pass when you know approximately what size you want, while a comparison such as > 100 is useful when you only have a lower threshold.
Residues are not the only measure of size
A segment can also be described by its number of structural groups. The attribute s.nsg refers to numberOfStructuralGroups. For example, s.nsg > 10 selects segments with more than 10 structural groups, and s.nsg 10:12 expresses a range from 10 to 12.
For a count of atoms, use the inherited structural-group attribute s.nat, which stands for numberOfAtoms. The expression s.nat < 1000 is an example of an upper-bound filter. These measures answer different questions: residue count describes how many residues a segment has, while structural-group and atom counts describe other levels of its composition. Choosing the measure that matches your question helps avoid treating unlike segments as equivalent.
Use composition to narrow the search
NSL also provides inherited element-count attributes for segments. Their short names include s.nC for carbons, s.nH for hydrogens, s.nN for nitrogens, s.nO for oxygens, and s.nS for sulfurs. For instance, s.nO 10:20 describes a search for segments with 10 to 20 oxygen atoms, while s.nC < 10 describes a search for fewer than 10 carbons.
Other inherited numeric attributes include formal charge (s.fc) and partial charge (s.pc). The documentation gives examples such as s.fc > 1 and s.pc > 1.5. Together, these attributes offer several ways to describe a segment: by size, elemental composition, or charge.
A practical way to build a search
- Turn the question into a measurable property. For example, decide whether you mean residues, atoms, or structural groups.
- Choose the corresponding attribute. Use
s.nrfor residues,s.natfor atoms, ors.nsgfor structural groups. - Pick a threshold or interval. Examples include
s.nr > 130ands.nr 100:130. - Check whether composition or charge is relevant. Element counts and charge attributes can express additional properties to investigate.
The attribute space also includes node properties such as name, visibility, and selection state. These can help describe segments in terms of their state in the document, alongside their structural properties. For example, the reference lists s.n "A" as a name-based expression and s.v for visibility.
The broader benefit is practical: instead of relying on visual estimation or manual counting, you can state the property you care about in a compact, readable expression. For the complete list of segment attributes and their inherited properties, see the SAMSON segment attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
