An Easier Way to Select Files in SAMSON with NSL

Anyone working with complex molecular systems in SAMSON has likely experienced the challenge of managing large numbers of molecular files. Whether you’re setting up a simulation, grouping files for export, or preparing data for analysis, finding the right files quickly and precisely is essential. This is where the Node Specification Language (NSL) in SAMSON can help save time and reduce frustration.

In this post, we’ll take a closer look at how to select molecular files in SAMSON using NSL’s file attributes, particularly focusing on how attributes like name, selected, and selectionFlag streamline file querying and filtering.

Why this matters

Imagine you’ve opened a project with dozens (or hundreds) of files: experimental results, simulation outputs, processed data, and more. Now you want to select only those starting with “LIG_”, or maybe flag only unselected files for further work. Doing this manually is tedious. Using fi (the short name for the file attribute space), you can achieve precise filtering using simple NSL expressions integrated into SAMSON’s selection filters.

Matching file names using fi.n

Want to select files with a specific name pattern? Use the name attribute:

This selects all files whose names start with “LIG_”. Similarly, to select files named exactly “A”:

Filtering by selection status

If you’ve already selected some files manually—or based on previous scripts—you can use the selected attribute to filter them. For instance:

Returns only the currently selected files. Want the inverse?

This can be exceptionally useful when you want to apply an operation only to the unselected files, such as selecting only those that have not yet been rendered or exported.

Using selection flags via fi.sf

The selectionFlag attribute (short name sf) offers more nuanced control. For example, if you flagged certain files earlier in your workflow:

Lists all files with the selection flag set to true, while:

Gives you those that have not been flagged. Selection flags can be applied programmatically or manually through the UI, offering a layer of categorization without changing the selection state.

Combining filters

Combine attributes to form more specific queries. For example:

Finds all files starting with “LIG_” that have not been flagged. Perfect for spotting newly imported molecules that need to be processed.

If you’re working with file-heavy research projects in SAMSON, mastering this subset of NSL can drastically reduce the mental load and save time.

Want to explore more about how file attributes work in NSL? Head over to the official documentation page.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.