Three Attributes That Help You Quickly Filter File Nodes in SAMSON

When working with complex molecular systems in SAMSON, managing and filtering nodes efficiently becomes essential—especially when you’re dealing with large datasets involving multiple file nodes. One question that often arises among molecular modelers is: how can I easily select or filter specific files based on certain criteria?

If you’ve ever spent too much time clicking through the Document view or attempting to isolate just a few files of interest, this post is for you.

Why File Attributes Matter

In SAMSON’s Node Specification Language (NSL), file attributes are special keywords you can use to filter or query file nodes directly. These attributes fall under the file attribute space (abbreviated as fi) and apply only to file nodes—not to atoms, groups, or other entities.

Let’s focus on three core attributes:

  • name or n
  • selected
  • selectionFlag or sf

1. Filter By File Name

You can use fi.n to filter files based on name strings. This is helpful when files follow a naming convention, or you’re looking for something specific.

For example:

Selects a file node named “A”. You can also use wildcard patterns:

Selects all file nodes starting with “L”.

2. Check If Files Are Selected

fi.selected lets you query whether file nodes are currently selected in the interface:

Returns all selected file nodes.

Filters file nodes that are not selected. This can be particularly useful in scripting scenarios where you only want to process or export unselected items.

3. Use the Selection Flag

The selectionFlag (or sf) attribute is subtly different from selected. It indicates whether a node has been marked using the “selection flag,” which may be manipulated in workflows without changing the actual selection state.

Filters files whose selection flag is true.

Returns files with selection flag set to false.

This behavior is useful when you’re processing nodes in batch, identifying candidates for further study, or distinguishing between files without affecting visibility/selection in the GUI.

When Would You Use These?

Imagine you’ve imported multiple structural files from simulations—some in .pdb format, others generated via docking processes. By using simple NSL expressions with the fi attribute space, you can instantly:

  • Filter out only those files whose names match a docking result prefix
  • Process only unselected files during a cleanup operation
  • Use the flagging mechanism to remember which files were shortlisted during a review

These features are particularly powerful for scripting, batch operations, or any task that benefits from automation or repeatability.

More Information

You can find all the technical details and more advanced examples on the official SAMSON documentation page: https://documentation.samson-connect.net/users/latest/nsl/file/

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

Comments are closed.