Control What You See: Managing Presentation Selection in SAMSON

When you’re working on a complex molecular model, keeping the visual clutter under control can make a big difference. Whether you’re focusing on a ligand-binding site or analyzing structural rearrangements, being able to control which elements are selected and displayed is essential. In SAMSON, the Node Specification Language (NSL) allows you to fine-tune selection properties of presentation nodes through dedicated attributes. This blog post will walk you through the selection-related attributes in the presentation attribute space of NSL, helping you gain more control over what you see and interact with—visually and computationally.

Understanding Presentation Nodes and Their Selection State

Presentation nodes in SAMSON represent how underlying structural elements are displayed—think of ribbons, surfaces, or ball-and-stick representations. Managing their selection state lets you script interactions and isolate specific visualization layers without modifying the structural data itself.

Within the presentation attribute space (short name: pr), three useful attributes help you control selection:

  • selected
  • selectionFlag (short name: sf)

1. pr.selected: Visual Selection State

This attribute indicates whether a presentation node is currently selected in the graphical view. You can use:

to match selected presentations, and

to filter out those that are not. One important distinction here is that this attribute is inherited from node.selected, but it does not support the short name s for selection.

2. pr.sf: Boolean Selection Flag

If you need tighter logic control in custom node queries or workflows, the selectionFlag gives access to a boolean flag that represents selection at a more programmable level. Use this for script-controlled selection flows. For example:

matches presentation nodes with an active selection flag, while

matches those not currently selected based on that flag.

When This Matters

Let’s say you’re building a script to export all visuals currently being worked on. You might want to filter through only those elements actually selected and visible to the user. Instead of exporting the full model, you can make your export function more focused and readable by using:

This query will grab only presentation nodes that are both selected by the user and currently visible, significantly improving clarity and performance in downstream tasks.

Similarly, if you’re preparing a publication-grade figure or a frame in a molecular animation, filtering representations by their selection flags helps establish what matters visually—before hitting render.

Key Gains

  • Avoid accidental captures of hidden or irrelevant visual elements.
  • Simplify complex scenes with rule-based visibility logic.
  • Adapt easily in automated workflows that require selection as a filter step.

You can explore the full list of presentation attributes and further details related to selection and visibility in the official documentation.

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

Comments are closed.