Skip to content

Add cell-type alignment scoring for component projections (#515) - #517

Merged
aarmey merged 1 commit into
mainfrom
issue-515-cell-type-alignment
Aug 28, 2026
Merged

aarmey merged 1 commit into
mainfrom
issue-515-cell-type-alignment

Conversation

@aarmey

@aarmey aarmey commented Aug 27, 2026

Copy link
Copy Markdown
Member

Closes #515

Summary of Changes

  • Implemented cell_type_alignment and score_cell_type_alignment in RISE/annotation_alignment.py:
    • Per-cell-type AUROC enrichment: Computes the one-vs-all AUROC distinguishing each annotated cell type from all others, using $|loading|$ when signed=True (e.g. for eigen-state projections).
    • Significance via Permutation & BH FDR: Generates empirical permutation null distributions for AUROC and computes joint Benjamini-Hochberg FDR-corrected $q$-values across all (component $\times$ cell type) tests.
    • Uniqueness score ($\tau$): Computes the tissue-specificity index $\tau = \sum (1 - \hat{x}) / (n_{\text{types}} - 1)$ over the enrichment vector. $\tau \to 1$ indicates private concentration in a single cell type; $\tau \to 0$ indicates broad distribution.
    • Combination score ($\eta^2$, $\epsilon^2$): Computes omnibus $\eta^2$ (loading variance explained by cell type) and non-parametric Kruskal-Wallis $\epsilon^2$, and identifies the specific subset of cell types with significant enrichment ($q \le \alpha, \text{AUROC} > 0.5$).
    • Container dataclasses: ComponentAlignmentResult and CellTypeAlignmentResults with convenient summary conversion.
  • Implemented plot_cell_type_alignment in RISE/plotting/annotation_alignment.py:
    • Visualizes per-component AUROC heatmaps with optional significance annotations (*) and row annotations for $\tau$ and $\eta^2$.
    • Exported in RISE/__init__.py and RISE/plotting/__init__.py.
  • Added comprehensive unit tests in RISE/tests/test_annotation_alignment.py covering synthetic single-type specific, two-type specific, noise components, signed projections, asymptotic Mann-Whitney, plotting options, and error handling.

@aarmey
aarmey merged commit 34c5416 into main Aug 28, 2026
2 checks passed
@aarmey
aarmey deleted the issue-515-cell-type-alignment branch August 28, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cell-type alignment scoring for component eigen-states/projections

1 participant