When a molecular structure contains many chains, domains, or other segments, finding the one you need by inspection can become tedious. A name may be unclear, and two segments that look similar can differ in length, composition, or charge. SAMSON’s Node Specification Language (NSL) lets you describe the segment you are looking for with attributes—so you can search by measurable properties instead of relying only on visual inspection.
This is especially useful when you want to narrow a large structure to a manageable set of candidates, check whether a segment meets a simple size or composition criterion, or revisit the same kind of selection later. The key is to treat a query as a precise description of a selection criterion, not just as a shortcut for clicking through the molecular tree.
Start with a segment-level question
Segment attributes use the segment attribute space, abbreviated s. For example, to find segments with more than 100 residues, use:
|
1 |
s.nr > 100 |
The longer form is segment.numberOfResidues > 100. The short form is easier to type; the full form can be easier to read when you are learning the language or sharing a query with someone unfamiliar with the abbreviations.
You can also search for segments within a range. For example, s.nr 100:120 describes segments with 100 to 120 residues. This is handy when your goal is not simply to find the largest segment, but to identify candidates of a particular scale.
Use composition and size to refine your search
Segments inherit several attributes from the structuralGroup space. These include counts of atoms and selected elements. For example:
s.nat < 1000looks for segments with fewer than 1,000 atoms.s.nC 10:20looks for segments with 10 to 20 carbon atoms.s.nO < 10looks for segments with fewer than 10 oxygen atoms.s.fc > 1looks for segments with a formal charge greater than 1.s.pc 1.5:2.0looks for segments with a partial charge in the stated range.
These examples make it possible to frame a search around the feature that matters to your task. For instance, if a structure has many segments, you might first inspect the residue-count results, then use atom or element counts to investigate candidates of interest. Keeping those checks separate can also make it easier to understand why a segment matched.
Know which question each attribute answers
s.nr counts residues, while s.nsg counts structural groups. They are different measures: choose the one that corresponds to how you are thinking about the structure. For example, s.nsg > 10 selects segments with more than 10 structural groups; it is not a substitute for a residue-count query.
Some useful attributes describe the segment as a node rather than its contents. The name attribute can be queried with a quoted string, as in s.n "A"; the reference also gives s.n "L*" as an example. Visibility and selection can be checked with s.v and s.selected. One small syntax detail: the documentation lists no short name for selected, so use s.selected rather than assuming it has a compact alias.
Make queries easier to reuse
A useful habit is to write down what a query means in plain language next to the expression. For example: “segments with 100–120 residues” and s.nr 100:120. This reduces ambiguity when you return to a project later or share the selection logic with a collaborator. It also helps catch a common mistake: choosing an attribute that sounds close to the question but measures something else, such as structural-group count instead of residue count.
Segment-level filters are a practical starting point for organizing a complex structure. Begin with the property you actually care about—residue count, atom count, elemental composition, charge, name, or visibility—and use the corresponding attribute to make the search explicit.
For the complete attribute reference and additional examples, see the SAMSON segment attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
