When working with complex molecular assemblies, clarity is key. Visual clutter can quickly become overwhelming when your workspace contains hundreds—or even thousands—of molecular structures, segments, or chains. If you’ve ever wished you could filter or selectively focus on visible molecules in SAMSON, the Node Specification Language (NSL) offers a concise, powerful approach to doing just that.
In this post, we explore the visibility-related attributes associated with molecule nodes in the SAMSON NSL. These attributes can help you programmatically define what stays visible, isolated, or hidden, so you can streamline your molecular design experience.
Why Visibility Filtering Helps
Let’s say you’re analyzing protein-ligand interactions but don’t want to display solvent molecules. Or perhaps you’re running an inspection script and only want to apply it to the molecules currently visible on screen. In both cases, understanding visibility control is essential.
SAMSON allows you to filter molecules using several attributes related to visibility. Here are some key attributes available within the mol (short for molecule) attribute space:
mol.v – The visible attribute
This attribute checks whether a molecule is actually visible. Use it when you want to select molecules currently shown on screen.
mol.v– matches molecules that are visiblenot mol.v– matches molecules that are not visible
mol.vf – The visibilityFlag
This is a flag that can be toggled independently of actual visibility. For example, if a molecule is in a hidden folder or parent object, the flag might be set to true, but the molecule still won’t be drawn.
mol.vf true– visibility flag enabledmol.vf false– flag disabled, meaning the molecule is forced to stay hidden even if other conditions would make it visible
mol.h – The hidden status
The hidden property reflects whether the molecule has been manually hidden.
mol.h– the molecule is explicitly hiddennot mol.h– the molecule is not hidden
Practical Examples
Here are a few practical examples of NSL expressions you might use:
mol.v– Select all currently visible moleculesnot mol.h– Select molecules that are not manually hiddenmol.vf true– Select molecules with visibility flags set to truemol.v and not mol.h– Select visible molecules that are not manually hidden
These expressions can be entered in the search bar within the SAMSON interface or used in scripts to isolate and process visible molecules.
Summary
By understanding how the visible, hidden, and visibilityFlag attributes interact, you can gain precise control over your visual workspace. Whether you’re cleaning up your view, preparing screenshots, or processing selections in pipelines, the NSL visibility attributes are a straightforward tool that can make your modeling more focused and less cluttered.
Learn more at the original documentation page: https://documentation.samson-connect.net/users/latest/nsl/molecule/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON here.
