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

Single-cell / Spatial expression by group

Summarize mean gene or feature expression and the fraction of expressing cells or spots by group, and compare sample-level expressing fractions across groups.

Summarize mean gene or feature expression and the fraction of expressing cells or spots by group, and compare sample-level expressing fractions across groups.

Per-group expression dotplot

Description

Analysis summary

Summarises sparse expression per feature per group: the share of observations expressing the feature, and the mean expression among them — the canonical marker-expression view of single-cell or spatial data.

Computation

Observations are aggregated per (primary group, secondary group) combination — typically gene × cell type — into the fraction of observations whose presence signal is above zero (expressed) and the mean of the expression quantity over those expressing observations, along with the observation counts backing them. The same table doubles as the descriptive stats. Pairwise statistical comparisons of the expression value across the primary groups (within each secondary-group stratum when present) are computed automatically and returned with the results. Gene signatures collapse their member genes into per-observation averages before aggregation.

When to use

Use to compare the prevalence and mean level of one or many markers across cell types, conditions or spot groups on single-cell or spatial data. For overlap between exactly two features, use coexpression_analysis instead; for the distribution of expressed fractions across patients, use this analysis's per-sample mode.

Caveats

The expressed fraction is over all observations of the group; the mean expression is over the expressing observations only — a group can show a high mean with a low expressed fraction. Groups with very few observations give unstable estimates.

Example questions

example questions
  • Single-cell gene expression across multiple genes and groups

  • Single-cell gene expression across gene signatures and cell types

  • Single-cell gene expression across groups and cell types

  • Spatial transcriptomics gene expression across multiple genes and groups

  • Spatial transcriptomics single-gene expression across groups and tumor regions

Input columns

input columns
column
type
required
description

index

any

required

Observation identifier (e.g. cell_id). Documents the unit of observation; not used in aggregation.

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 (e.g. count_lognorm).

x_group

categorical

required

Primary grouping variable (e.g. gene_name for a gene × cell type view; clinical_var for a clinical-variable view).

y_group

categorical

optional

Secondary grouping variable (e.g. cell_type).

patient_id

categorical

required

Patient identifier required for population summary statistics.

Visualizations

  • dotplot How to read: One dot per (feature, group) pair: the dot's colour encodes the mean expression (colour bar) and its area the share of expressing observations (size legend, in %). Scanning a row compares features across one group's cell types; scanning a column compares cell types for one gene. Big pale dots mean 'expressed in many cells but weakly'; small bright ones the reverse. The accompanying statistical table reports the pairwise expression comparisons between groups.

Example analysis 1

Name — Single Cell Expression of ERBB2, TP53 and ROR1 in Immune Cells (MOSAIC Bladder, Age > 40)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — dotplot

Single Cell Expression of ERBB2, TP53 and ROR1 in Immune Cells (MOSAIC Bladder, Age > 40)

Output table

descriptive_stats (first 10 of 21 rows)
x_group
y_group
percentage_expressed
mean_value
n
n_zeros
n_non_zeros

ERBB2

Plasma

0.03281

0.1695

3962

3832

130

ERBB2

DC

0.04876

0.2925

1251

1190

61

ROR1

Granulocyte

0.00463

0.03206

432

430

2

ROR1

B_cell

0.01003

0.06818

1596

1580

16

ERBB2

Granulocyte

0.06019

0.4099

432

406

26

ERBB2

MoMac

0.02933

0.1755

8150

7911

239

TP53

Plasma

0.05628

0.3045

3962

3739

223

ROR1

Plasma

0.005048

0.02755

3962

3942

20

ROR1

T_NK

0.002843

0.0188

8091

8068

23

TP53

B_cell

0.1065

0.7293

1596

1426

170

statistical_tests (first 10 of 63 rows)
Test used for pairwise comparison
Group
Contrast
Statistic
Mean Difference
Higher Group
P-value
Adjusted P-value
Significance level
comparison_a
comparison_b

wilcoxon

TP53

(DC, Plasma)

2718000.0

0.6217

DC

1.562e-28

9.844e-27

★★★★

DC

Plasma

wilcoxon

ROR1

(DC, T NK)

5172000.0

0.1298

DC

1.908e-21

6.011e-20

★★★★

DC

T_NK

wilcoxon

TP53

(DC, T NK)

5433000.0

0.4437

DC

9.564e-19

2.009e-17

★★★★

DC

T_NK

wilcoxon

TP53

(DC, MoMac)

5431000.0

0.4124

DC

1.66e-13

2.615e-12

★★★★

DC

MoMac

wilcoxon

TP53

(DC, Mast)

483200.0

0.6681

DC

2.541e-13

3.202e-12

★★★★

DC

Mast

wilcoxon

TP53

(B cell, Plasma)

3334000.0

0.4249

B cell

6.906e-13

7.251e-12

★★★★

B_cell

Plasma

wilcoxon

ROR1

(DC, MoMac)

5195000.0

0.1146

DC

2.825e-12

2.542e-11

★★★★

DC

MoMac

wilcoxon

ROR1

(DC, Plasma)

2527000.0

0.1211

DC

5.837e-10

4.201e-09

★★★★

DC

Plasma

wilcoxon

TP53

(DC, Granulocyte)

300600.0

0.6993

DC

6.002e-10

4.201e-09

★★★★

DC

Granulocyte

wilcoxon

TP53

(MoMac, Plasma)

16630000.0

0.2093

MoMac

3.438e-09

