Find the right molecular segment without counting by hand

When a molecular structure contains many segments, locating the one you need by inspection can be slow and error-prone. Is it the segment with more than 100 residues, the one with a particular atom count, or the segment carrying a certain charge? SAMSON’s Node Specification Language (NSL) lets you describe these criteria as queries, so you can search by properties instead of relying on names or manual counting.

Start with the segment scope

Segment attributes are written in the segment attribute space, whose short name is s. This scope matches segment nodes. For example, s.nr > 100 asks for segments with more than 100 residues. The longer form, segment.numberOfResidues > 100, expresses the same criterion.

Using the full attribute name can make a query easier to understand when you revisit it later. The short form is convenient when you are writing or comparing several expressions. Both refer to the same attribute.

Choose the measurement that answers your question

A common source of confusion is treating different kinds of size as interchangeable. Segment attributes provide several distinct counts:

  • s.nr measures the number of residues. For example, s.nr 100:120 matches segments with 100 to 120 residues.
  • s.nsg measures the number of structural groups. For example, s.nsg > 10 matches segments with more than 10 structural groups.
  • s.nat measures the number of atoms. For example, s.nat < 1000 matches segments with fewer than 1,000 atoms.

These counts answer different questions. If you are screening for a segment of a particular sequence length, use the residue count. If you need to describe its structural-group count or atom count, use the corresponding attribute instead. The documentation also lists counts for carbon, hydrogen, nitrogen, oxygen, sulfur, and coarse-grained atoms—for example, s.nC 10:20 specifies a carbon-count range.

Use ranges to narrow a search

NSL examples show both comparisons and ranges. A comparison such as s.nr > 130 sets a lower threshold; a range such as s.nr 100:130 specifies an interval. The same patterns are available for other integer-valued segment attributes, including s.nsg, s.nat, and the elemental counts. For partial charge, which is a floating-point value, examples include s.pc > 1.5 and s.pc 1.5:2.0.

Formal charge and partial charge are separate attributes: the documentation identifies s.fc as an integer-valued formal charge and s.pc as a floating-point partial charge. Pick the one that corresponds to the property you intend to inspect rather than assuming the two charge measures are equivalent.

Include identity and display state when useful

Segments also inherit general node attributes. To match by name, use a quoted string, such as s.n "A". The reference gives s.n "L*" as another example. Attributes such as visibility and selection state can also be queried: s.v refers to visibility, while s.selected refers to whether the node is selected. The latter has no short name in the segment attribute space, so use it as written.

A practical way to build a useful search is to first decide what “the right segment” means: its residue count, atom count, composition, charge, name, or display state. Then choose the matching attribute and write the threshold or range that expresses your requirement. This keeps the query tied to the question and avoids mistaking one measure of segment size for another.

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.

Comments are closed.