Find the right molecule in a crowded model: filter by structure counts

When a molecular scene contains several molecules, finding the one you need by eye can be slow. Names may not be distinctive, and a visual inspection may not tell you whether a molecule has the number of residues, chains, or structural groups you are looking for. SAMSON’s Node Specification Language (NSL) offers another route: match molecule nodes using counts that describe their structure.

This is especially useful when you are trying to narrow down a model by its overall organization. For example, you might need to identify molecules with more than 100 residues, compare molecules with different numbers of chains, or locate a molecule with a particular range of structural groups. Rather than relying only on appearance, you can express the criterion directly.

Start with molecule counts

Molecule-specific attributes use the molecule attribute space, abbreviated mol. The documentation lists four counts specific to this space:

  • numberOfChains, short name nc
  • numberOfResidues, short name nr
  • numberOfSegments, short name ns
  • numberOfStructuralGroups, short name nsg

These attributes accept integer values. You can write their full names or use the shorter forms, which are convenient when entering expressions repeatedly.

Translate a structural question into a query

Suppose you want molecules with more than 100 residues. The full expression is molecule.numberOfResidues > 100; the concise version is mol.nr > 100. To look for molecules with a residue count between 100 and 120, use mol.nr 100:120.

The same pattern works for other listed counts. To match molecules with fewer than three chains, use mol.nc < 3. To specify a chain-count range, use mol.nc 2:4. For segments, mol.ns > 2 matches molecules with more than two, while mol.ns 2:4 specifies a range. And mol.nsg > 10 selects by a structural-group count greater than ten.

Choose the count that answers your question

These numbers describe different aspects of a molecule, so it helps to be clear about what you are trying to distinguish. A chain-count query is appropriate when the number of chains matters; a residue-count query is better when you want to narrow candidates by residue total. Segment and structural-group counts provide two other ways to characterize molecule organization. They are not interchangeable measures, so choose the attribute that corresponds to the question you actually have.

For example, if your goal is to find a molecule with a substantial residue count, begin with mol.nr. If the number of chains is the key distinction, use mol.nc instead. This makes the query easier to interpret later: the attribute itself records why a molecule matched.

Use the short form for quick iteration

Full attribute names are helpful when you are learning or reviewing an expression: molecule.numberOfChains makes the intent immediately readable. Short names such as mol.nc and mol.nr are compact for repeated use. Both forms are documented, so you can choose the one that best fits your workflow.

One practical approach is to begin with a broad threshold, inspect the matches, and then adjust the integer or range to fit the set of molecules you need to distinguish. The examples above show the available comparison styles for these attributes: less than, greater than, and a colon-separated range. They let you describe a structural criterion explicitly instead of searching through names or relying on visual estimates.

For the complete molecule attribute reference and additional inherited attributes, see the SAMSON molecule attributes documentation.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.