Find the Right Files Without Losing Track of Your Query

When a molecular project contains several files, it can be easy to lose track of which file you mean. A useful first step is to narrow a search to file nodes, then describe the files you want by name or selection state. In SAMSON, the Node Specification Language (NSL) provides a small set of file attributes for doing just that.

Start with the file attribute space

File attributes live in the file attribute space, whose short name is fi. This space matches only file nodes. That distinction helps keep a query focused: rather than searching across every kind of node, you can express that your target is a file.

For example, these two forms refer to the same attribute space:

  • file.name uses the full attribute-space name.
  • fi.n uses the short name for the space and the short name for the name attribute.

The file page’s examples use the abbreviated form, which is convenient when writing or reading compact expressions.

Use names to narrow the search

The name attribute is inherited from the general node attribute space. Its short name is n, and its values are written as strings in quotes. The documented examples are:

  • fi.n "A"
  • fi.n "L*"

These give you a way to express a name-based file query. If you are looking for a particular file, begin with the name you expect. If you are using a pattern such as the documented "L*", treat it as a query value rather than assuming that every character-matching detail is defined by this reference page. When a result surprises you, check the name spelling and consult the broader NSL documentation for expression behavior.

Check selection attributes carefully

The file attribute space also includes selected and selectionFlag. They are both inherited from the node attribute space, but they are listed as distinct attributes. For file nodes, selected does not have the short name s. The documented forms are fi.selected and not fi.selected.

selectionFlag does have a short name: sf. The examples include fi.sf and fi.sf false. Keep these names distinct when constructing a query: selected and selectionFlag are not interchangeable spellings in the reference. If your task is about the selected state, use the selected attribute; if you mean the selection flag, use selectionFlag or sf.

A simple query-building routine

  1. Identify the node type. Start in the file space with fi, so the query targets file nodes.
  2. Choose a useful attribute. Use n when the file name is the clue, or use selected or sf when the selection-related attribute is relevant.
  3. Use the documented value form. Put name values in quotes; use true or false for the boolean attributes.
  4. Keep the expression readable. Prefer the full attribute name when clarity matters, and the short form when compactness is helpful.

This small checklist can make file searches easier to inspect and revise. It also helps avoid a common source of confusion: mixing up an attribute’s name, its short name, and the attribute-space prefix.

For the complete file attribute reference, visit the SAMSON documentation page. For broader context, see the pages on Node Specification Language and NSL examples.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.