Find the segment that matters: practical NSL filters for molecular models

Large molecular models can be difficult to inspect one segment at a time. When you need to find an unusually long segment, narrow a structure by its composition, or locate segments within a specific size range, Node Specification Language (NSL) lets you describe the feature you care about and match the relevant segment nodes.

This is useful when the visual model alone does not make a property easy to compare. Rather than relying on appearance, you can ask a more specific question: Which segments have more than 100 residues? Which fall between 100 and 120? Which contain fewer than 10 carbons? The segment attribute space provides filters for these kinds of checks.

Start at the segment level

Segment attributes are written in the segment attribute space, whose short name is s. This space matches segment nodes. The short form makes expressions compact: for example, s.nr > 100 looks for segments with more than 100 residues. The equivalent full form is segment.numberOfResidues > 100.

Using the full name can make a query easier to understand when you return to it later; the short name is handy for repeated searches. Both forms describe the same attribute. In the examples below, use the one that feels clearest for your workflow.

Use residue count to find long or bounded segments

Residue count is often a useful first pass when a model contains many segments. To identify segments above a threshold, use an integer comparison:

  • s.nr > 100 matches segments with more than 100 residues.
  • s.nr 100:120 matches segments with a residue count between 100 and 120.

A threshold is useful when you want to isolate especially long segments; a range is better when you are comparing a particular size band. The same distinction applies to numberOfStructuralGroups, abbreviated nsg: s.nsg > 10 selects segments above 10 structural groups, while s.nsg 10:12 selects those between 10 and 12.

Use composition counts as a second check

Segment attributes also inherit atom-count properties from the structural-group attribute space. These can help you narrow a search by elemental composition without beginning with individual atoms. For example, s.nC < 10 searches for segments with fewer than 10 carbons, and s.nO 10:20 searches for segments with an oxygen count between 10 and 20. Similar integer attributes are available for hydrogen (nH), nitrogen (nN), sulfur (nS), total atoms (nat), and coarse-grained atoms (ncga).

Charge-related attributes offer another way to describe a segment: s.fc is the integer-valued formal charge attribute, while s.pc is the float-valued partial charge attribute. Examples include s.fc > 1 and s.pc 1.5:2.0. Keeping the attribute names in view helps avoid treating these as interchangeable filters.

Make the query answer one clear question

A practical way to build a search is to begin with one measurable criterion, such as residue count, and then consult the available attributes for a more specific follow-up. For instance, first check the long-segment criterion s.nr > 130; if the question is about segment size in terms of structural groups instead, use s.nsg > 10. These are separate example expressions, not a combined query. This keeps each filter easy to read and makes it clearer which property produced the match.

For quick checks, remember the key abbreviations: nr means number of residues, nsg means number of structural groups, and nC, nH, nN, nO, and nS refer to counts of those elements. Numeric ranges and comparisons turn those properties into targeted searches, helping you move from “this model is too large to inspect manually” to a specific, testable criterion.

For the complete list of inherited and segment-specific attributes, see the SAMSON segment attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON at samson-connect.net.

Comments are closed.