Skip to content

How to Use Code Filter

The Code Filter is an advanced query mode available in both the Filter panel and the Search panel across all data tables (Factor Overview, Marker Genes, ROI Stats, Gene list, etc.). It lets you write expressive, multi-condition queries instead of using the standard dropdown filters.

Why use Code Filter?

The Code Filter is designed for users who need flexible and complex query capabilities:

  • Logical OR Queries: Standard filter panels only combine conditions using AND. The Code Filter lets you use OR and NOT logic (e.g. Gene = 'Gad1' or Gene = 'Gad2').
  • Advanced Text Matching: Query values using case-insensitive substring containment (contains), SQL-style wildcards (like), list checks (in), or regular expressions (/pattern/).
  • Multi-Column Logic: Combine filters across different data types simultaneously (e.g. 'Top 20 Genes' contains 'Vip' and Weight > 0.5).

1. Activating Code Filter

Click the terminal icon on the right side of the Filter or Search panel to switch to Code Filter mode. Click it again to return to standard mode.

Info

Switching modes clears the current code expression, but standard filters are preserved.

2. Column Names

You can reference table columns in your expressions using Visual Column Name.

Tip

If the name contains spaces or hyphens, wrap it in single quotes, for example:

  • 'Top 20 Genes' contains 'BRSK2'
  • Gene = 'GAD1' (No quotes needed as "Gene" has no spaces)

3. Writing Expressions

Expressions are evaluated row-by-row. Below are examples of different query features and operators:

Basic comparisons

Filter rows by comparing numeric or string values using >, <, =, !=, >=, <=:

1
2
3
pValue > 1.3
foldEnrichment >= 2
Gene = 'GAD1'

Case-insensitive text contains — contains

Use contains to check if a column's text contains a substring (case-insensitive):

1
2
Gene contains 'GAPD'
'Top 20 Genes' contains 'BRSK2'

SQL-style wildcards — like

like performs pattern matching where % acts as a wildcard:

Pattern Matches
Gene like 'Gad%' Genes starting with "Gad" (case-insensitive)
Gene like '%dh' Genes ending with "dh"
Gene like '%GAPD%' Genes containing "GAPD" anywhere
not Gene like 'Mt-%' Genes NOT starting with "Mt-"

List membership — in

Check if a value matches any item in a comma-separated list:

1
Gene in ('GAPDH', 'ACTB', 'Gad1')

Multi-word search (Standard query fallback)

If you write a simple list of terms with no operators, it searches all columns for any of the terms:

1
Gad1 Gad2 Vip

This returns rows where "Gad1", "Gad2", or "Vip" appears in any column cell.

Regular expressions — /pattern/

You can search all columns in a row using regular expressions:

  • /^mt-/ (Matches rows where any column starts with "mt-", case-insensitive)
  • !/rp/ (Excludes rows containing "rp")

Combining conditions

Combine multiple filters using and, or, and not (case-insensitive):

1
2
3
pValue > 1.3 and foldEnrichment > 2
pValue > 1.3 or Chi2 > 50
not Gene like '%Rp%'

Usage Tips

  • Text Quotes: Text values must be enclosed in single quotes: Gene = 'GAD1' ✓ — Gene = GAD1 ✗.
  • No Quotes for Numbers: Numbers should not be quoted: pValue > 1.3 ✓ — pValue > '1.3' ✗.
  • Syntax Validation: A red warning icon will appear in the search bar if your expression has a syntax error. Hover over it to view details.
  • Additive Filtering: Standard filters (dropdowns) and the Code Filter are additive (ANDed together).

Related Pages

Concepts

Manual Pages