Find the segment that’s slowing down your molecular-modeling workflow

When a molecular structure contains many segments, finding the one you need can feel like searching a long list by hand. Perhaps you want to locate unusually large segments, narrow down a region by residue count, or check whether a segment contains a particular number of atoms. SAMSON’s Node Specification Language (NSL) lets you express these criteria as compact searches.

This guide focuses on a practical starting point: filtering segment nodes by size and composition. The examples use the segment attribute space, whose short name is s.

Start with the right kind of node

A segment query matches segment nodes. That distinction matters: a query such as s.nr > 100 is about segments with more than 100 residues, not a general search for any node containing residues. Using the appropriate attribute space helps keep the results focused on the objects you intend to inspect.

Find segments by residue count

Residue count is often a useful first filter when you need to identify a large segment or focus on a narrower size range:

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

The long form of the first expression is segment.numberOfResidues > 130. The shorter form is convenient for repeated queries; the long form can be easier to read when you are learning the attribute names.

These two expressions answer different questions. Use a comparison such as > 130 when you have a threshold in mind. Use a range such as 100:130 when you want to concentrate on a band of sizes. If you are checking results around a boundary, try a nearby threshold or range as a separate query rather than assuming the two searches are interchangeable.

Use structural-group count as another size signal

A segment’s number of structural groups can provide a second way to narrow your search:

  • s.nsg > 10 matches segments with more than 10 structural groups.
  • s.nsg 10:12 matches segments with a structural-group count between 10 and 12.

This count is not the same attribute as residue count. Choose the one that reflects the question you are asking, and treat each query as its own filter. For example, start with s.nr > 100 to find segments by residue count, then inspect the results and run a separate s.nsg > 10 query if structural-group count is also relevant.

Check composition and atom counts

Segments also inherit several useful attributes from the structural-group attribute space. These let you search by total atom count, elemental counts, and charge. For instance:

  • s.nat < 1000 looks for segments with fewer than 1,000 atoms.
  • s.nC < 10 looks for segments with fewer than 10 carbons.
  • s.nO 10:20 looks for segments with between 10 and 20 oxygens.
  • s.fc > 1 looks for segments with formal charge greater than 1.
  • s.pc > 1.5 looks for segments with partial charge greater than 1.5.

Notice the value types: counts and formal charge use integers, while partial charge uses floating-point values. Keeping that distinction in mind makes it easier to write expressions that match the attribute you mean to measure.

A simple, repeatable search routine

  1. Decide what you need to find: a segment’s size, composition, charge, name, or display state.
  2. Choose the corresponding attribute. For example, use nr for residue count, nat for atom count, or nO for oxygen count.
  3. Write a threshold or range that reflects your question, such as s.nr > 130 or s.nO 10:20.
  4. Review the matches, then adjust the threshold or try another attribute if the result set is too broad or too narrow.

NSL also supports segment attributes inherited from nodes, including name and visibility. For example, s.n "A" searches by name, while s.v and not s.v distinguish visible from non-visible segments. For selection state, the documented expression is s.selected; unlike many segment attributes, this one has no short name.

For the full 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.

Comments are closed.