Skip to content

Store neighbours as an obsp graph instead of strings - #370

Merged
newmana merged 8 commits into
masterfrom
newmana/cleanup_spot_neighbours
Nov 7, 2026
Merged

newmana merged 8 commits into
masterfrom
newmana/cleanup_spot_neighbours

Conversation

@newmana

@newmana newmana commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Backwards compatible speedup/memory reduction improvement.

Changes:

  • run stores the neighbours as a graph, adata.obsp["spot_neighbours"] (int8 CSR, row i’s indices spot i’s neighbours)
  • Per spot (obsm["spot_neighbours"] and obsm["spot_neigh_bcs"]) are removed. These consume ~25% of the runtime and large amount of memory.
  • get_neighbourhoods reads obsp first and falls back to obsm strings written previously.
  • score_spots finds each chunk’s rows with a boolean mask and position lookup instead of using np.unique.
  • The neighbour graph is built once and passed through get_lrs_scores and perform_spot_testing; LRScorer accepts it directly (List | csr_matrix).

@newmana
newmana merged commit 6252639 into master Nov 7, 2026
3 checks passed
@newmana
newmana deleted the newmana/cleanup_spot_neighbours branch November 7, 2026 12:43
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.

1 participant