2.166e-08

★★★★

MoMac

Plasma

Per-sample expressed fractions (violin)

Description

Analysis summary

Computes the share of observations expressing a feature within each sample, then compares how those per-sample fractions vary across groups — preserving the sample-to-sample spread instead of collapsing it.

Computation

For each (sample, primary group, secondary group) combination, the fraction of observations whose presence signal is above zero is computed, alongside the mean expression among the expressing observations of that sample. The distribution of these per-sample fractions is then compared across the primary groups. Group-level descriptive stats summarise both dimensions (mean, standard deviation, median, maximum of the per-sample fractions and of the mean expressions). Pairwise statistical comparisons of the per-sample fractions across the secondary groups (within each primary-group stratum when present) are computed automatically and returned with the results. Requires a sample identifier column.

When to use

Use to compare the prevalence of a marker between cohorts while keeping the patient-to-patient variability visible. When the group-level summary without the per-sample spread is enough — e.g. the canonical marker view — use this analysis's per-group mode instead.

Caveats

Samples with very few observations give noisy per-sample fractions, which dominate the distribution's tails.

Example questions

example questions
  • Per-sample fraction of single cells expressing a gene by group

Input columns

input columns
column
type
required
description

index

any

required

Observation identifier (e.g. cell_id). Documents the unit of observation; not used in aggregation.

value_sparsity

numeric

required

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

x_group

categorical

required

Primary grouping variable (e.g. gene_name for a gene × cell type view; clinical_var for a clinical-variable view).

y_group

categorical

optional

Secondary grouping variable (e.g. cell_type).

sample_id

any

required

Sample identifier — cells are aggregated per sample to compute the per-sample expressed fraction. Required in the per-sample mode.

patient_id

categorical

required

Patient identifier required for population summary statistics.

Visualizations

  • violin How to read: Each violin is one primary group: its width shows where that group's per-sample expressed fractions concentrate, the embedded box marks the median and the middle half, and the dots are the individual samples. The y-axis is the expressed fraction, in percent. When the data is stratified by a secondary group, a dropdown (or side-by-side violins, engine permitting) switches between the strata; dots are coloured by the sample's mean expression. The accompanying statistical table reports the pairwise fraction comparisons between groups.

Example analysis 1

Name — CD8A Fraction Expressing per Sample by Lymphocyte Density in Tumor (MOSAIC Bladder)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — violin

CD8A Fraction Expressing per Sample by Lymphocyte Density in Tumor (MOSAIC Bladder)

Output table

descriptive_stats (first 10 of 39 rows)
x_group
y_group
mean_percentage_expressed
std_percentage_expressed
p50_percentage_expressed
max_percentage_expressed
mean_value
std_value
min_value
p25_value
p50_value
p75_value
max_value

High

B_cell

2.554

1.427

2.505

4.0

6.721

0.2401

6.478

6.498

6.723

6.872

7.036

High

DC

2.318

1.789

2.469

4.762

5.819

0.6574

4.841

6.028

6.188

6.188

6.219

High

Endothelial

0.9737

0.7809

0.6135

2.299

6.239

0.4824

5.439

6.261

6.372

6.38

6.742

High

Epithelial_other

0.7539

0.6537

1.099

1.163

5.173

1.053

4.428

4.428

5.917

5.917

5.917

High

Fibroblast

0.7661

0.6183

0.8397

1.688

5.372

0.4714

4.978

5.053

5.054

5.879

5.895

High

Granulocyte

0.7143

1.597

0.0

3.571

7.18

7.18

7.18

7.18

7.18

7.18

High

Malignant

1.649

2.023

0.916

5.239

5.195

0.139

5.053

5.081

5.161

5.316

5.363

High

Mast

2.272

3.173

1.538

7.692

6.885

0.1905

6.665

6.98

6.98

7.009

7.009

High

MoMac

0.9108

0.7592

0.6859

2.085

6.005

0.6001

5.06

5.994

6.079

6.172

6.722

High

Muscle

0.757

0.4238

0.5155

1.316

5.822

0.8491

4.593

5.329

6.129

6.402

6.659

statistical_tests (first 10 of 39 rows)
Test used for pairwise comparison
Group
Contrast
Statistic
Mean Difference
Higher Group
P-value
Adjusted P-value
Significance level
comparison_a
comparison_b

wilcoxon

B cell

(High, Low)

25.0

2.554

High

0.007495

0.2923

High

Low

wilcoxon

Muscle

(High, Low)

24.0

0.4837

High

0.01587

0.3095

High

Low

wilcoxon

Malignant

(High, Low)

22.0

1.295

High

0.05556

0.468

High

Low

wilcoxon

Muscle

(High, Medium)

22.0

0.4938

High

0.05933

0.468

High

Medium

wilcoxon

B cell

(High, Medium)

18.0

2.014

High

0.06169

0.468

High

Medium

wilcoxon

Mast

(High, Low)

20.0

2.272

High

0.07201

0.468

High

Low

wilcoxon

Mast

(High, Medium)

16.0

2.272

High

0.1094

0.5346

High

Medium

wilcoxon

Plasma

(High, Medium)

20.0

1.134

High

0.1388

0.5346

High

Medium

wilcoxon

Fibroblast

(High, Medium)

20.0

0.4961

High

0.1425

0.5346

High

Medium

wilcoxon

Malignant

(High, Medium)

20.0

1.253

High

0.1508

0.5346

High

Medium

Last updated

Was this helpful?