When working with complex molecular systems in SAMSON, navigating through large numbers of nodes—especially files—can be time-consuming and tedious. For molecular modelers juggling multiple simulations, structures, or imported datasets, being able to efficiently filter or act on specific file nodes is more than just convenient—it’s essential.
Fortunately, SAMSON’s Node Specification Language (NSL) provides a powerful way to query and filter file nodes using attributes. This blog post focuses on three practical file selection attributes in the file attribute space (fi), designed to simplify your workflow: name, selected, and selectionFlag.
📁 Focus on file nodes with “file” attribute space (fi)
In SAMSON’s NSL, the fi attribute space is scoped specifically to file nodes. This means that queries like fi.n "model_1" will only match nodes of type file, ignoring atoms, bonds, groups, annotations, and other node types.
Let’s explore the three main attributes available for file nodes:
1. fi.n – Match files by name
The name attribute allows you to match files based on their names using string patterns. This is helpful when working with a known naming convention. For instance:
fi.n "Ligand_A"– matches exactly the file named “Ligand_A”.fi.n "Prot_*"– matches any files whose names start with “Prot_”.
This is especially powerful when you routinely generate files using a script or standard naming format.
2. fi.selected – Filter by selection state
If you want to perform operations only on file nodes that are currently selected in the document, use:
fi.selected– matches selected file nodesnot fi.selected– matches unselected file nodes
This attribute helps cleanup and script design: for example, identify files you’d forgotten to unselect, or apply a batch operation only to your current working set.
3. fi.sf – Use selection flags intelligently
The selectionFlag attribute (fi.sf) interacts with a more technical marker used during certain workflows, such as scripting complex selections or storing temporary states. Examples include:
fi.sf– returns files where the selection flag is setfi.sf false– matches files where the selection flag is not set
This can be helpful for managing intermediate nodes created by automated processes or extensions.
Practical example
Suppose you’ve run docking calculations with multiple ligands and saved each as a separate file named Ligand_A, Ligand_B, etc. To find only the selected ones whose names start with “Ligand_”, you’d write:
|
1 |
fi.n "Ligand_*" and fi.selected |
This level of precision can dramatically reduce the time spent tediously clicking through the node inspector panel and help automate selections in complex pipelines.
While NSL might at first seem like just a search bar, its structured design—especially in how it targets specific attribute spaces like fi—makes it a powerful tool for both daily use and automation.
To learn more, visit the full documentation page here: https://documentation.samson-connect.net/users/latest/nsl/file/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
