Easily Filter Molecular Segments by Residue Counts in SAMSON

When working with complex molecular structures, identifying specific segments—such as protein chains or molecular groups—with defined characteristics can be a time-consuming task. One common challenge faced by molecular modelers is quickly finding segments containing a particular number of residues, especially when dealing with large biomolecular assemblies. Whether you’re preparing a simulation, analyzing structural patterns, or organizing your scene, having an efficient way to filter segments based on size can save a lot of time and streamline workflows.

In SAMSON, the Node Specification Language (NSL) offers a powerful way to access and manipulate molecular data through attribute-based filtering. One particularly useful, and often overlooked, feature is the ability to match segments by their number of residues using the segment.numberOfResidues attribute, or its short form s.nr.

Why Filter by Residue Count?

If you’re handling a large biomolecule like a protein complex or a fragmented assembly, you may want to:

  • Isolate segments that fall within a specific size range
  • Exclude unusually small segments that may be modeling artifacts
  • Focus analysis on chains of a manageable size
  • Pre-select parts of a structure for simulation or visualization

Instead of manually browsing through structures and checking each segment, use s.nr to express exactly what you need and let SAMSON do the filtering for you.

How to Use segment.numberOfResidues

The segment.numberOfResidues attribute (short form: s.nr) matches segment nodes containing a specified number of residues. The values you can use are integers, and you can filter segments using conditions such as greater than, less than, or within a range.

Examples

  • s.nr > 100 — selects segments with more than 100 residues
  • s.nr < 12 — selects small segments containing fewer than 12 residues
  • s.nr 50:75 — selects segments with residue counts between 50 and 75 (inclusive)

These NSL queries can be used directly in the Search bar within SAMSON or applied in custom scripting when building automations or selections in your workflow.

Combining Filters

One of the strengths of NSL is its ability to combine attributes. For example, if you want to select segments that are visible and contain more than 150 residues:

This allows precise control over your selections and can help reduce errors and manual steps.

Use Case: Focused Visualization

If you’re rendering a large protein complex and want to hide smaller segments that might clutter the visualization, simply use:

This ensures only segments with 30 or more residues remain visible, improving clarity during analysis or when preparing figures.

You can learn more about this attribute in the documentation, including how it fits within NSL and integrates with other attributes such as visible, numberOfStructuralGroups, and more.

Tip: Segment filtering also pairs well with other structural selection criteria available in NSL, enabling rich selection pipelines for workflows from model preparation to simulation setup.

For a full list of segment attributes and example queries, visit the official SAMSON documentation on segment attributes.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.