When working on complex molecular models, especially in large systems with multiple datasets, managing and filtering different nodes in your project becomes crucial. Many users of the SAMSON molecular design platform need a fast way to query and act on specific nodes — for example, files — without having to click through endless parts of the UI.
This is where the Node Specification Language (NSL) comes in, allowing you to query nodes using attributes. It becomes essential when you want to write scripts or set up rules to select certain data automatically.
In this post, we’ll focus on a small but useful class of attributes: file attributes that live in the file attribute space (shortcut: fi). These attributes only match file nodes, and they allow you to filter or act on file nodes based on their name or selection state. Understanding them may help you streamline your modeling workflow just enough to make daily interactions more efficient.
Why filter file nodes?
Imagine needing to quickly isolate all imported molecular structure files whose name starts with a certain prefix — say “LIGAND_”. Or maybe you need to batch-process only the selected file nodes in your workspace. Doing that with manual selection would not only be slow, but also prone to errors.
With SAMSON’s file attributes and NSL, you can write quick expressions like:
fi.n "LIGAND_*"– to match file nodes with names starting with “LIGAND_”fi.selected– to match file nodes that are currently selectednot fi.sf– to exclude file nodes whereselectionFlagis true
The three attributes to know
Here’s a breakdown of the available attributes under the file attribute space:
| Attribute | Short Name | Possible Values | Examples |
|---|---|---|---|
| name | n |
quoted strings (supports wildcards) | fi.n "A", fi.n "L*" |
| selected | (none) | true, false |
fi.selected, not fi.selected |
| selectionFlag | sf |
true, false |
fi.sf, fi.sf false |
These attributes are inherited from node-level attributes, but when used in file queries, they apply only to file nodes. For example, even though selected is common for most nodes, here we’re explicitly applying it to the file space (fi).
Example use case: Selecting all relevant data files
Suppose you’re working on a protein-ligand docking project and your workspace includes a variety of imported datasets: experimental data, prediction results, ligands, targets, etc.
To get a list of all ligand files with names starting with “LIGAND_” that are also selected, try this:
|
1 |
fi.n "LIGAND_*" and fi.selected |
This will help you isolate only the selection-relevant, name-matching files for further processing, visualization, or export.
Conclusion
Understanding how to use fi.n, fi.selected, and fi.sf can save you time and add precision to your modeling workflow. These are small tools, but once incorporated into your daily filtering and scripting habits, they can make a significant difference in your productivity.
To learn more about file attributes and how they interact with other NSL features, explore the full documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. Download SAMSON at https://www.samson-connect.net.
