Emergene: differential analysis at the level of the cell
Emergene is a separate package with its own repository. It is described here because it sits directly downstream of a PIASO analysis — it takes the embedding and the normalized layer you already have — and because the question it answers is one that cluster-level differential expression cannot.
- Repository: https://github.com/genecell/Emergene
The problem with a cluster-level answer
Standard differential expression compares a condition against a control within a cluster, and returns one fold change per gene. That answer assumes the cells in the cluster responded the same way. Often they did not: a perturbation hits a subset, a treatment produces responders and non-responders, a disease state appears in a fraction of an otherwise normal population. Averaged across the cluster, a strong response in 20% of cells and none in the rest looks like a weak response everywhere — and the two are not the same finding.
Emergene scores the condition signature per cell. Each cell gets a value for how much it looks like the perturbed state, so a bimodal response stays bimodal in the output instead of collapsing to its mean.
How it composes with PIASO
Emergene consumes what an embedding step has already produced:
import emergene as eg
result = eg.tl.runEMERGENE(adata, use_rep="X_gdr", layer="infog", ...)use_rep="X_gdr" is the point of the pairing. Cells are matched to comparable
cells across conditions in an embedding, and GDR gives an
embedding organised by marker-gene structure rather than by whatever dominates
the variance — which in a perturbation experiment is often the perturbation
itself. Matching in a space the treatment has already distorted is circular;
matching in a marker-guided space is less so.
layer="infog" keeps the normalization consistent with the rest of the
analysis. See the mouse brain end-to-end tutorial for
where both come from.
Two modes, two questions
- Per-condition — each condition against the control, separately. Cleaner signatures, because each comparison is one contrast.
- All-in-one — each condition against all the others, which asks what makes a condition distinct rather than what makes it different from baseline.
The per-condition mode also produces something the all-in-one mode does not: one gene-weight vector per condition, and those vectors are comparable. Cosine similarity between them relates conditions to each other — in a perturbation screen, that is a hierarchy of which perturbations produce similar transcriptional consequences, built from the data rather than from prior annotation.
Full usage, parameters and examples are in the Emergene repository.