For the complete documentation index, see llms.txt. This page is also available as Markdown.

Gene co-expression overlap

Quantify expression overlap between two genes or signatures, including the fractions of cells expressing either or both and their Jaccard similarity.

Quantify expression overlap between two genes or signatures, including the fractions of cells expressing either or both and their Jaccard similarity.

Two-feature Jaccard / co-expression overlap

Description

Analysis summary

Quantifies how two features — genes or signatures — overlap across cells or spots: what fraction of observations express only the first, only the second, or both, summarised by a Jaccard index per group.

Computation

For each group, every observation is classified by which of the two features it expresses (a feature is expressed when its presence signal is greater than zero after aggregation; with signatures, a feature's score is the mean of its member genes' signals), giving the percentage of observations expressing only feature A, only feature B, or both — the percentages are calculated over all observations in the group, so the three categories sum to 100% only when every observation expresses at least one feature. Alongside each category's percentage, the mean expression of the observations in it is computed. The Jaccard index — the number of co-expressing observations divided by the number expressing at least one feature — summarises the overlap; it is computed once per group and reported alongside it. A Fisher exact test of the two features' association within each group is computed automatically, with its odds ratio and 95% confidence interval.

When to use

Use this analysis ONLY when the goal is to quantify the overlap between exactly two features — overlap fractions, the Jaccard index, the co-occurrence association. For standard expression summaries of many genes across cell types, use sparse_aggregation_analysis instead.

Caveats

Two features only: no more, no fewer. Mean expression is the mean over all observations in the category, expressing or not. With the spatial neighbourhood option, 'expressing' means the observation itself or any of its nearest neighbours express the feature, while mean expression still reflects the observation itself — the two dimensions are then not strictly comparable.

Example questions

example questions
  • Single-cell co-expression of two genes or signatures across cell types

  • Spatial co-expression of two genes or signatures across spot groups

Input columns

input columns
column
type
required
description

index

any

required

Observation identifier (e.g. cell_id, spot_id). Unit of co-expression measurement.

value_sparsity

numeric

required

Threshold column — value_sparsity > 0 means the feature is expressed/present (e.g. count_raw).

value

numeric

required

Quantity to average for mean expression (e.g. count_lognorm).

x_group

categorical

required

Feature label column. Must contain the gene names belonging to features[0].members and features[1].members. The analysis aggregates member genes into per-featu…

y_group

categorical

optional

Grouping variable across which co-expression is compared (e.g. cell_type, spot_group).

x_coord

numeric

optional

X spatial coordinate. Required when use_neighbors=True.

y_coord

numeric

optional

Y spatial coordinate. Required when use_neighbors=True.

sample_id

categorical

optional

Sample identifier used to constrain neighbour search within samples. Required when use_neighbors=True.

patient_id

categorical

required

Patient identifier required for population summary statistics.

Visualizations

  • dotplot How to read: One row per group (e.g. cell type); the x-axis always holds the three categories — feature A only, feature B only, and both — so dot positions are comparable across any pair of features. Each dot's area is the share of that group's observations falling in the category (size legend in %), and its colour is the category's mean expression (colour bar). The co-expressing dot's hover adds the group's Jaccard index. A Fisher's exact test of the two features' association within each group is reported in the accompanying statistical table.

Example analysis 1

Name — ERBB2 vs TP53 Co-expression in Immune Cells (MOSAIC Bladder)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — dotplot

ERBB2 vs TP53 Co-expression in Immune Cells (MOSAIC Bladder)

Output table

descriptive_stats (first 10 of 21 rows)
y_group
pct_express
mean_expression
category
jaccard_index
_pct_fraction

T_NK

2.076

6.621

ERBB2 only

0.02076

Granulocyte

5.324

6.955

ERBB2 only

0.05324

MoMac

2.638

6.054

ERBB2 only

0.02638

Plasma

2.852

5.191

ERBB2 only

0.02852

B_cell

2.318

6.718

ERBB2 only

0.02318

DC

3.757

6.129

ERBB2 only

0.03757

Mast

2.009

6.598

ERBB2 only

0.02009

T_NK

6.909

6.821

TP53 only

0.06909

Granulocyte

2.778

6.705

TP53 only

0.02778

MoMac

8.196

6.058

TP53 only

0.08196

statistical_tests (7 rows)
Test
Contrast
y_group
fisher_p_value
odds_ratio
odds_ratio_ci_low
odds_ratio_ci_high
Significance level

Fisher's exact test

ERBB2 vs TP53

T_NK

0.7691

1.096

0.5824

1.907

Fisher's exact test

ERBB2 vs TP53

DC

0.09455

1.75

0.8704

3.319

Fisher's exact test

ERBB2 vs TP53

Granulocyte

0.05434

4.257

0.7214

17.38

Fisher's exact test

ERBB2 vs TP53

Mast

0.4505

1.8

0.04106

12.73

Fisher's exact test

ERBB2 vs TP53

B_cell

0.2224

1.612

0.5964

3.741

Fisher's exact test

ERBB2 vs TP53

Plasma

0.00131

2.647

1.461

4.534

★★

Fisher's exact test

ERBB2 vs TP53

MoMac

0.4083

1.21

0.7531

1.866

Last updated

Was this helpful?