In large molecular modeling projects, researchers often work with multiple molecular files simultaneously: ligand libraries, protein targets, simulation outputs, potential energy surfaces, and more. Navigating these files in a project tree can become tedious, especially when files are ambiguously named or numerous.
Fortunately, the Node Specification Language (NSL) in SAMSON provides an efficient way to query and filter elements in your project based on their attributes. In this post, we’ll explore how you can use NSL to rapidly identify and work with specific file nodes using attributes like name, selected, and selectionFlag.
Why this matters
If you’ve ever manually clicked through a deep project hierarchy trying to remember whether the file named A_final was the cleaned ligand or the one where you forgot to assign charges, this blog post is for you. By using NSL’s file attributes, you can streamline your workflow, reduce errors, and gain better control of your dataset.
Specifying file node attributes
File nodes in NSL are addressed with the prefix fi. For example, fi.n refers to the name attribute of a file node. Here’s a quick overview of the available filters:
fi.n: Selects files by name. You can use wildcards. For example:fi.n "Ligand_123"matches files named exactlyLigand_123.fi.n "Ligand_*"helps you grab all ligand files.
fi.selected: Selects files based on their selection state in the SAMSON interface. You can also usenot fi.selectedto select files that are not selected.fi.sf: Refers to the selectionFlag, useful when you’re working with selection sets. You can use it similarly to theselectedattribute.
Working examples
You can combine NSL queries in the search bar to quickly act on subsets of your project. Here are a few typical use cases:
1. Find all ligand files currently selected:
|
1 |
fi.n "Ligand_*" and fi.selected |
2. Deselect all files with names starting with “Old_”:
|
1 |
not fi.n "Old_*" |
3. Check which files haven’t been flagged in your current selection set:
|
1 |
fi.n "*" and not fi.sf |
These types of queries make it easier to automate and manage large projects, especially when coupled with selections, tagging and scripting tools built into SAMSON.
A small note on short names
Some attributes have short forms to make querying faster. For example, name becomes n and selectionFlag becomes sf. However, note that selected from file nodes does not support a short name alias. Keep that in mind to avoid confusion.
With these tools in your NSL toolbox, navigating your molecular files becomes far easier. For more examples and complete documentation, visit the official SAMSON documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
