When working on complex biomolecular systems in SAMSON, clarity is key. Whether you’re visualizing protein-ligand interactions, preparing presentation materials, or just cleaning up a display for focused analysis, showing only specific chains in your molecular model can save time and reduce cognitive load.
This blog post dives into the visibility-related attributes available for chain nodes in SAMSON using the Node Specification Language (NSL). We’ll focus on the following Boolean attributes:
c.v— visiblec.vf— visibilityFlagc.h— hidden
These visibility controls are simple but powerful. Let’s explore how they work and when to use them.
What’s the difference?
c.v (visible) returns true if a chain is visible in the viewport. It evaluates the actual visibility state of a chain — whether it is currently being shown. If you want to select visible chains only, you can use:
|
1 |
c.v |
To toggle the visibility, combine with logical operators:
|
1 |
not c.v |
c.h (hidden) is the opposite side of the coin. This checks if the chain is currently hidden:
|
1 |
c.h |
Note: You can also use not c.h to get chains that are not hidden.
Finally, c.vf (visibilityFlag) is useful for workflows where toggling flags is part of conditional rendering or scripted automation. It stores whether the visibility flag is on or off, independent of what other parts of the model are doing. For practical filtering, use:
|
1 |
c.vf false |
To retrieve chains with the flag disabled.
Use cases that save time
Scenario 1: Simplified visualization
You’ve imported a PDB with several chains (e.g., A, B, C). You want only Chain A for a focused view. Use:
|
1 |
c.n "A" and c.v |
Then, toggle visibility on for that selection. Or hide others using:
|
1 |
not c.n "A" and c.v |
…followed by a hide command.
Scenario 2: Preparing custom selections
Let’s say you want to export only visible chains in a simulation snapshot:
|
1 |
c.v |
This selection ensures your export isn’t cluttered with invisible chains.
Why this matters
Molecular modeling often requires iteration. During setup and cleanup, clear visualization of specific chains, ligands, or subunits can help prevent errors like accidentally deleting an important residue or exporting artifacts from hidden selections. Whether scripting in NSL or using visual selection filters, understanding visibility attributes lets you be more precise and efficient.
Learn more
The complete list of chain visibility attributes is available in the SAMSON documentation, where you can also explore examples and inheritance hierarchy for attribute spaces.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.
