When a molecular structure contains several chains, it is easy to select the wrong one—or to spend time clicking through chains just to find the one that meets a simple criterion. A chain may be identified by its ID, but sometimes what matters is its length, its number of segments, or how many structural groups it contains. SAMSON’s Node Specification Language (NSL) lets you describe those criteria as expressions, so you can search for matching chain nodes directly.
Start with the chain attribute space
Chain attributes are written in the chain attribute space, whose short name is c. These expressions match chain nodes. You can use the full attribute name or, where one is provided, its shorter form. For example, chain.numberOfResidues > 100 and c.nr > 100 express the same criterion.
The short form is handy when you are iterating on a query. The full form can be easier to read later, especially when sharing an expression with a colleague who is new to NSL.
Find a chain by ID
If you know the chain ID, use chainID, or its short name, id. For example:
c.id 1matches chains whose ID is 1.c.id 2:4, 6matches chains with IDs from 2 through 4, as well as the chain with ID 6.
This is useful when a structure has multiple chains and you need to target a known chain without relying on its position in a list. If you are checking an unfamiliar structure, the range-and-list form also gives you a concise way to request several IDs in one expression.
Use chain size when IDs are not enough
A chain’s ID does not tell you how large it is. To filter by residue count, use numberOfResidues (nr):
c.nr > 100matches chains with more than 100 residues.c.nr 100:120matches chains with a residue count between 100 and 120.
This is a practical way to distinguish longer chains from shorter ones when inspecting a complex, or to locate chains within a size range you care about. The expression describes the criterion; it does not require you to guess a chain ID first.
Check segmentation and structural groups
Other chain-specific counts can help narrow down what you are inspecting. numberOfSegments has the short name ns, while numberOfStructuralGroups is abbreviated as nsg:
c.ns > 2matches chains with more than two segments.c.ns 2:4matches chains with between two and four segments.c.nsg > 10matches chains with more than ten structural groups.c.nsg 10:12matches chains with between ten and twelve structural groups.
These attributes answer different questions from residue count: residues, segments, and structural groups are separate measures in the chain attribute space. Choose the one that corresponds to the property you need to inspect rather than treating the counts as interchangeable.
Remember inherited attributes
Chains also inherit attributes from the more general node and structuralGroup spaces. For example, you can query a chain’s name with c.n "A", or use inherited properties such as c.fc for formal charge and c.pc for partial charge. The reference also lists visibility, selection, and atom-count attributes. This means chain queries can describe more than chain ID and length—but it is worth checking the attribute’s possible value type before writing a filter. Names use quoted strings, counts use integers, and partial charge uses floating-point values.
A useful habit is to begin with one clearly understood criterion—such as c.id 1 or c.nr > 100—then add other criteria only when needed. That makes a query easier to read and easier to troubleshoot. For the complete attribute list and syntax examples, see the SAMSON chain attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
