When a molecular structure contains many segments, it can be surprisingly time-consuming to identify which ones deserve a closer look. You might be trying to find unusually long segments, check whether a structure contains small fragments, or narrow a search to segments with particular atom counts. Counting residues or atoms manually is slow—and easy to get wrong.
SAMSON’s Node Specification Language (NSL) lets you describe segment-level criteria as expressions. The segment attribute space uses the prefix s, so a query can match segments by residue count, structural-group count, atom composition, charge, name, or visibility-related properties.
Start with segment size
For a quick scan of long segments, use s.nr, the short name for numberOfResidues. For example:
s.nr > 100matches segments with more than 100 residues.s.nr 100:120matches segments with a residue count between 100 and 120.
This can help when you want to distinguish larger segments from shorter ones without inspecting each segment individually. If you are interested in the number of structural groups instead, use s.nsg:
s.nsg > 10matches segments with more than 10 structural groups.s.nsg 10:12matches segments with between 10 and 12 structural groups.
These two measurements answer different questions: residue count gives you a residue-based size criterion, while structural-group count checks the number of structural groups in a segment. Choose the one that matches the way you need to describe the structure.
Use composition and charge as extra clues
Segment attributes also inherit several useful measurements from the structural-group attribute space. For example, s.nC, s.nN, and s.nO refer to the numbers of carbon, nitrogen, and oxygen atoms. You can use comparisons or ranges to express a threshold:
s.nC < 10matches segments with fewer than 10 carbons.s.nO 10:20matches segments with between 10 and 20 oxygens.s.nat < 1000matches segments with fewer than 1,000 atoms.
For charge-related checks, s.fc represents formal charge and s.pc represents partial charge. For instance, s.fc > 1 tests for formal charges above 1, while s.pc 1.5:2.0 specifies a partial-charge range. The documentation lists integer values for formal charge and floating-point values for partial charge.
Make the query readable
Short names are handy once you know them, but full attribute names can make a query easier to understand later. The long form segment.numberOfResidues > 100 expresses the same criterion as s.nr > 100. A practical habit is to use the short form while exploring, then keep a note of the full attribute name when sharing or documenting a query.
Not every segment attribute describes molecular composition. Inherited node attributes include s.n "A" for matching a name, s.visible for visibility, and s.selected for selection state. The selected attribute is a special case: it has no short name, so use the full form rather than trying to abbreviate it.
These expressions turn common inspection questions into explicit criteria: How many residues does a segment contain? Does its atom count fall below a threshold? How many oxygens or structural groups are present? Instead of relying on memory or manual counting, you can state the criterion directly and use it to identify matching segment nodes.
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.
