When working with complex molecular models, molecular modelers often face the challenge of quickly locating specific visual representations—such as identifying what is and isn’t visible, or filtering only selected visual nodes. This process can get tedious when dealing with large biomolecular systems or detailed simulation results.
Thankfully, the Presentation attributes in SAMSON’s Node Specification Language (NSL) provide a concise and powerful solution to this. These attributes help streamline interaction with molecular visuals by enabling fast, programmable filtering of presentation nodes, i.e., visual representations of molecules, atoms, graphs, etc.
What are presentation attributes?
In NSL, presentation attributes belong to the presentation attribute space, which is accessible via the short prefix pr. These attributes apply only to presentation nodes, not the underlying structural data.
They allow users to target the following:
- Visibility – whether a visual representation is currently shown or hidden.
- Selection – whether a presentation node is selected or flagged for selection.
- Names – string-based filtering of node names, with support for wildcards.
Common use cases
Here are a few common but powerful queries you might find useful:
pr.v— Selects all presentation nodes currently visible.not pr.v— Selects all hidden presentation nodes. This is handy when trying to restore visuals you’ve accidentally hidden.pr.selected— Filters only the visual nodes that have been selected, regardless of the molecule’s underlying structure.pr.n "Hydrophobic*"— Finds presentation nodes whose names start with “Hydrophobic”, useful when working with labeled views.pr.sfandpr.vf— Filters based on system-flagged selections or visibility, offering more refined control during script automation.
Using these attributes helps quickly clean up a visualization, inspect only what matters, or even script camera views based on visual criteria.
Tips for combining presentation attributes
You can combine multiple filters to express more focused queries. Here’s an example:
|
1 |
pr.v and pr.selected |
This returns only visual nodes that are both visible and selected. Such slightly complex queries are often used when preparing publication-quality figures or pre-filtering elements before exporting to another format.
Another example:
|
1 |
pr.n "Ligand*" and not pr.h |
This selects all visible presentation nodes that have a name starting with “Ligand,” ignoring hidden ones. Perfect for quickly re-enabling ligand visuals in large systems where many objects are toggled on/off.
Why use it?
Without NSL’s presentation attribute filters, analyzing a dataset visually can become a time-consuming point-and-click task. These commands eliminate manual steps, making workflows more reproducible and reducing the risk of missing specific data views buried in layers of visual settings.
For more details and examples of each attribute, refer to the official documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
