Controlling Molecule Visibility in SAMSON with NSL Filters

When working with complex molecular systems, it’s easy to lose track of what’s visible in your scene and what isn’t. Whether you’re analyzing a macromolecule, building simulation-ready models, or preparing visuals, controlling what shows up on screen can make a big difference. For SAMSON users, the Node Specification Language (NSL) provides a powerful way to search, filter, and control molecular visibility — right down to individual attributes.

Let’s take a closer look at how you can use molecule visibility attributes in NSL to streamline your workflow.

What visibility-related attributes are available?

In SAMSON, all molecule nodes inherit certain visibility functions via NSL. Here are a few key attributes you can filter molecules by:

  • visible (v): Whether the molecule is currently visible.
  • hidden (h): Whether the molecule is explicitly hidden.
  • visibilityFlag (vf): Internal visibility flag.
  • selectionFlag (sf): Used to determine selection status in complex selections.

Each of these attributes can be queried using NSL expressions. For example:

  • mol.v – Matches all molecules that are currently visible.
  • not mol.v – Matches all molecules that are hidden.
  • mol.vf false – Matches molecules with visibility flag set to false.

Why does this matter?

When you’re building a complex model with many subcomponents (e.g., chains, ligands, ions), visibility becomes important not just for sanity but for performance. Rendering fewer nodes means visualization is faster and interactions are smoother. More importantly, filtering what you see lets you focus on what matters in the moment.

Here are a few real-world use cases where visibility filters can help:

  • Presentation Prep: Quickly isolate the visible components before capturing screenshots.
  • Scene Debugging: Identify which molecules are unintentionally hidden and bring them back to view.
  • Workflow Simplification: Hide large molecules to work on small ligands or cofactors.

Combining Visibility with Other Filters

You can combine visibility queries with other attributes to target highly specific subsets. For example:

  • mol.v and mol.nr > 100 – Visible molecules with more than 100 residues.
  • not mol.v and mol.name "L*" – Hidden molecules with names starting with “L”.
  • mol.vf and not mol.sf – Molecules that are visible but not selected.

This gives you great control over the scene and allows batch operations on matching elements.

How to Use This in Practice

To try this in SAMSON, open the NSL search panel and type any of the expressions above. Elements matching that expression will be listed and can be quickly isolated, shown, or hidden.

You can also combine this with script-based actions or SAMSON Extensions to automate visualization tasks with minimal manual work.

Effective visibility filtering is a small detail that can significantly improve your modeling and visualization experience. If you’re not already using NSL filters for visibility, it’s worth giving them a try!

You can explore the full list of molecule attributes, including visibility, in SAMSON’s official documentation: https://documentation.samson-connect.net/users/latest/nsl/molecule/

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

Comments are closed.