Ontology Column Filtering

2024-04-19

Premium Feature — Available in the Enterprise Edition of LabKey Server. Learn more or contact LabKey.

Ontology lookup columns support filtering based on concept and path within the ontology. Filtering based on whether a given concept is in an expected subtree (or not in an unexpected one) can isolate desired data using knowledge of the concept hierarchy.

Supported Filtering Expressions

Fields of type "Ontology Lookup" can be filtered using the following set of filtering expressions:

Find By Tree

To use the ontology tree browser, click the header for a column of type "Ontology Lookup" and select Filter.... You cannot use this filtering on the "import" or "label" fields related to your lookup, only the "code" value, shown here as "Medication Code".

Select the Choose Filters tab, then select a concept using the Find <Column Name> By Tree link.

The browser is similar to the concept browser. You can scroll or type into the "Search" bar to find the concept you want. Click the concept to see it within the hierarchy, with parent and first children expanded.

When you locate the concept you want, hover to reveal a filter icon. Click it to place the concept, with code, in the filter box. when using the subtree filter expressions you'll see the path to the selected concept. Shown below, we'll filter for concepts in the subtree under "Analgesic Agent".

Click Close Browser when finished. If needed, you can add another filter before saving by clicking OK.

Subtree Filter Expressions

The example above shows how a subtree filter value is displayed. Notice the slashes indicating the hierarchy path to the selected concept.

  • Is In Subtree: The filter will return values from the column that are in the subtree below the selected concept.
  • Is Not In Subtree: The filter will return values from the column that are in the subtree below the selected concept.
These subtree-based expressions can be combined to produce compound filters, such as medications that are "analgesic agents" but not "adjuvant analgesics":

Single Concept Filter Expressions

When using the Equals or Does Not Equal filtering expressions, browse the tree as above and click the filter icon. The code will be shown in the box.

Set of Concepts Filter Expressions

The filter expressions Equals One Of and Does Not Equal Any Of support multiselection of as many ontology concepts as necessary. Click the filter icons to build up a set in the box, the appropriate separator will be inserted.

Related Topics