From 5976f55ae50905feac9a9d80f413622e8f77f389 Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 16:25:12 +1000 Subject: [PATCH 1/7] Initial attempt. --- stlearn/tl/cci/analysis.py | 14 +- stlearn/tl/cci/permutation.py | 43 +++- tests/tl/test_permutation.py | 268 ++++---------------- tests/tl/test_permutation_gridded_sparse.py | 237 +++++++++++++++++ tests/tl/test_permutation_run_null.py | 30 +++ 5 files changed, 368 insertions(+), 224 deletions(-) create mode 100644 tests/tl/test_permutation_gridded_sparse.py create mode 100644 tests/tl/test_permutation_run_null.py diff --git a/stlearn/tl/cci/analysis.py b/stlearn/tl/cci/analysis.py index 3a619915..198ffaf4 100644 --- a/stlearn/tl/cci/analysis.py +++ b/stlearn/tl/cci/analysis.py @@ -31,7 +31,7 @@ ) from .ligand_receptors import LRPairs, genes_of, lr_pairs, split_name from .neighbours import calc_distance, calc_neighbours, stored_neighbours -from .permutation import perform_spot_testing +from .permutation import Null, perform_spot_testing from .scoring import get_lrs_scores @@ -91,6 +91,7 @@ def run( random_state: int = 0, verbose: bool = True, cell_prop_cutoff: float = 0.2, + null: Null = "codetected", ) -> anndata.AnnData: """Performs stLearn LR analysis. @@ -140,6 +141,14 @@ def run( cell_prop_cutoff: float With use_label, a cell type is in a spot when its proportion is above this, as in run_cci. + null: str + Which of an LR's random gene pairs a spot's score is tested against. + "codetected" (default): those that score above 0 at the spot, detected + there as the LR is, so p = (n_greater + 1) / (n_codetected + 1); for + sparse data (single cells, Visium HD bins) without gridding. "random": + all n_pairs of them, the original test, p = max(n_greater, 1) / n_pairs, + where the pairs not detected at a spot score 0 and make any score there + significant. Not used with neg_binom. Returns ------- AnnData @@ -280,6 +289,7 @@ def run( save_bg=save_bg, neg_binom=neg_binom, random_state=random_state, + null=null, ) features = tests.lr_features.loc[tested.names()] var = pandas.DataFrame( @@ -691,4 +701,4 @@ def expressed(gene: str) -> numpy.typing.NDArray[np.bool_]: print( "Significant cell type interaction counts for each LR pair stored in " f"the LR table's uns['per_lr_cci_{use_label}']", - ) + ) \ No newline at end of file diff --git a/stlearn/tl/cci/permutation.py b/stlearn/tl/cci/permutation.py index 56a8789d..198d764b 100644 --- a/stlearn/tl/cci/permutation.py +++ b/stlearn/tl/cci/permutation.py @@ -3,6 +3,7 @@ from dataclasses import dataclass from functools import partial +from typing import Literal, get_args import numpy as np import numpy.typing as npt @@ -19,6 +20,10 @@ from .perm_utils import _column_quantiles, background_pairs, get_lr_features from .scoring import LRScorer, spots_per_chunk +Null = Literal["codetected", "random"] +"""What a spot's score is compared with: its random pairs that scored there too +("codetected"), or all of them, the zeros included ("random").""" + @dataclass class SpotTests: @@ -59,6 +64,7 @@ def perform_spot_testing( 1, ), random_state: int = 0, + null: Null = "codetected", ) -> SpotTests: """Tests each spot's LR scores against random gene pairs with similar expression to the LR pair; backgrounds are only generated for spots @@ -67,8 +73,16 @@ def perform_spot_testing( for each of `lrs`, in the order of lrs.names(), as get_lrs_scores gives them. The p-values come back sparse, an entry for each. + `null` is which of a spot's n_pairs random pairs its score is compared with + (see empirical_pvals): + + The backgrounds saved with save_bg, and the negative binomial fitted with + neg_binom, are of every random pair under either. + Returns lr_features in expression-rank order. """ + if null not in get_args(Null): + raise ValueError(f"null must be one of {get_args(Null)}; got {null!r}.") quantiles = np.array(quantiles) scores = scored_entries(lr_scores) names, ligands, receptors = lrs.names(), lrs.ligands(), lrs.receptors() @@ -153,10 +167,8 @@ def perform_spot_testing( chunk = spots_per_chunk(2 * n_genes, n_pairs) for a in range(0, len(spot_indices), chunk): background = score(spot_indices[a : a + chunk]) - n_greater = (background >= lr_j_scores[a : a + chunk, None]).sum(1) - n_greater = np.maximum(n_greater, 1) # pseudocount pvals.data[start + a : start + a + len(background)] = ( - n_greater / n_pairs + empirical_pvals(lr_j_scores[a : a + chunk], background, null) ) # Collect memory before the next chunk is made del background @@ -186,6 +198,29 @@ def perform_spot_testing( return SpotTests(pvals, lr_feats, backgrounds, bg_spot_indices) +def empirical_pvals( + scores: npt.NDArray[np.float64], + background: npt.NDArray[np.float64], + null: Null = "codetected", +) -> npt.NDArray[np.float64]: + """A p-value for each spot's score (all above 0) from its row of background: + the scores of the LR's random pairs at the spot. + + "random" is a null using any random pairs, where there must be at least one and + they must be scored to be at least the spot's own score. + + "codetected" is a null using pairs that score above 0 and where one gene is + expressed at the spot and the other in its neighbours. Formulae is: + (n_greater + 1) / (n_codetected + 1) + """ + n_greater = (background >= scores[:, None]).sum(1) + if null == "random": + return np.maximum(n_greater, 1) / background.shape[1] + else: + n_codetected = (background > 0).sum(1) + return (n_greater + 1) / (n_codetected + 1) + + def score_background( scorer: LRScorer, pairs: npt.NDArray[np.int64], @@ -272,4 +307,4 @@ def get_stats( pvals_adj = multipletests(pvals, method=adj_method)[1] log10_pvals_adj = -np.log10(pvals_adj) lr_sign = scores * (pvals_adj < pval_adj_cutoff) - return pvals, pvals_adj, log10_pvals_adj, lr_sign + return pvals, pvals_adj, log10_pvals_adj, lr_sign \ No newline at end of file diff --git a/tests/tl/test_permutation.py b/tests/tl/test_permutation.py index 33762023..f3fe7152 100644 --- a/tests/tl/test_permutation.py +++ b/tests/tl/test_permutation.py @@ -1,239 +1,71 @@ #!/usr/bin/env python -"""Tests for perform_spot_testing: per-spot p-values against each LR's background.""" +"""Tests for empirical_pvals: the p-value of a spot's score from its row of +background scores, under each null. perform_spot_testing is tested in +test_permutation_gridded_sparse.py, st.tl.cci.run's null in +test_permutation_run_null.py.""" import unittest import numpy as np -import pandas as pd -import scipy.sparse -from anndata import AnnData -from stlearn.tl.cci._results import to_dense -from stlearn.tl.cci.ligand_receptors import LRPairs -from stlearn.tl.cci.neighbours import calc_neighbours -from stlearn.tl.cci.permutation import gene_quantiles, perform_spot_testing -from stlearn.tl.cci.scoring import get_lrs_scores - -LRS = LRPairs.from_names(["Lig0_Rec0", "Lig1_Rec1", "Lig2_Rec2"], species="human") -N_PAIRS = 100 - - -def _make_adata(n_side=10, n_extra_genes=60, seed=0): - """Sparse counts on a grid. Lig0 and Rec0 are high together in one corner, so - some spots are significant; zeros elsewhere leave some spots unscored.""" - rng = np.random.default_rng(seed) - n_spots = n_side * n_side - lr_genes = ["Lig0", "Rec0", "Lig1", "Rec1", "Lig2", "Rec2"] - var_names = lr_genes + [f"gene{i}" for i in range(n_extra_genes)] - - X = rng.poisson(0.3, size=(n_spots, len(var_names))).astype(np.float32) - rows, cols = np.divmod(np.arange(n_spots), n_side) - corner = (rows < 4) & (cols < 4) - X[corner, :2] = 6 - - obs = pd.DataFrame( - {"imagerow": rows.astype(float), "imagecol": cols.astype(float)}, - index=[f"spot{i}" for i in range(n_spots)], - ) - var = pd.DataFrame(index=var_names) - return AnnData(X=scipy.sparse.csr_matrix(X), obs=obs, var=var) +from stlearn.tl.cci.permutation import empirical_pvals class TestPermutation(unittest.TestCase): - @classmethod - def setUpClass(cls): - cls.adata = _make_adata() - neighbours = calc_neighbours(cls.adata, distance=1.5, verbose=False) - het_vals = np.ones(len(cls.adata)) - # Columns of scores, and of everything perform_spot_testing returns, - # follow the scored pairs get_lrs_scores gives: their names() order. - cls.scores, cls.lrs = get_lrs_scores(cls.adata, LRS, neighbours, het_vals, 0) - cls.results = perform_spot_testing( - cls.adata, - cls.scores, - cls.lrs, - N_PAIRS, - neighbours, - het_vals, - 0, - verbose=False, - save_bg=True, + """The p-value of a spot's score from its row of background scores.""" + + def setUp(self): + self.scores = np.array([3.0, 3.0, 3.0, 3.0]) + self.background = np.array( + [ + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # no random pair detected + [0, 0, 0, 0, 0, 0, 0, 0, 1, 2], # two detected, both below + [0, 0, 0, 0, 0, 0, 1, 2, 3, 4], # four detected, two at or above + [1, 1, 2, 2, 2, 2, 2, 3, 8, 9], # all detected, three above + ], + dtype=float, ) - def test_pvals_from_background(self): - """A scored spot's p-value is the share of its background scores at or - above its own score, at least 1 / n_pairs. Unscored spots keep 1: they - are not in the sparse p-values, whose entries are the scored spots.""" - sparse_pvals = self.results.pvals - self.assertTrue(scipy.sparse.issparse(sparse_pvals)) - self.assertEqual(sparse_pvals.shape, self.scores.shape) - np.testing.assert_array_equal(sparse_pvals.toarray() != 0, self.scores > 0) - pvals = to_dense(sparse_pvals, 1.0) - for j, lr in enumerate(self.lrs.names()): - background = self.results.backgrounds[lr] - spots = self.results.bg_spot_indices[lr] - np.testing.assert_array_equal(spots, np.flatnonzero(self.scores[:, j] > 0)) - self.assertTrue(0 < len(spots) < len(self.adata), msg=lr) - self.assertEqual(background.shape, (len(spots), N_PAIRS), msg=lr) - - for spot_i, spot in enumerate(spots): - n_greater = np.count_nonzero(background[spot_i] >= self.scores[spot, j]) - expected = max(n_greater, 1) / N_PAIRS - self.assertEqual(pvals[spot, j], expected, msg=f"{lr} {spot}") - - unscored = np.setdiff1d(np.arange(len(self.adata)), spots) - np.testing.assert_array_equal(pvals[unscored, j], 1) - - def test_some_spots_significant(self): - """The co-expressed corner gives Lig0_Rec0 p-values at the floor.""" - j = list(self.lrs.names()).index("Lig0_Rec0") - self.assertEqual(to_dense(self.results.pvals, 1.0)[:, j].min(), 1 / N_PAIRS) - - def test_lr_features_cover_every_lr(self): - self.assertCountEqual(self.results.lr_features.index, self.lrs.names()) - - def test_leaves_adata_alone(self): - """Results are returned; st.tl.cci.run is what stores them.""" - for key in ("lr_summary", "lrfeatures", "lrs_to_bg", "lr_spot_indices"): - self.assertNotIn(key, self.adata.uns) - self.assertNotIn("p_vals", self.adata.obsm) - - def test_no_backgrounds_unless_asked(self): - adata = _make_adata() - neighbours = calc_neighbours(adata, distance=1.5, verbose=False) - het_vals = np.ones(len(adata)) - scores, lrs = get_lrs_scores(adata, LRS, neighbours, het_vals, 0) - results = perform_spot_testing( - adata, - scores, - lrs, - N_PAIRS, - neighbours, - het_vals, - 0, - verbose=False, - ) - self.assertIsNone(results.backgrounds) - self.assertIsNone(results.bg_spot_indices) + def test_random_counts_every_pair(self): + """The share of all the random pairs at or above the score, or at least + one of them divided by the number of pairs.""" np.testing.assert_array_equal( - results.pvals.toarray(), - self.results.pvals.toarray(), + empirical_pvals(self.scores, self.background, "random"), + [ + # None detected or 1, 1 / 10 (shape of background column) + 0.1, + # None detected or 1, 1 / 10 (shape of background column) + 0.1, + # n > 3 = 2, 2 / 10 (shape of background column) + 0.2, + # n > 3 = 3, 3 / 10 (shape of background column) + 0.3 + ], ) - def test_sparse_scores_test_the_same(self): - """The sparse scores run passes in (the scores above 0) give the same - p-values as the dense scores, entry for entry.""" - adata = _make_adata() - neighbours = calc_neighbours(adata, distance=1.5, verbose=False) - het_vals = np.ones(len(adata)) - scores, lrs = get_lrs_scores( - adata, - LRS, - neighbours, - het_vals, - 0, - sparse_result=True, - ) - self.assertTrue(scipy.sparse.issparse(scores)) - results = perform_spot_testing( - adata, - scores, - lrs, - N_PAIRS, - neighbours, - het_vals, - 0, - verbose=False, - ) - np.testing.assert_array_equal(results.pvals.indptr, scores.indptr) - np.testing.assert_array_equal(results.pvals.indices, scores.indices) + def test_codetected_counts_detected_pairs(self): + """The share of all the codetected pairs at or above the score.""" np.testing.assert_array_equal( - results.pvals.toarray(), - self.results.pvals.toarray(), + empirical_pvals(self.scores, self.background, "codetected"), + [ + # None detected so 1/1 + 1, + # n > 3 = 0 + 1, 1 / 3 (non-zero = 2 + 1) + 1 / 3, + # n > 3 = 2 + 1, 3 / 5 (non-zero = 4 + 1) + 0.6, + # n > 3 = 3 + 1, 4 / 11 (non-zero = 10 + 1) + 4 / 11 + ], ) - def test_homophilic_lr_is_tested(self): - """A gene paired with itself gets a background like any LR: random pairs - of two different genes similar to it, so the random pairs never pair a - gene with itself (as before), but the LR itself is tested.""" - adata = _make_adata() - neighbours = calc_neighbours(adata, distance=1.5, verbose=False) - het_vals = np.ones(len(adata)) - lrs = LRPairs.from_names(["Lig0_Lig0"], species="human") - scores, lrs = get_lrs_scores( - adata, - lrs, - neighbours, - het_vals, - 0, - ) - self.assertEqual(list(lrs.names()), ["Lig0_Lig0"]) - - results = perform_spot_testing( - adata, - scores, - lrs, - N_PAIRS, - neighbours, - het_vals, - 0, - verbose=False, - save_bg=True, - ) - - spots = np.flatnonzero(scores[:, 0] > 0) - pvals = to_dense(results.pvals, 1.0) - self.assertEqual(results.backgrounds["Lig0_Lig0"].shape, (len(spots), N_PAIRS)) - self.assertTrue((pvals[spots, 0] < 1).any()) - self.assertEqual(pvals[:, 0].min(), 1 / N_PAIRS) # the corner - - def test_unscored_lr_is_left_untested(self): - """An LR with no scored spot has nothing to test: its p-values stay 1, - its background is empty, and the other LRs are tested as before.""" - adata = _make_adata() - neighbours = calc_neighbours(adata, distance=1.5, verbose=False) - het_vals = np.ones(len(adata)) - scores, lrs = get_lrs_scores(adata, LRS, neighbours, het_vals, 0) - scores[:, 1] = 0 # as if Lig1_Rec1 never scored - results = perform_spot_testing( - adata, - scores, - lrs, - N_PAIRS, - neighbours, - het_vals, - 0, - verbose=False, - save_bg=True, - ) - pvals = to_dense(results.pvals, 1.0) - np.testing.assert_array_equal(pvals[:, 1], 1) - self.assertEqual(results.pvals[:, 1].nnz, 0) # no entries: nothing tested - unscored = lrs.names()[1] - self.assertEqual(results.backgrounds[unscored].shape, (0, N_PAIRS)) - self.assertEqual(results.bg_spot_indices[unscored].size, 0) + def test_codetected_is_the_default(self): np.testing.assert_array_equal( - pvals[:, [0, 2]], - to_dense(self.results.pvals, 1.0)[:, [0, 2]], + empirical_pvals(self.scores, self.background), + empirical_pvals(self.scores, self.background, "codetected"), ) - def test_matches_quantiles_per_gene(self): - """Quantiles computed in chunks equal np.quantile gene by gene, for chunk - sizes that split the genes unevenly, one at a time, or all at once.""" - adata = _make_adata() - genes = adata.var_names.to_numpy() - quantiles = np.array([0.5, 0.75, 0.9, 0.99, 1]) - expected = np.apply_along_axis( - np.quantile, - 0, - adata.X.toarray(), - q=quantiles, - method="nearest", - ) - for chunk_size in (1, 7, len(genes), 1000): - np.testing.assert_array_equal( - gene_quantiles(adata, genes, quantiles, chunk_size), - expected, - err_msg=f"{chunk_size=}", - ) + +if __name__ == "__main__": + unittest.main() diff --git a/tests/tl/test_permutation_gridded_sparse.py b/tests/tl/test_permutation_gridded_sparse.py new file mode 100644 index 00000000..fbf38e5c --- /dev/null +++ b/tests/tl/test_permutation_gridded_sparse.py @@ -0,0 +1,237 @@ +#!/usr/bin/env python + +"""Tests for perform_spot_testing: per-spot p-values against each LR's background, +under both nulls ("codetected", the default, and "random", the original), on a +gridded sample of well-covered spots and on sparse single cells without a grid.""" + +import unittest + +import numpy as np +import pandas as pd +import itertools +import scipy.sparse +from anndata import AnnData +from stlearn.tl.cci.ligand_receptors import LRPairs +from stlearn.tl.cci._results import to_dense +from stlearn.tl.cci.neighbours import calc_neighbours +from stlearn.tl.cci.permutation import ( + empirical_pvals, + perform_spot_testing, + gene_quantiles, +) +from stlearn.tl.cci.scoring import get_lrs_scores + +# Lig0 and Rec0 are high together in a patch; the other two pairs are noise. +LRS = LRPairs.from_names(["Lig0_Rec0", "Lig1_Rec1", "Lig2_Rec2"], species="human") +LR_GENES = ["Lig0", "Rec0", "Lig1", "Rec1", "Lig2", "Rec2"] +NULLS = ("codetected", "random") + + +def _test(adata, distance, n_pairs, lrs=LRS, sparse_result=False, **kwargs): + """Scores `lrs` and tests them; kwargs go to perform_spot_testing.""" + neighbours = calc_neighbours(adata, distance=distance, verbose=False) + het_vals = np.ones(len(adata)) + scores, lrs = get_lrs_scores( + adata, lrs, neighbours, het_vals, 0, sparse_result=sparse_result + ) + if "zero_lr" in kwargs: # as if this LR never scored + scores[:, kwargs.pop("zero_lr")] = 0 + results = perform_spot_testing( + adata, scores, lrs, n_pairs, neighbours, het_vals, 0, verbose=False, **kwargs + ) + return scores, lrs, results + + +def _adata(X, rows, cols, n_extra_genes): + var_names = LR_GENES + [f"gene{i}" for i in range(n_extra_genes)] + obs = pd.DataFrame( + {"imagerow": np.asarray(rows, float), "imagecol": np.asarray(cols, float)}, + index=[f"spot{i}" for i in range(len(X))], + ) + X = scipy.sparse.csr_matrix(X.astype(np.float32)) + return AnnData(X=X, obs=obs, var=pd.DataFrame(index=var_names)) + + +def _gridded_adata(n_side=10, n_extra_genes=60, seed=0): + """Spots on a grid, each covering many cells, as Visium or gridded data: most + genes are detected at most spots, so most random pairs score at a spot. Lig0 + and Rec0 are high together in one corner, so some spots are significant; the + opposite corner has no LR gene, which leaves its spots unscored.""" + rng = np.random.default_rng(seed) + n_spots = n_side * n_side + X = rng.poisson(2.0, size=(n_spots, len(LR_GENES) + n_extra_genes)) + rows, cols = np.divmod(np.arange(n_spots), n_side) + X[(rows < 4) & (cols < 4), :2] = 12 + X[(rows >= 8) & (cols >= 8), : len(LR_GENES)] = 0 + return _adata(X, rows, cols, n_extra_genes) + + +def _sparse_cells_adata(n_cells=900, n_extra_genes=150, seed=0): + """Single cells scattered at one per unit area, as Xenium or Visium HD bins + without gridding: a gene is detected in about a cell in ten, so few random + pairs score at a cell. Lig0 and Rec0 are high together in the cells of one + corner; the other LR genes are as sparse as the rest.""" + rng = np.random.default_rng(seed) + side = np.sqrt(n_cells) + rows, cols = rng.uniform(0, side, size=(2, n_cells)) + X = rng.poisson(0.1, size=(n_cells, len(LR_GENES) + n_extra_genes)) + patch = (rows < side * 0.3) & (cols < side * 0.3) + X[patch, :2] = rng.poisson(4.0, size=(patch.sum(), 2)) + return _adata(X, rows, cols, n_extra_genes) + + +class Sample: + """A sample tested under each null, with its backgrounds saved.""" + + def __init__(self, adata: AnnData, distance: float, n_pairs: int): + self.adata = adata + self.n_pairs = n_pairs + # Columns of scores, and of everything perform_spot_testing returns, + # follow the scored pairs get_lrs_scores gives: their names() order. + self.results = {} + for null in NULLS: + self.scores, self.lrs, self.results[null] = _test( + adata, distance, n_pairs, save_bg=True, null=null + ) + self.pvals = {null: to_dense(r.pvals, 1.0) for null, r in self.results.items()} + self.tested = self.scores > 0 + + def column(self, lr: str) -> int: + return list(self.lrs.names()).index(lr) + + def codetected_share(self) -> np.ndarray: + """Per tested spot and LR, the share of its random pairs scoring above 0.""" + backgrounds = self.results["random"].backgrounds + return np.concatenate([(bg > 0).mean(1) for bg in backgrounds.values()]) + + def called(self, null: str, lr: str) -> float: + """The share of an LR's tested spots with p < 0.05.""" + j = self.column(lr) + return (self.pvals[null][self.tested[:, j], j] < 0.05).mean() + + +class TestGriddedAndSparse(unittest.TestCase): + """Both nulls on two samples. Gridded: well-covered spots, where nearly every + random pair is detected at a spot, so the nulls are nearly the same test. + Sparse: single cells without a grid, where few are, so the nulls part.""" + + @classmethod + def setUpClass(cls): + # distance: the 8 surrounding spots; about 6 neighbouring cells. + cls.gridded = Sample(_gridded_adata(), distance=1.5, n_pairs=100) + cls.sparse = Sample(_sparse_cells_adata(), distance=1.4, n_pairs=1000) + cls.samples = {"gridded": cls.gridded, "sparse": cls.sparse} + + # On both samples + + def test_pvals_from_background(self): + """Each scored spot gets a p-value from its own background, as + empirical_pvals counts it for the null. Unscored spots are left out of + the sparse p-values, so read as 1.""" + for (name, sample), null in itertools.product(self.samples.items(), NULLS): + results = sample.results[null] + with self.subTest(sample=name, null=null): + self.assertTrue(scipy.sparse.issparse(results.pvals)) + np.testing.assert_array_equal( + results.pvals.toarray() != 0, sample.tested + ) + for j, lr in enumerate(sample.lrs.names()): + with self.subTest(sample=name, null=null, lr=lr): + spots = results.bg_spot_indices[lr] + background = results.backgrounds[lr] + np.testing.assert_array_equal( + spots, np.flatnonzero(sample.tested[:, j]) + ) + self.assertTrue(0 < len(spots) < len(sample.adata)) # some unscored + self.assertEqual(background.shape, (len(spots), sample.n_pairs)) + np.testing.assert_array_equal( + sample.pvals[null][spots, j], + empirical_pvals(sample.scores[spots, j], background, null), + ) + + def test_nulls_share_the_background(self): + """The null chooses which background scores count, not the random pairs + or their scores.""" + for name, sample in self.samples.items(): + codetected, random = sample.results["codetected"], sample.results["random"] + for lr in sample.lrs.names(): + with self.subTest(sample=name, lr=lr): + np.testing.assert_array_equal( + codetected.backgrounds[lr], random.backgrounds[lr] + ) + np.testing.assert_array_equal( + codetected.bg_spot_indices[lr], random.bg_spot_indices[lr] + ) + + def test_co_expressed_patch_is_significant(self): + """Lig0 and Rec0, high together in a patch, are called under either + null; under "random" at its floor.""" + for name, sample in self.samples.items(): + with self.subTest(sample=name): + j = sample.column("Lig0_Rec0") + self.assertEqual(sample.pvals["random"][:, j].min(), 1 / sample.n_pairs) + self.assertLess(sample.pvals["codetected"][:, j].min(), 0.05) + + # Where the samples differ + + def test_share_of_random_pairs_codetected(self): + """Nearly every random pair is detected at a gridded spot; few are at a + sparse cell.""" + self.assertGreater(np.median(self.gridded.codetected_share()), 0.9) + self.assertLess(np.median(self.sparse.codetected_share()), 0.25) + + def test_nulls_agree_on_gridded_spots(self): + """With few zeros in the background the two nulls' p-values are close.""" + pvals = self.gridded.pvals + self.assertLess(np.abs(pvals["codetected"] - pvals["random"]).max(), 0.1) + + def test_unrelated_genes_are_called_at_chance(self): + """Lig1_Rec1 and Lig2_Rec2 are pairs of unrelated genes, so should be + called at about the 5% chance gives. "codetected" is, on either sample; + "random" only on gridded spots. At a sparse cell most random pairs score + 0, so against all of them any score above 0 is significant.""" + for lr in ("Lig1_Rec1", "Lig2_Rec2"): + with self.subTest(lr=lr): + self.assertLess(self.gridded.called("codetected", lr), 0.15) + self.assertLess(self.sparse.called("codetected", lr), 0.15) + self.assertLess(self.gridded.called("random", lr), 0.15) + self.assertGreater(self.sparse.called("random", lr), 0.3) + + def test_patch_is_called_more_than_the_rest(self): + """On sparse cells, under "codetected", the co-expressed patch is still + what Lig0_Rec0 is called in.""" + sample = self.sparse + j = sample.column("Lig0_Rec0") + obs = sample.adata.obs + side = np.sqrt(len(obs)) + patch = ((obs["imagerow"] < side * 0.3) & (obs["imagecol"] < side * 0.3)).values + tested = sample.tested[:, j] + significant = sample.pvals["codetected"][:, j] < 0.05 + self.assertGreater(significant[patch & tested].mean(), 0.5) + self.assertLess(significant[~patch & tested].mean(), 0.15) + + +class TestGeneQuantiles(unittest.TestCase): + def test_matches_quantiles_per_gene(self): + """Quantiles computed in chunks equal np.quantile gene by gene, for chunk + sizes that split the genes unevenly, one at a time, or all at once.""" + adata = _sparse_cells_adata(n_cells=100, n_extra_genes=60) + genes = adata.var_names.to_numpy() + quantiles = np.array([0.5, 0.75, 0.9, 0.99, 1]) + expected = np.apply_along_axis( + np.quantile, + 0, + adata.X.toarray(), + q=quantiles, + method="nearest", + ) + for chunk_size in (1, 7, len(genes), 1000): + np.testing.assert_array_equal( + gene_quantiles(adata, genes, quantiles, chunk_size), + expected, + err_msg=f"{chunk_size=}", + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/tl/test_permutation_run_null.py b/tests/tl/test_permutation_run_null.py new file mode 100644 index 00000000..525c0a67 --- /dev/null +++ b/tests/tl/test_permutation_run_null.py @@ -0,0 +1,30 @@ +import unittest + +import numpy as np +import stlearn as st +from stlearn.tl.cci.permutation import empirical_pvals +from tests.utils import cci_table, CCI_LRS + + +class TestRunNull(unittest.TestCase): + """st.tl.cci.run passes its `null` on, "codetected" by default.""" + + @staticmethod + def pvals(**kwargs): + settings = {"min_spots": 2, "distance": 1.5, "n_pairs": 100, "verbose": False} + lr = st.tl.cci.run(cci_table(), CCI_LRS, **settings, **kwargs) + lr = lr[:, CCI_LRS.names()] + return st.tl.cci.lr_result(lr, "p_vals"), lr + + def test_null_reaches_the_test(self): + default, _ = self.pvals() + codetected, _ = self.pvals(null="codetected") + random, lr = self.pvals(null="random", save_bg=True) + np.testing.assert_array_equal(default, codetected) + for null, pvals in (("random", random), ("codetected", codetected)): + for j, name in enumerate(CCI_LRS.names()): + spots = lr.uns["lr_spot_indices"][name] + scores = st.tl.cci.lr_result(lr, "lr_scores", name)[spots] + expected = empirical_pvals(scores, lr.uns["lrs_to_bg"][name], null) + np.testing.assert_array_equal(pvals[spots, j], expected, err_msg=null) + self.assertFalse(np.array_equal(random, codetected)) From 19b2a9745b43a3786935608ce01d42e94a7c6d11 Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 16:29:16 +1000 Subject: [PATCH 2/7] Move adata. --- tests/tl/test_permutation_gridded_sparse.py | 17 ++--------- tests/utils.py | 34 +++++++++++---------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/tests/tl/test_permutation_gridded_sparse.py b/tests/tl/test_permutation_gridded_sparse.py index fbf38e5c..7f723a46 100644 --- a/tests/tl/test_permutation_gridded_sparse.py +++ b/tests/tl/test_permutation_gridded_sparse.py @@ -7,9 +7,7 @@ import unittest import numpy as np -import pandas as pd import itertools -import scipy.sparse from anndata import AnnData from stlearn.tl.cci.ligand_receptors import LRPairs from stlearn.tl.cci._results import to_dense @@ -20,6 +18,7 @@ gene_quantiles, ) from stlearn.tl.cci.scoring import get_lrs_scores +from tests.utils import spot_table # Lig0 and Rec0 are high together in a patch; the other two pairs are noise. LRS = LRPairs.from_names(["Lig0_Rec0", "Lig1_Rec1", "Lig2_Rec2"], species="human") @@ -42,16 +41,6 @@ def _test(adata, distance, n_pairs, lrs=LRS, sparse_result=False, **kwargs): return scores, lrs, results -def _adata(X, rows, cols, n_extra_genes): - var_names = LR_GENES + [f"gene{i}" for i in range(n_extra_genes)] - obs = pd.DataFrame( - {"imagerow": np.asarray(rows, float), "imagecol": np.asarray(cols, float)}, - index=[f"spot{i}" for i in range(len(X))], - ) - X = scipy.sparse.csr_matrix(X.astype(np.float32)) - return AnnData(X=X, obs=obs, var=pd.DataFrame(index=var_names)) - - def _gridded_adata(n_side=10, n_extra_genes=60, seed=0): """Spots on a grid, each covering many cells, as Visium or gridded data: most genes are detected at most spots, so most random pairs score at a spot. Lig0 @@ -63,7 +52,7 @@ def _gridded_adata(n_side=10, n_extra_genes=60, seed=0): rows, cols = np.divmod(np.arange(n_spots), n_side) X[(rows < 4) & (cols < 4), :2] = 12 X[(rows >= 8) & (cols >= 8), : len(LR_GENES)] = 0 - return _adata(X, rows, cols, n_extra_genes) + return spot_table(X, rows, cols, LR_GENES) def _sparse_cells_adata(n_cells=900, n_extra_genes=150, seed=0): @@ -77,7 +66,7 @@ def _sparse_cells_adata(n_cells=900, n_extra_genes=150, seed=0): X = rng.poisson(0.1, size=(n_cells, len(LR_GENES) + n_extra_genes)) patch = (rows < side * 0.3) & (cols < side * 0.3) X[patch, :2] = rng.poisson(4.0, size=(patch.sum(), 2)) - return _adata(X, rows, cols, n_extra_genes) + return spot_table(X, rows, cols, LR_GENES) class Sample: diff --git a/tests/utils.py b/tests/utils.py index f334b254..dc6095dc 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -44,6 +44,20 @@ def scores_and_pvals(n_spots=30, seed=0): return scores, pvals +def spot_table(X, rows, cols, lr_genes) -> anndata.AnnData: + """Spots at `rows` and `cols` (obs imagerow and imagecol), named spot0, spot1, + ..., with counts `X`, stored sparse: genes `lr_genes` first, then gene0, + gene1, ... for the rest of X's columns.""" + n_other_genes = X.shape[1] - len(lr_genes) + var_names = list(lr_genes) + [f"gene{i}" for i in range(n_other_genes)] + obs = pd.DataFrame( + {"imagerow": np.asarray(rows, float), "imagecol": np.asarray(cols, float)}, + index=[f"spot{i}" for i in range(len(X))], + ) + X = scipy.sparse.csr_matrix(np.asarray(X, dtype=np.float32)) + return anndata.AnnData(X=X, obs=obs, var=pd.DataFrame(index=var_names)) + + CCI_LRS = LRPairs.from_names(["LigA_RecA", "LigB_RecB", "LigC_RecC"], species="human") CELL_TYPES = np.array(["CT1", "CT2", "CT3"]) @@ -63,29 +77,17 @@ def cci_table( n_spots = n_side * n_side lr_genes = np.column_stack((CCI_LRS.ligands(), CCI_LRS.receptors())).ravel() lr_genes = lr_genes.tolist() # each pair's ligand then receptor - var_names = lr_genes + [f"gene{i}" for i in range(n_other_genes)] - X = rng.poisson(0.3, size=(n_spots, len(var_names))).astype(np.float32) + X = rng.poisson(0.3, size=(n_spots, len(lr_genes) + n_other_genes)) rows, cols = np.divmod(np.arange(n_spots), n_side) X[(rows < 4) & (cols < 4), :2] = 6 - obs_names = [f"spot{i}" for i in range(n_spots)] band = np.minimum(rows * len(CELL_TYPES) // n_side, len(CELL_TYPES) - 1) - adata = anndata.AnnData( - X=scipy.sparse.csr_matrix(X), - obs=pd.DataFrame( - { - "imagerow": rows.astype(float), - "imagecol": cols.astype(float), - "cell_type": pd.Categorical(CELL_TYPES[band], categories=CELL_TYPES), - }, - index=obs_names, - ), - var=pd.DataFrame(index=var_names), - ) + adata = spot_table(X, rows, cols, lr_genes) + adata.obs["cell_type"] = pd.Categorical(CELL_TYPES[band], categories=CELL_TYPES) adata.obsm["spatial"] = np.column_stack([cols, rows]).astype(float) adata.uns["cell_type"] = pd.DataFrame( - np.eye(len(CELL_TYPES))[band], index=obs_names, columns=CELL_TYPES + np.eye(len(CELL_TYPES))[band], index=adata.obs_names, columns=CELL_TYPES ) adata.uns["spatial"] = { "synthetic": { From 040ede0ba2b0f4be75378645079686535d063c0e Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 16:39:34 +1000 Subject: [PATCH 3/7] Move adata. --- tests/tl/test_analysis.py | 16 +++------------- tests/tl/test_het.py | 13 ++++--------- tests/tl/test_report_dropped_lrs.py | 19 +++++++++---------- tests/tl/test_scoring.py | 17 ++++------------- tests/utils.py | 13 ++++++++----- 5 files changed, 28 insertions(+), 50 deletions(-) diff --git a/tests/tl/test_analysis.py b/tests/tl/test_analysis.py index cccef74b..a5c4d614 100644 --- a/tests/tl/test_analysis.py +++ b/tests/tl/test_analysis.py @@ -5,11 +5,10 @@ import anndata import numpy as np -import pandas as pd -from anndata import AnnData import stlearn as st from stlearn.tl.cci import LRPairs +from tests.utils import spot_table def _make_cci_adata(dtype=np.float64, n_side=8, n_extra_genes=40, seed=0): @@ -17,18 +16,9 @@ def _make_cci_adata(dtype=np.float64, n_side=8, n_extra_genes=40, seed=0): n_spots = n_side * n_side lr_genes = ["Lig0", "Rec0", "Lig1", "Rec1"] # two L-R pairs - extra_genes = [f"gene{i}" for i in range(n_extra_genes)] - var_names = lr_genes + extra_genes - - X = rng.poisson(3.0, size=(n_spots, len(var_names))).astype(dtype) - + X = rng.poisson(3.0, size=(n_spots, len(lr_genes) + n_extra_genes)) rows, cols = np.divmod(np.arange(n_spots), n_side) - obs = pd.DataFrame( - {"imagerow": rows.astype(float), "imagecol": cols.astype(float)}, - index=[f"spot{i}" for i in range(n_spots)], - ) - var = pd.DataFrame(index=var_names) - return AnnData(X=X, obs=obs, var=var) + return spot_table(X, rows, cols, lr_genes, sparse=False, dtype=dtype) LRS = LRPairs.from_names(["Lig0_Rec0", "Lig1_Rec1"], species="human") diff --git a/tests/tl/test_het.py b/tests/tl/test_het.py index feaf8558..37c0a8e3 100644 --- a/tests/tl/test_het.py +++ b/tests/tl/test_het.py @@ -13,7 +13,7 @@ from stlearn.tl.cci import lr_result from stlearn.tl.cci.het import count, get_data_for_counting from stlearn.tl.cci.neighbours import calc_neighbours -from tests.utils import CCI_LRS, cci_table +from tests.utils import CCI_LRS, cci_table, spot_table LRS = st.tl.cci.LRPairs.from_names( ["Lig0_Rec0", "Lig1_Rec1"], species="human", source="test" @@ -25,15 +25,10 @@ def _make_adata(n_side=6, n_extra_genes=40, seed=0): """Spots on a unit grid, with cell type proportions in uns["cell_type"].""" rng = np.random.default_rng(seed) n_spots = n_side * n_side - var_names = list(LRS.genes()) + [f"gene{i}" for i in range(n_extra_genes)] - X = rng.poisson(3.0, size=(n_spots, len(var_names))).astype(np.float64) - + lr_genes = list(LRS.genes()) + X = rng.poisson(3.0, size=(n_spots, len(lr_genes) + n_extra_genes)) rows, cols = np.divmod(np.arange(n_spots), n_side) - obs = pd.DataFrame( - {"imagerow": rows.astype(float), "imagecol": cols.astype(float)}, - index=[f"spot{i}" for i in range(n_spots)], - ) - adata = AnnData(X=X, obs=obs, var=pd.DataFrame(index=var_names)) + adata = spot_table(X, rows, cols, lr_genes, sparse=False, dtype=np.float64) adata.uns["spatial"] = { "lib": { "scalefactors": {"spot_diameter_fullres": 5.0, "tissue_hires_scalef": 0.1}, diff --git a/tests/tl/test_report_dropped_lrs.py b/tests/tl/test_report_dropped_lrs.py index fee5fbdc..5a639e96 100644 --- a/tests/tl/test_report_dropped_lrs.py +++ b/tests/tl/test_report_dropped_lrs.py @@ -5,20 +5,17 @@ import unittest import numpy as np -import pandas as pd -import scipy.sparse -from anndata import AnnData - from stlearn.tl.cci import LRPairs from stlearn.tl.cci.analysis import _report_dropped_lrs +from tests.utils import spot_table def _adata(sparse=False): - """Four spots: A is 0.3 everywhere, E is never expressed, the rest are 1.""" - X = np.array([[0.3, 1.0, 1.0, 1.0, 0.0]] * 4, dtype=np.float32) - return AnnData( - scipy.sparse.csr_matrix(X) if sparse else X, - var=pd.DataFrame(index=list("ABCDE")), + """Four spots in a row: A is 0.3 everywhere, E is never expressed, the rest + are 1.""" + return spot_table( + np.array([[0.3, 1.0, 1.0, 1.0, 0.0]] * 4), np.zeros(4), np.arange(4), + list("ABCDE"), sparse=sparse ) @@ -65,7 +62,9 @@ def test_nothing_dropped(self): def test_names_at_most_max_named_genes(self): genes = [f"G{i}" for i in range(12)] - adata = AnnData(np.zeros((2, 12)), var=pd.DataFrame(index=genes)) + adata = spot_table( + np.zeros((2, 12)), np.zeros(2), np.arange(2), genes, sparse=False + ) lrs = [f"G{i}_G{i + 1}" for i in range(11)] report = _report(adata, lrs, [0] * 11) self.assertIn("G0, G1, G10, G11, G2, G3, G4, G5, G6, G7 and 2 more.", report) diff --git a/tests/tl/test_scoring.py b/tests/tl/test_scoring.py index 1639d102..d3c81fe2 100644 --- a/tests/tl/test_scoring.py +++ b/tests/tl/test_scoring.py @@ -6,9 +6,7 @@ from unittest import mock import numpy as np -import pandas as pd import scipy.sparse -from anndata import AnnData from stlearn.tl.cci import scoring from stlearn.tl.cci.neighbours import calc_neighbours @@ -19,6 +17,7 @@ neighbourhood_means, score_spots, ) +from tests.utils import spot_table def _reference_scores(expr, pairs, neighbour_lists, het_vals, min_expr, spot_indices): @@ -185,18 +184,10 @@ def test_spots_scored_in_chunks(self): def _make_adata(n_side=6, seed=0, sparse=True): rng = np.random.default_rng(seed) n_spots = n_side * n_side - var_names = ["Lig0", "Rec0", "Lig1", "Rec1", "Rec2", "gene0"] - X = rng.poisson(1.0, size=(n_spots, len(var_names))).astype(np.float32) + lr_genes = ["Lig0", "Rec0", "Lig1", "Rec1", "Rec2"] # and gene0 + X = rng.poisson(1.0, size=(n_spots, len(lr_genes) + 1)) rows, cols = np.divmod(np.arange(n_spots), n_side) - obs = pd.DataFrame( - {"imagerow": rows.astype(float), "imagecol": cols.astype(float)}, - index=[f"spot{i}" for i in range(n_spots)], - ) - return AnnData( - X=scipy.sparse.csr_matrix(X) if sparse else X, - obs=obs, - var=pd.DataFrame(index=var_names), - ) + return spot_table(X, rows, cols, lr_genes, sparse=sparse) class TestGetLrsScores(unittest.TestCase): diff --git a/tests/utils.py b/tests/utils.py index dc6095dc..f7c6529b 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -44,20 +44,23 @@ def scores_and_pvals(n_spots=30, seed=0): return scores, pvals -def spot_table(X, rows, cols, lr_genes) -> anndata.AnnData: - """Spots at `rows` and `cols` (obs imagerow and imagecol), named spot0, spot1, - ..., with counts `X`, stored sparse: genes `lr_genes` first, then gene0, - gene1, ... for the rest of X's columns.""" +def spot_table( + X, rows, cols, lr_genes, sparse=True, dtype=np.float32 +) -> anndata.AnnData: n_other_genes = X.shape[1] - len(lr_genes) var_names = list(lr_genes) + [f"gene{i}" for i in range(n_other_genes)] obs = pd.DataFrame( {"imagerow": np.asarray(rows, float), "imagecol": np.asarray(cols, float)}, index=[f"spot{i}" for i in range(len(X))], ) - X = scipy.sparse.csr_matrix(np.asarray(X, dtype=np.float32)) + X = np.asarray(X, dtype=np.float32) + X = np.asarray(X, dtype=dtype) + if sparse: + X = scipy.sparse.csr_matrix(X) return anndata.AnnData(X=X, obs=obs, var=pd.DataFrame(index=var_names)) + CCI_LRS = LRPairs.from_names(["LigA_RecA", "LigB_RecB", "LigC_RecC"], species="human") CELL_TYPES = np.array(["CT1", "CT2", "CT3"]) From ed700a30f9af2d23a5adde1555b8d1c375d01b1f Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 16:48:08 +1000 Subject: [PATCH 4/7] Remove duplication and fix tests. --- stlearn/tl/cci/analysis.py | 2 +- stlearn/tl/cci/permutation.py | 2 +- tests/tl/test_cci_labels.py | 11 +++++++++-- tests/tl/test_permutation.py | 4 ++-- tests/tl/test_permutation_gridded_sparse.py | 1 + tests/tl/test_report_dropped_lrs.py | 7 +++++-- tests/utils.py | 1 - 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/stlearn/tl/cci/analysis.py b/stlearn/tl/cci/analysis.py index 198ffaf4..e463d8d6 100644 --- a/stlearn/tl/cci/analysis.py +++ b/stlearn/tl/cci/analysis.py @@ -701,4 +701,4 @@ def expressed(gene: str) -> numpy.typing.NDArray[np.bool_]: print( "Significant cell type interaction counts for each LR pair stored in " f"the LR table's uns['per_lr_cci_{use_label}']", - ) \ No newline at end of file + ) diff --git a/stlearn/tl/cci/permutation.py b/stlearn/tl/cci/permutation.py index 198d764b..d81c2d06 100644 --- a/stlearn/tl/cci/permutation.py +++ b/stlearn/tl/cci/permutation.py @@ -307,4 +307,4 @@ def get_stats( pvals_adj = multipletests(pvals, method=adj_method)[1] log10_pvals_adj = -np.log10(pvals_adj) lr_sign = scores * (pvals_adj < pval_adj_cutoff) - return pvals, pvals_adj, log10_pvals_adj, lr_sign \ No newline at end of file + return pvals, pvals_adj, log10_pvals_adj, lr_sign diff --git a/tests/tl/test_cci_labels.py b/tests/tl/test_cci_labels.py index f646cfc8..06877fd1 100644 --- a/tests/tl/test_cci_labels.py +++ b/tests/tl/test_cci_labels.py @@ -30,7 +30,7 @@ def read_test_data_with_lr_pairs(n_pairs: int = 20): genes: list[str] = [] for ligand, receptor in zip( - lrs.ligands().tolist(), lrs.receptors().tolist(), strict=True + lrs.ligands().tolist(), lrs.receptors().tolist(), strict=True ): if ligand != receptor and ligand not in genes and receptor not in genes: genes += [ligand, receptor] @@ -58,7 +58,14 @@ class TestCCILabels(unittest.TestCase): def setUpClass(cls): adata, lrs = read_test_data_with_lr_pairs() cls.lr_results = st.tl.cci.run( - adata, lrs, min_spots=5, distance=None, n_pairs=200, n_cpus=1, verbose=False + adata, + lrs, + min_spots=5, + distance=None, + n_pairs=200, + n_cpus=1, + verbose=False, + null="random" ) # Three bands of cell types across the tissue. bands = pd.qcut(adata.obs["imagecol"], 3, labels=CELL_TYPE_LABELS) diff --git a/tests/tl/test_permutation.py b/tests/tl/test_permutation.py index f3fe7152..fa4eb96b 100644 --- a/tests/tl/test_permutation.py +++ b/tests/tl/test_permutation.py @@ -40,7 +40,7 @@ def test_random_counts_every_pair(self): # n > 3 = 2, 2 / 10 (shape of background column) 0.2, # n > 3 = 3, 3 / 10 (shape of background column) - 0.3 + 0.3, ], ) @@ -56,7 +56,7 @@ def test_codetected_counts_detected_pairs(self): # n > 3 = 2 + 1, 3 / 5 (non-zero = 4 + 1) 0.6, # n > 3 = 3 + 1, 4 / 11 (non-zero = 10 + 1) - 4 / 11 + 4 / 11, ], ) diff --git a/tests/tl/test_permutation_gridded_sparse.py b/tests/tl/test_permutation_gridded_sparse.py index 7f723a46..8363cbaf 100644 --- a/tests/tl/test_permutation_gridded_sparse.py +++ b/tests/tl/test_permutation_gridded_sparse.py @@ -8,6 +8,7 @@ import numpy as np import itertools +import scipy.sparse from anndata import AnnData from stlearn.tl.cci.ligand_receptors import LRPairs from stlearn.tl.cci._results import to_dense diff --git a/tests/tl/test_report_dropped_lrs.py b/tests/tl/test_report_dropped_lrs.py index 5a639e96..7f44535e 100644 --- a/tests/tl/test_report_dropped_lrs.py +++ b/tests/tl/test_report_dropped_lrs.py @@ -14,8 +14,11 @@ def _adata(sparse=False): """Four spots in a row: A is 0.3 everywhere, E is never expressed, the rest are 1.""" return spot_table( - np.array([[0.3, 1.0, 1.0, 1.0, 0.0]] * 4), np.zeros(4), np.arange(4), - list("ABCDE"), sparse=sparse + np.array([[0.3, 1.0, 1.0, 1.0, 0.0]] * 4), + np.zeros(4), + np.arange(4), + list("ABCDE"), + sparse=sparse, ) diff --git a/tests/utils.py b/tests/utils.py index f7c6529b..b99c6890 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -60,7 +60,6 @@ def spot_table( return anndata.AnnData(X=X, obs=obs, var=pd.DataFrame(index=var_names)) - CCI_LRS = LRPairs.from_names(["LigA_RecA", "LigB_RecB", "LigC_RecC"], species="human") CELL_TYPES = np.array(["CT1", "CT2", "CT3"]) From 4fe4bfcd7cd9d79cba8580ab132eb68e5e05e945 Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 16:56:22 +1000 Subject: [PATCH 5/7] Fix formatting. --- tests/tl/test_cci_labels.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tl/test_cci_labels.py b/tests/tl/test_cci_labels.py index 06877fd1..b88880ef 100644 --- a/tests/tl/test_cci_labels.py +++ b/tests/tl/test_cci_labels.py @@ -30,7 +30,7 @@ def read_test_data_with_lr_pairs(n_pairs: int = 20): genes: list[str] = [] for ligand, receptor in zip( - lrs.ligands().tolist(), lrs.receptors().tolist(), strict=True + lrs.ligands().tolist(), lrs.receptors().tolist(), strict=True ): if ligand != receptor and ligand not in genes and receptor not in genes: genes += [ligand, receptor] @@ -65,7 +65,7 @@ def setUpClass(cls): n_pairs=200, n_cpus=1, verbose=False, - null="random" + null="random", ) # Three bands of cell types across the tissue. bands = pd.qcut(adata.obs["imagecol"], 3, labels=CELL_TYPE_LABELS) From 85c5b5b6507ec4e6289c5ee3018f0aa3a4a867e6 Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 17:07:23 +1000 Subject: [PATCH 6/7] Fix formatting --- tests/acceptance-results/benchmark.json | 32 ++++++++++ tests/acceptance-results/history.csv | 59 +++++++++++++++++++ .../trajectory_benchmark.json | 22 +++++++ .../acceptance-results/trajectory_history.csv | 5 ++ tests/tl/test_permutation_gridded_sparse.py | 7 ++- tests/tl/test_permutation_run_null.py | 3 +- tests/tl/test_report_dropped_lrs.py | 1 + 7 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 tests/acceptance-results/benchmark.json create mode 100644 tests/acceptance-results/history.csv create mode 100644 tests/acceptance-results/trajectory_benchmark.json create mode 100644 tests/acceptance-results/trajectory_history.csv diff --git a/tests/acceptance-results/benchmark.json b/tests/acceptance-results/benchmark.json new file mode 100644 index 00000000..3798f455 --- /dev/null +++ b/tests/acceptance-results/benchmark.json @@ -0,0 +1,32 @@ +[ + { + "name": "cci.run lit: time", + "unit": "s", + "value": 95.05016879201867 + }, + { + "name": "cci.run lit: peak memory", + "unit": "GB", + "value": 6.740997314453125 + }, + { + "name": "cci.run cell_types: time", + "unit": "s", + "value": 130.382964166929 + }, + { + "name": "cci.run cell_types: peak memory", + "unit": "GB", + "value": 6.8622894287109375 + }, + { + "name": "cci.run wide: time", + "unit": "s", + "value": 538.8811077499995 + }, + { + "name": "cci.run wide: peak memory", + "unit": "GB", + "value": 8.301010131835938 + } +] \ No newline at end of file diff --git a/tests/acceptance-results/history.csv b/tests/acceptance-results/history.csv new file mode 100644 index 00000000..da715e27 --- /dev/null +++ b/tests/acceptance-results/history.csv @@ -0,0 +1,59 @@ +timestamp,scenario,outcome,wall_seconds,cpu_seconds,cores_busy,peak_memory_gb,memory_added_gb,warm_up_seconds,baseline_wall_seconds,baseline_peak_memory_gb,time_vs_baseline,memory_vs_baseline,phase_neighbours_seconds,phase_cell_type_counts_seconds,phase_lr_scores_seconds,phase_testing_seconds,phase_testing_backgrounds_seconds,bins,genes,lr_pairs_tested,n_pairs,platform,processor,cpus,numba_threads,python,numpy,numba +2026-11-07T03:04:39+00:00,lit,baseline written,2.587411000044085,4.635278,1.7914734071707288,1.5074462890625,0.65478515625,2.5051412080647424,,,,,0.04353420902043581,,0.36208075005561113,2.0643901670118794,1.0265651568770409,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:04:48+00:00,cell_types,baseline written,2.5174854160286486,4.590894,1.8236030170304494,1.48651123046875,0.6639251708984375,1.5770552909234539,,,,,0.04177745897322893,0.020291291060857475,0.32849183306097984,2.014433874981478,0.9927120809443295,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:05:04+00:00,wide,baseline written,8.978917666012421,19.098517,2.1270399964010074,1.7162628173828125,0.889434814453125,1.6518109170719981,,,,,0.08838962495792657,,0.6055773750413209,7.908081999979913,5.869499782565981,19881,18000,2817,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:08:57+00:00,lit,results identical,2.451069916016422,4.552456,1.857334207503487,1.5041961669921875,0.650054931640625,2.2795215839287266,2.587411000044085,1.5074462890625,0.947305981142795,0.9978439549761114,0.04186595801729709,,0.32062758307438344,1.9745924170129001,0.962420896277763,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:09:06+00:00,cell_types,results identical,2.486722292029299,4.5968800000000005,1.8485699085637342,1.4796142578125,0.6617584228515625,1.5896680420264602,2.5174854160286486,1.48651123046875,0.9877802175919339,0.9953602956271813,0.04279679199680686,0.021160083007998765,0.34233412507455796,1.9630085000535473,0.9515125739853829,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:09:20+00:00,wide,results identical,6.705105916946195,16.794638,2.5047535725802565,1.693450927734375,0.8704833984375,1.6070587079739198,8.978917666012421,1.7162628173828125,0.7467610425170502,0.9867083937160486,0.08465195901226252,,0.5385109580820426,5.705010041012429,3.763245989335701,19881,18000,2817,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:14:52+00:00,lit,results identical,2.4770534170093015,4.556195,1.8393608182664762,1.4765625,0.6582183837890625,1.5762339999200776,2.587411000044085,1.5074462890625,0.9573482593090532,0.9795125111345048,0.042509416001848876,,0.32936924998648465,1.9899796249810606,0.9660568104591221,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:15:02+00:00,cell_types,results identical,2.5690233329078183,4.632316000000001,1.8031428288962987,1.493072509765625,0.6662750244140625,1.8106412920169532,2.5174854160286486,1.48651123046875,1.0204719823006845,1.0044138780537877,0.043638709001243114,0.021112082991749048,0.33223704108968377,2.0526485410518944,1.006612385972403,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:15:16+00:00,wide,results identical,6.968096042051911,16.89802,2.425055552911696,1.690826416015625,0.8644561767578125,1.6240227919770405,8.978917666012421,1.7162628173828125,0.7760507781943472,0.9851791921904034,0.08467558398842812,,0.5410181659972295,5.950427416944876,3.973540292470716,19881,18000,2817,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:27:15+00:00,lit,results differ,1.4940424580127,2.655035999999999,1.7770820271945913,1.2474822998046875,0.4506072998046875,1.6938967499881983,2.587411000044085,1.5074462890625,0.5774275745087442,0.8275467649202365,0.02115133299957961,,0.19059033296070993,1.2204918750794604,0.5055825141025707,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:27:23+00:00,cell_types,results differ,1.473905541934073,2.6575360000000003,1.8030572003364314,1.2444305419921875,0.4477081298828125,1.5503987080883235,2.5174854160286486,1.48651123046875,0.5854673606249404,0.8371484294805994,0.02199758298229426,0.010075957980006933,0.1674333750270307,1.214617207995616,0.5025136355543509,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:27:34+00:00,wide,results differ,4.069111207965761,9.426134,2.3165093108163863,1.3428497314453125,0.5356292724609375,1.6317252910230309,8.978917666012421,1.7162628173828125,0.45318504516066827,0.7824266294442419,0.0425385000417009,,0.2728158750105649,3.5631852500373498,2.077467300929129,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:28:03+00:00,lit,baseline written,1.4935887919273227,2.695841999999999,1.8049425749381074,1.248321533203125,0.4488983154296875,1.6152503750054166,,,,,0.021982374950312078,,0.16793774999678135,1.2443855829769745,0.5227379261050373,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:28:12+00:00,cell_types,baseline written,1.5797163340030238,2.754545000000001,1.7436959666169587,1.2559661865234375,0.4528656005859375,1.8077722089365125,,,,,0.02644795796368271,0.01619558408856392,0.18970341701060534,1.2816322909202427,0.5443712281994522,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:28:25+00:00,wide,baseline written,5.006900292006321,10.243374000000001,2.0458514055799912,1.38507080078125,0.5391387939453125,2.3359329169616103,,,,,0.040191999985836446,,0.3682580830063671,4.407373000052758,2.897872197558172,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:28:41+00:00,lit,baseline written,1.479796166997403,2.6819869999999995,1.8124029915835742,1.255035400390625,0.45654296875,1.5541661250172183,,,,,0.021797249908559024,,0.16990091593470424,1.228709292015992,0.5200648892205209,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:28:48+00:00,cell_types,baseline written,1.490997040993534,2.700805000000001,1.8114086921328192,1.25616455078125,0.455078125,1.5949852920603007,,,,,0.02119633392430842,0.010074791964143515,0.17222549999132752,1.228480999940075,0.5214829510077834,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:29:00+00:00,wide,baseline written,4.904397791950032,10.249707,2.0899012345253967,1.3427886962890625,0.538818359375,1.6113854170544073,,,,,0.04086579196155071,,0.30310016695875674,4.371265665977262,2.882193635450676,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:30:12+00:00,lit,baseline written,44.11461716610938,81.180083,1.8402082623617504,4.7789459228515625,2.968536376953125,1.5700593340443447,,,,,1.0990840840386227,,7.892799458000809,32.248711207997985,25.716971528716385,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:31:10+00:00,cell_types,baseline written,44.70824570802506,82.552032,1.846460998248966,4.6800689697265625,2.8700408935546875,1.6281344160670415,,,,,1.2040415409719571,0.5255072910804302,8.059877874911763,32.03226825001184,25.51387205743231,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:36:03+00:00,wide,baseline written,259.71012041694485,720.943076,2.775952954172832,6.9522857666015625,5.153106689453125,1.593925042077899,,,,,2.265329624991864,,17.89639300003182,229.18428649997804,205.54970502189826,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:37:22+00:00,lit,baseline written,42.81532624992542,81.07617400000001,1.8936250427413532,4.953887939453125,3.126373291015625,2.276383416960016,,,,,1.0678577090147883,,7.612674082978629,31.18503112497274,24.892180252354592,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:38:28+00:00,cell_types,baseline written,53.38549337501172,97.13535,1.8195083319294822,5.1231231689453125,3.3174285888671875,1.598115999950096,,,,,1.2400316660059616,0.5385529579361901,8.549231167067774,40.13849241705611,32.19979027530644,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:42:36+00:00,wide,baseline written,220.22714504098985,720.112139,3.2698609377421155,7.6418609619140625,5.839935302734375,1.7154929999960586,,,,,2.6003666250035167,,18.47071800008416,188.54784291691612,161.5068297284888,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:43:50+00:00,lit,results differ,2.411705582984723,4.466528,1.8520204255082546,1.473968505859375,0.6509246826171875,1.5698830420151353,42.81532624992542,4.953887939453125,0.05632809076139935,0.29753771661255846,0.04293229104951024,,0.3121656250441447,1.941416957997717,0.9371776459738612,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:44:55+00:00,lit,baseline written,41.672592915943824,78.789626,1.8906821123159652,4.9074554443359375,3.0944061279296875,1.5570069999666885,,,,,1.0739432079717517,,7.640663458965719,30.120009625097737,23.879711303045042,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:45:49+00:00,cell_types,baseline written,42.124408166040666,79.817511,1.8948043301970066,5.0547027587890625,3.2559661865234375,1.5876610409468412,,,,,1.2162478329846635,0.5105545420665294,7.440117833088152,30.1455665420508,23.940629382035695,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T03:49:58+00:00,wide,baseline written,219.7571012909757,706.5373079999999,3.2150829431650036,7.636444091796875,5.8153533935546875,1.6356632499955595,,,,,2.8277141250437126,,15.081946416990831,191.43385670904536,163.67063869908452,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T05:04:07+00:00,lit,baseline written,41.410330292070284,78.328533,1.8915215707661048,4.42572021484375,2.62518310546875,1.4737763749435544,,,,,1.1888028749963269,,7.5521345409797505,32.289444166002795,25.661773402243853,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T05:05:02+00:00,cell_types,baseline written,42.97375549993012,80.83944699999999,1.8811352663867473,4.889312744140625,3.0730133056640625,1.5707281249342486,,,,,1.2512787919258699,0.5452950829640031,7.718583208043128,33.06140870798845,26.36278031708207,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T05:08:34+00:00,wide,baseline written,185.80988112499472,658.451016,3.543681380200973,6.7780303955078125,4.97564697265625,1.496061083045788,,,,,2.456929916050285,,15.168929834035225,166.746047582943,143.07260719977785,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T10:36:01+00:00,lit,baseline written,42.78645479190163,79.801899,1.8651206179181836,4.631622314453125,2.8153839111328125,2.169981374987401,,,,,0.5255879579344764,,8.057938375044614,33.86328974994831,27.111842768266797,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T10:37:03+00:00,cell_types,baseline written,49.86207212496083,93.438806,1.8739455064328296,4.42242431640625,2.6005401611328125,1.4908102090703323,,,,,0.6445691250264645,0.5818333750357851,8.39332262496464,39.79096966597717,31.983781708520837,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T10:41:06+00:00,wide,baseline written,216.72740395902656,734.462458,3.388876739089506,5.6401214599609375,3.82086181640625,1.5329082499956712,,,,,2.7435951670631766,,21.183328000013717,191.09151312499307,162.7996038791025,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T11:10:59+00:00,lit,baseline written,40.830831874976866,78.122616,1.91332413307693,4.7761688232421875,2.966705322265625,1.419359082938172,,,,,0.516901999944821,,7.704313457943499,32.16578262497205,25.67418439127505,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T11:11:52+00:00,cell_types,baseline written,41.25652495806571,78.89762300000001,1.9123671487163247,4.7223663330078125,2.9062347412109375,1.4516933329869062,,,,,0.5092751660849899,0.06505166704300791,7.803363792016171,32.4470559170004,25.94578122533858,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T11:15:46+00:00,wide,baseline written,207.55711712501943,694.214826,3.344692948215543,5.6932373046875,3.88507080078125,1.4570878749946132,,,,,2.214875250007026,,16.42280420800671,187.04624699999113,160.4545534978388,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T11:24:22+00:00,lit,baseline written,93.69237779197283,174.003666,1.8571805956973793,7.0041961669921875,4.1408843994140625,1.4839816250605509,,,,,1.0170044999103993,,15.786770957987756,76.1332216670271,64.35046036809217,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T11:26:17+00:00,cell_types,baseline written,99.19173862505704,185.94778,1.8746297078517717,7.42633056640625,4.56134033203125,1.4809171659871936,,,,,1.0161610830109566,0.12498995894566178,15.713294500019401,81.58194658404682,70.0210129627958,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T11:35:48+00:00,wide,baseline written,522.9244669579202,1597.086789,3.054144317038655,11.21826171875,8.382614135742188,1.4431132499594241,,,,,4.092293708003126,,31.125497375032865,484.3801675409777,425.9467072696425,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:19:15+00:00,lit,baseline written,91.10139358299784,170.762596,1.8744235327687593,6.7155303955078125,3.88385009765625,1.4452110829297453,,,,,1.0681097080232576,,15.317733459058218,74.05952420795802,62.62183288112283,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:21:39+00:00,cell_types,baseline written,127.20257158298045,225.67399699999999,1.774130775750723,6.9266510009765625,4.035003662109375,1.477659208001569,,,,,1.0367763750255108,0.12846795900259167,17.845520916976966,107.34738483396359,90.62902338861022,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:30:48+00:00,wide,baseline written,500.762316584005,1634.33809,3.2637002343722337,8.427505493164062,5.5780792236328125,1.4336376250721514,,,,,5.211701959022321,,43.41443204204552,449.14481099997647,390.05036241712514,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:35:47+00:00,lit,baseline written,89.75865824997891,169.383331,1.887097404333579,7.4330291748046875,4.5692291259765625,1.4103332500671968,,,,,1.0616080419858918,,15.29024187498726,72.76569941593334,61.52330457873177,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:37:56+00:00,cell_types,baseline written,111.39636787504423,204.086368,1.832073808985659,7.460052490234375,4.57867431640625,1.4466825829586014,,,,,1.045427167089656,0.12895991699770093,16.736161791952327,92.71898912510369,78.8731977356365,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:47:06+00:00,wide,baseline written,506.62956495804247,1652.7405119999999,3.262226735893068,8.466323852539062,5.6315460205078125,1.4561966250184923,,,,,4.617148749995977,,43.08410158299375,456.0986349999439,394.01537925587036,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:50:38+00:00,lit,baseline written,105.69104562501889,193.056999,1.8266164163513592,7.379180908203125,4.5138092041015625,1.4036874580197036,,,,,1.0033117909915745,,15.13030375004746,88.53493670909666,75.23605869500898,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T12:53:08+00:00,cell_types,baseline written,128.09675762499683,234.78041199999998,1.8328364929213858,7.532806396484375,4.6649932861328125,1.7268955840263516,,,,,1.5840522920479998,0.19112962496001273,23.275798332993872,102.14762466703542,85.95631689648144,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-07T13:01:43+00:00,wide,baseline written,468.4684288749704,1591.577659,3.3974064438497655,9.044479370117188,6.1992034912109375,1.5722139169229195,,,,,5.869669665931724,,42.31021187501028,417.21483537508175,362.3599272336578,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T10:49:11+00:00,lit,baseline written,1.5356784160248935,2.748583000000001,1.7898167815073636,1.2537078857421875,0.457733154296875,1.594719041022472,,,,,0.009492625016719103,,0.17444454098585993,1.339326582965441,0.5761811275733635,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T10:49:19+00:00,cell_types,baseline written,1.4003495411016047,2.571764000000001,1.836515758756122,1.2494049072265625,0.460540771484375,1.4719612910412252,,,,,0.009830042021349072,0.0013399580493569374,0.16845008300151676,1.2104099169373512,0.5014314583968371,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T10:49:29+00:00,wide,baseline written,4.170248916954733,9.526668,2.2844362985787234,1.3369140625,0.5429534912109375,1.4272570830071345,,,,,0.03528720897156745,,0.2769290000433102,3.8303892080439255,2.284982407116331,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T10:50:38+00:00,lit,baseline written,8.263245332986116,15.381261000000002,1.8614067935995342,2.170654296875,1.19830322265625,1.4053635830059648,,,,,0.10047099995426834,,1.5422465419396758,6.556777499965392,4.318812339100987,99856,18000,2631,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T10:50:54+00:00,cell_types,baseline written,8.207559500006028,15.469563,1.8847944995084884,2.1564483642578125,1.182586669921875,1.3880479170475155,,,,,0.09553433302789927,0.012157374992966652,1.5123160000657663,6.525017583975568,4.320103782694787,99856,18000,2631,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T10:51:32+00:00,wide,baseline written,27.413256207946688,87.810462,3.2032116627774077,3.0412750244140625,2.0694732666015625,1.4163784579141065,,,,,0.37983558303676546,,2.5860791250597686,24.176291416981257,19.22427488840185,99856,18000,3409,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T11:13:41+00:00,lit,baseline written,95.05016879201867,174.55589,1.83646059989593,6.740997314453125,4.42950439453125,1.534952750080265,,,,,1.0702555839670822,,15.416576791089028,77.8209664169699,65.9255551128881,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T11:16:09+00:00,cell_types,baseline written,130.382964166929,231.450815,1.7751614751116875,6.8622894287109375,3.981658935546875,1.5435699590016156,,,,,1.3095381669700146,0.19032041600439698,21.50005891697947,106.61575054202694,91.01664831337985,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 +2026-11-08T12:05:34+00:00,wide,baseline written,538.8811077499995,1707.675988,3.168929033586076,8.301010131835938,5.4598846435546875,1.430953542003408,,,,,5.039811542024836,,39.993856040993705,490.2085397079354,424.4789078758331,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 diff --git a/tests/acceptance-results/trajectory_benchmark.json b/tests/acceptance-results/trajectory_benchmark.json new file mode 100644 index 00000000..3868c42c --- /dev/null +++ b/tests/acceptance-results/trajectory_benchmark.json @@ -0,0 +1,22 @@ +[ + { + "name": "trajectory clusters_12: time", + "unit": "s", + "value": 1.3604363750200719 + }, + { + "name": "trajectory clusters_12: peak memory", + "unit": "GB", + "value": 0.75604248046875 + }, + { + "name": "trajectory clusters_30: time", + "unit": "s", + "value": 180.21018641709816 + }, + { + "name": "trajectory clusters_30: peak memory", + "unit": "GB", + "value": 0.760894775390625 + } +] \ No newline at end of file diff --git a/tests/acceptance-results/trajectory_history.csv b/tests/acceptance-results/trajectory_history.csv new file mode 100644 index 00000000..6d266c92 --- /dev/null +++ b/tests/acceptance-results/trajectory_history.csv @@ -0,0 +1,5 @@ +timestamp,scenario,outcome,wall_seconds,cpu_seconds,peak_memory_gb,pseudotime_seconds,pseudotimespace_global_seconds,warm_up_seconds,baseline_wall_seconds,baseline_peak_memory_gb,time_vs_baseline,memory_vs_baseline,phase_subclusters_seconds,phase_paga_seconds,phase_diffmap_seconds,phase_dpt_seconds,phase_available_paths_seconds,phase_global_level_seconds,bins,clusters,subclusters_kept,available_paths,lineage_outcomes,platform,cpus,python,networkx,scanpy +2026-11-07T03:05:33+00:00,clusters_12,baseline written,1.3917358750477433,1.3884809999999996,0.7701416015625,0.5911427079699934,0.00602174992673099,0.1225162090267986,,,,,0.19008754205424339,0.11008729203604162,0.10623916692566127,0.003575375070795417,0.04651879204902798,0.7979466641554609,19881,12,23,219,"{""NetworkXPointlessConcept: Connectivity is undefined for the null graph."": 12, ""OK"": 207}",macOS-27.0.1-arm64-arm-64bit,10,3.12.12,3.5,1.12.1 +2026-11-07T03:08:34+00:00,clusters_30,stopped at limit,180.19711387495045,,0.7665863037109375,,,,,,,,,,,,,,,30,,,{},darwin,,,, +2026-11-07T03:09:26+00:00,clusters_12,results identical,1.3604363750200719,1.36041,0.75604248046875,0.581157875014469,0.005809082998894155,0.1231100419536233,1.3917358750477433,0.7701416015625,0.9775104597152116,0.9816928197812649,0.1859595839632675,0.10663875006139278,0.10548845794983208,0.003333208034746349,0.045916917035356164,0.7768145388690755,19881,12,23,219,"{""NetworkXPointlessConcept: Connectivity is undefined for the null graph."": 12, ""OK"": 207}",macOS-27.0.1-arm64-arm-64bit,10,3.12.12,3.5,1.12.1 +2026-11-07T03:12:26+00:00,clusters_30,stopped at limit,180.21018641709816,,0.760894775390625,,,,,,,,,,,,,,,30,,,{},darwin,,,, diff --git a/tests/tl/test_permutation_gridded_sparse.py b/tests/tl/test_permutation_gridded_sparse.py index 8363cbaf..2b70b851 100644 --- a/tests/tl/test_permutation_gridded_sparse.py +++ b/tests/tl/test_permutation_gridded_sparse.py @@ -4,19 +4,20 @@ under both nulls ("codetected", the default, and "random", the original), on a gridded sample of well-covered spots and on sparse single cells without a grid.""" +import itertools import unittest import numpy as np -import itertools import scipy.sparse from anndata import AnnData -from stlearn.tl.cci.ligand_receptors import LRPairs + from stlearn.tl.cci._results import to_dense +from stlearn.tl.cci.ligand_receptors import LRPairs from stlearn.tl.cci.neighbours import calc_neighbours from stlearn.tl.cci.permutation import ( empirical_pvals, - perform_spot_testing, gene_quantiles, + perform_spot_testing, ) from stlearn.tl.cci.scoring import get_lrs_scores from tests.utils import spot_table diff --git a/tests/tl/test_permutation_run_null.py b/tests/tl/test_permutation_run_null.py index 525c0a67..107c0a64 100644 --- a/tests/tl/test_permutation_run_null.py +++ b/tests/tl/test_permutation_run_null.py @@ -1,9 +1,10 @@ import unittest import numpy as np + import stlearn as st from stlearn.tl.cci.permutation import empirical_pvals -from tests.utils import cci_table, CCI_LRS +from tests.utils import CCI_LRS, cci_table class TestRunNull(unittest.TestCase): diff --git a/tests/tl/test_report_dropped_lrs.py b/tests/tl/test_report_dropped_lrs.py index 7f44535e..db365b89 100644 --- a/tests/tl/test_report_dropped_lrs.py +++ b/tests/tl/test_report_dropped_lrs.py @@ -5,6 +5,7 @@ import unittest import numpy as np + from stlearn.tl.cci import LRPairs from stlearn.tl.cci.analysis import _report_dropped_lrs from tests.utils import spot_table From 1991c389650eb0eb362ef18725f9ff8ea0d72737 Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Tue, 10 Nov 2026 17:08:28 +1000 Subject: [PATCH 7/7] Remove. --- tests/acceptance-results/benchmark.json | 32 ---------- tests/acceptance-results/history.csv | 59 ------------------- .../trajectory_benchmark.json | 22 ------- .../acceptance-results/trajectory_history.csv | 5 -- 4 files changed, 118 deletions(-) delete mode 100644 tests/acceptance-results/benchmark.json delete mode 100644 tests/acceptance-results/history.csv delete mode 100644 tests/acceptance-results/trajectory_benchmark.json delete mode 100644 tests/acceptance-results/trajectory_history.csv diff --git a/tests/acceptance-results/benchmark.json b/tests/acceptance-results/benchmark.json deleted file mode 100644 index 3798f455..00000000 --- a/tests/acceptance-results/benchmark.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "name": "cci.run lit: time", - "unit": "s", - "value": 95.05016879201867 - }, - { - "name": "cci.run lit: peak memory", - "unit": "GB", - "value": 6.740997314453125 - }, - { - "name": "cci.run cell_types: time", - "unit": "s", - "value": 130.382964166929 - }, - { - "name": "cci.run cell_types: peak memory", - "unit": "GB", - "value": 6.8622894287109375 - }, - { - "name": "cci.run wide: time", - "unit": "s", - "value": 538.8811077499995 - }, - { - "name": "cci.run wide: peak memory", - "unit": "GB", - "value": 8.301010131835938 - } -] \ No newline at end of file diff --git a/tests/acceptance-results/history.csv b/tests/acceptance-results/history.csv deleted file mode 100644 index da715e27..00000000 --- a/tests/acceptance-results/history.csv +++ /dev/null @@ -1,59 +0,0 @@ -timestamp,scenario,outcome,wall_seconds,cpu_seconds,cores_busy,peak_memory_gb,memory_added_gb,warm_up_seconds,baseline_wall_seconds,baseline_peak_memory_gb,time_vs_baseline,memory_vs_baseline,phase_neighbours_seconds,phase_cell_type_counts_seconds,phase_lr_scores_seconds,phase_testing_seconds,phase_testing_backgrounds_seconds,bins,genes,lr_pairs_tested,n_pairs,platform,processor,cpus,numba_threads,python,numpy,numba -2026-11-07T03:04:39+00:00,lit,baseline written,2.587411000044085,4.635278,1.7914734071707288,1.5074462890625,0.65478515625,2.5051412080647424,,,,,0.04353420902043581,,0.36208075005561113,2.0643901670118794,1.0265651568770409,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:04:48+00:00,cell_types,baseline written,2.5174854160286486,4.590894,1.8236030170304494,1.48651123046875,0.6639251708984375,1.5770552909234539,,,,,0.04177745897322893,0.020291291060857475,0.32849183306097984,2.014433874981478,0.9927120809443295,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:05:04+00:00,wide,baseline written,8.978917666012421,19.098517,2.1270399964010074,1.7162628173828125,0.889434814453125,1.6518109170719981,,,,,0.08838962495792657,,0.6055773750413209,7.908081999979913,5.869499782565981,19881,18000,2817,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:08:57+00:00,lit,results identical,2.451069916016422,4.552456,1.857334207503487,1.5041961669921875,0.650054931640625,2.2795215839287266,2.587411000044085,1.5074462890625,0.947305981142795,0.9978439549761114,0.04186595801729709,,0.32062758307438344,1.9745924170129001,0.962420896277763,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:09:06+00:00,cell_types,results identical,2.486722292029299,4.5968800000000005,1.8485699085637342,1.4796142578125,0.6617584228515625,1.5896680420264602,2.5174854160286486,1.48651123046875,0.9877802175919339,0.9953602956271813,0.04279679199680686,0.021160083007998765,0.34233412507455796,1.9630085000535473,0.9515125739853829,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:09:20+00:00,wide,results identical,6.705105916946195,16.794638,2.5047535725802565,1.693450927734375,0.8704833984375,1.6070587079739198,8.978917666012421,1.7162628173828125,0.7467610425170502,0.9867083937160486,0.08465195901226252,,0.5385109580820426,5.705010041012429,3.763245989335701,19881,18000,2817,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:14:52+00:00,lit,results identical,2.4770534170093015,4.556195,1.8393608182664762,1.4765625,0.6582183837890625,1.5762339999200776,2.587411000044085,1.5074462890625,0.9573482593090532,0.9795125111345048,0.042509416001848876,,0.32936924998648465,1.9899796249810606,0.9660568104591221,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:15:02+00:00,cell_types,results identical,2.5690233329078183,4.632316000000001,1.8031428288962987,1.493072509765625,0.6662750244140625,1.8106412920169532,2.5174854160286486,1.48651123046875,1.0204719823006845,1.0044138780537877,0.043638709001243114,0.021112082991749048,0.33223704108968377,2.0526485410518944,1.006612385972403,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:15:16+00:00,wide,results identical,6.968096042051911,16.89802,2.425055552911696,1.690826416015625,0.8644561767578125,1.6240227919770405,8.978917666012421,1.7162628173828125,0.7760507781943472,0.9851791921904034,0.08467558398842812,,0.5410181659972295,5.950427416944876,3.973540292470716,19881,18000,2817,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:27:15+00:00,lit,results differ,1.4940424580127,2.655035999999999,1.7770820271945913,1.2474822998046875,0.4506072998046875,1.6938967499881983,2.587411000044085,1.5074462890625,0.5774275745087442,0.8275467649202365,0.02115133299957961,,0.19059033296070993,1.2204918750794604,0.5055825141025707,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:27:23+00:00,cell_types,results differ,1.473905541934073,2.6575360000000003,1.8030572003364314,1.2444305419921875,0.4477081298828125,1.5503987080883235,2.5174854160286486,1.48651123046875,0.5854673606249404,0.8371484294805994,0.02199758298229426,0.010075957980006933,0.1674333750270307,1.214617207995616,0.5025136355543509,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:27:34+00:00,wide,results differ,4.069111207965761,9.426134,2.3165093108163863,1.3428497314453125,0.5356292724609375,1.6317252910230309,8.978917666012421,1.7162628173828125,0.45318504516066827,0.7824266294442419,0.0425385000417009,,0.2728158750105649,3.5631852500373498,2.077467300929129,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:28:03+00:00,lit,baseline written,1.4935887919273227,2.695841999999999,1.8049425749381074,1.248321533203125,0.4488983154296875,1.6152503750054166,,,,,0.021982374950312078,,0.16793774999678135,1.2443855829769745,0.5227379261050373,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:28:12+00:00,cell_types,baseline written,1.5797163340030238,2.754545000000001,1.7436959666169587,1.2559661865234375,0.4528656005859375,1.8077722089365125,,,,,0.02644795796368271,0.01619558408856392,0.18970341701060534,1.2816322909202427,0.5443712281994522,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:28:25+00:00,wide,baseline written,5.006900292006321,10.243374000000001,2.0458514055799912,1.38507080078125,0.5391387939453125,2.3359329169616103,,,,,0.040191999985836446,,0.3682580830063671,4.407373000052758,2.897872197558172,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:28:41+00:00,lit,baseline written,1.479796166997403,2.6819869999999995,1.8124029915835742,1.255035400390625,0.45654296875,1.5541661250172183,,,,,0.021797249908559024,,0.16990091593470424,1.228709292015992,0.5200648892205209,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:28:48+00:00,cell_types,baseline written,1.490997040993534,2.700805000000001,1.8114086921328192,1.25616455078125,0.455078125,1.5949852920603007,,,,,0.02119633392430842,0.010074791964143515,0.17222549999132752,1.228480999940075,0.5214829510077834,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:29:00+00:00,wide,baseline written,4.904397791950032,10.249707,2.0899012345253967,1.3427886962890625,0.538818359375,1.6113854170544073,,,,,0.04086579196155071,,0.30310016695875674,4.371265665977262,2.882193635450676,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:30:12+00:00,lit,baseline written,44.11461716610938,81.180083,1.8402082623617504,4.7789459228515625,2.968536376953125,1.5700593340443447,,,,,1.0990840840386227,,7.892799458000809,32.248711207997985,25.716971528716385,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:31:10+00:00,cell_types,baseline written,44.70824570802506,82.552032,1.846460998248966,4.6800689697265625,2.8700408935546875,1.6281344160670415,,,,,1.2040415409719571,0.5255072910804302,8.059877874911763,32.03226825001184,25.51387205743231,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:36:03+00:00,wide,baseline written,259.71012041694485,720.943076,2.775952954172832,6.9522857666015625,5.153106689453125,1.593925042077899,,,,,2.265329624991864,,17.89639300003182,229.18428649997804,205.54970502189826,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:37:22+00:00,lit,baseline written,42.81532624992542,81.07617400000001,1.8936250427413532,4.953887939453125,3.126373291015625,2.276383416960016,,,,,1.0678577090147883,,7.612674082978629,31.18503112497274,24.892180252354592,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:38:28+00:00,cell_types,baseline written,53.38549337501172,97.13535,1.8195083319294822,5.1231231689453125,3.3174285888671875,1.598115999950096,,,,,1.2400316660059616,0.5385529579361901,8.549231167067774,40.13849241705611,32.19979027530644,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:42:36+00:00,wide,baseline written,220.22714504098985,720.112139,3.2698609377421155,7.6418609619140625,5.839935302734375,1.7154929999960586,,,,,2.6003666250035167,,18.47071800008416,188.54784291691612,161.5068297284888,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:43:50+00:00,lit,results differ,2.411705582984723,4.466528,1.8520204255082546,1.473968505859375,0.6509246826171875,1.5698830420151353,42.81532624992542,4.953887939453125,0.05632809076139935,0.29753771661255846,0.04293229104951024,,0.3121656250441447,1.941416957997717,0.9371776459738612,19881,18000,1410,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:44:55+00:00,lit,baseline written,41.672592915943824,78.789626,1.8906821123159652,4.9074554443359375,3.0944061279296875,1.5570069999666885,,,,,1.0739432079717517,,7.640663458965719,30.120009625097737,23.879711303045042,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:45:49+00:00,cell_types,baseline written,42.124408166040666,79.817511,1.8948043301970066,5.0547027587890625,3.2559661865234375,1.5876610409468412,,,,,1.2162478329846635,0.5105545420665294,7.440117833088152,30.1455665420508,23.940629382035695,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T03:49:58+00:00,wide,baseline written,219.7571012909757,706.5373079999999,3.2150829431650036,7.636444091796875,5.8153533935546875,1.6356632499955595,,,,,2.8277141250437126,,15.081946416990831,191.43385670904536,163.67063869908452,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T05:04:07+00:00,lit,baseline written,41.410330292070284,78.328533,1.8915215707661048,4.42572021484375,2.62518310546875,1.4737763749435544,,,,,1.1888028749963269,,7.5521345409797505,32.289444166002795,25.661773402243853,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T05:05:02+00:00,cell_types,baseline written,42.97375549993012,80.83944699999999,1.8811352663867473,4.889312744140625,3.0730133056640625,1.5707281249342486,,,,,1.2512787919258699,0.5452950829640031,7.718583208043128,33.06140870798845,26.36278031708207,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T05:08:34+00:00,wide,baseline written,185.80988112499472,658.451016,3.543681380200973,6.7780303955078125,4.97564697265625,1.496061083045788,,,,,2.456929916050285,,15.168929834035225,166.746047582943,143.07260719977785,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T10:36:01+00:00,lit,baseline written,42.78645479190163,79.801899,1.8651206179181836,4.631622314453125,2.8153839111328125,2.169981374987401,,,,,0.5255879579344764,,8.057938375044614,33.86328974994831,27.111842768266797,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T10:37:03+00:00,cell_types,baseline written,49.86207212496083,93.438806,1.8739455064328296,4.42242431640625,2.6005401611328125,1.4908102090703323,,,,,0.6445691250264645,0.5818333750357851,8.39332262496464,39.79096966597717,31.983781708520837,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T10:41:06+00:00,wide,baseline written,216.72740395902656,734.462458,3.388876739089506,5.6401214599609375,3.82086181640625,1.5329082499956712,,,,,2.7435951670631766,,21.183328000013717,191.09151312499307,162.7996038791025,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T11:10:59+00:00,lit,baseline written,40.830831874976866,78.122616,1.91332413307693,4.7761688232421875,2.966705322265625,1.419359082938172,,,,,0.516901999944821,,7.704313457943499,32.16578262497205,25.67418439127505,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T11:11:52+00:00,cell_types,baseline written,41.25652495806571,78.89762300000001,1.9123671487163247,4.7223663330078125,2.9062347412109375,1.4516933329869062,,,,,0.5092751660849899,0.06505166704300791,7.803363792016171,32.4470559170004,25.94578122533858,499849,18000,3337,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T11:15:46+00:00,wide,baseline written,207.55711712501943,694.214826,3.344692948215543,5.6932373046875,3.88507080078125,1.4570878749946132,,,,,2.214875250007026,,16.42280420800671,187.04624699999113,160.4545534978388,499849,18000,3540,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T11:24:22+00:00,lit,baseline written,93.69237779197283,174.003666,1.8571805956973793,7.0041961669921875,4.1408843994140625,1.4839816250605509,,,,,1.0170044999103993,,15.786770957987756,76.1332216670271,64.35046036809217,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T11:26:17+00:00,cell_types,baseline written,99.19173862505704,185.94778,1.8746297078517717,7.42633056640625,4.56134033203125,1.4809171659871936,,,,,1.0161610830109566,0.12498995894566178,15.713294500019401,81.58194658404682,70.0210129627958,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T11:35:48+00:00,wide,baseline written,522.9244669579202,1597.086789,3.054144317038655,11.21826171875,8.382614135742188,1.4431132499594241,,,,,4.092293708003126,,31.125497375032865,484.3801675409777,425.9467072696425,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:19:15+00:00,lit,baseline written,91.10139358299784,170.762596,1.8744235327687593,6.7155303955078125,3.88385009765625,1.4452110829297453,,,,,1.0681097080232576,,15.317733459058218,74.05952420795802,62.62183288112283,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:21:39+00:00,cell_types,baseline written,127.20257158298045,225.67399699999999,1.774130775750723,6.9266510009765625,4.035003662109375,1.477659208001569,,,,,1.0367763750255108,0.12846795900259167,17.845520916976966,107.34738483396359,90.62902338861022,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:30:48+00:00,wide,baseline written,500.762316584005,1634.33809,3.2637002343722337,8.427505493164062,5.5780792236328125,1.4336376250721514,,,,,5.211701959022321,,43.41443204204552,449.14481099997647,390.05036241712514,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:35:47+00:00,lit,baseline written,89.75865824997891,169.383331,1.887097404333579,7.4330291748046875,4.5692291259765625,1.4103332500671968,,,,,1.0616080419858918,,15.29024187498726,72.76569941593334,61.52330457873177,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:37:56+00:00,cell_types,baseline written,111.39636787504423,204.086368,1.832073808985659,7.460052490234375,4.57867431640625,1.4466825829586014,,,,,1.045427167089656,0.12895991699770093,16.736161791952327,92.71898912510369,78.8731977356365,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:47:06+00:00,wide,baseline written,506.62956495804247,1652.7405119999999,3.262226735893068,8.466323852539062,5.6315460205078125,1.4561966250184923,,,,,4.617148749995977,,43.08410158299375,456.0986349999439,394.01537925587036,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:50:38+00:00,lit,baseline written,105.69104562501889,193.056999,1.8266164163513592,7.379180908203125,4.5138092041015625,1.4036874580197036,,,,,1.0033117909915745,,15.13030375004746,88.53493670909666,75.23605869500898,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T12:53:08+00:00,cell_types,baseline written,128.09675762499683,234.78041199999998,1.8328364929213858,7.532806396484375,4.6649932861328125,1.7268955840263516,,,,,1.5840522920479998,0.19112962496001273,23.275798332993872,102.14762466703542,85.95631689648144,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-07T13:01:43+00:00,wide,baseline written,468.4684288749704,1591.577659,3.3974064438497655,9.044479370117188,6.1992034912109375,1.5722139169229195,,,,,5.869669665931724,,42.31021187501028,417.21483537508175,362.3599272336578,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T10:49:11+00:00,lit,baseline written,1.5356784160248935,2.748583000000001,1.7898167815073636,1.2537078857421875,0.457733154296875,1.594719041022472,,,,,0.009492625016719103,,0.17444454098585993,1.339326582965441,0.5761811275733635,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T10:49:19+00:00,cell_types,baseline written,1.4003495411016047,2.571764000000001,1.836515758756122,1.2494049072265625,0.460540771484375,1.4719612910412252,,,,,0.009830042021349072,0.0013399580493569374,0.16845008300151676,1.2104099169373512,0.5014314583968371,10000,18000,911,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T10:49:29+00:00,wide,baseline written,4.170248916954733,9.526668,2.2844362985787234,1.3369140625,0.5429534912109375,1.4272570830071345,,,,,0.03528720897156745,,0.2769290000433102,3.8303892080439255,2.284982407116331,10000,18000,2341,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T10:50:38+00:00,lit,baseline written,8.263245332986116,15.381261000000002,1.8614067935995342,2.170654296875,1.19830322265625,1.4053635830059648,,,,,0.10047099995426834,,1.5422465419396758,6.556777499965392,4.318812339100987,99856,18000,2631,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T10:50:54+00:00,cell_types,baseline written,8.207559500006028,15.469563,1.8847944995084884,2.1564483642578125,1.182586669921875,1.3880479170475155,,,,,0.09553433302789927,0.012157374992966652,1.5123160000657663,6.525017583975568,4.320103782694787,99856,18000,2631,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T10:51:32+00:00,wide,baseline written,27.413256207946688,87.810462,3.2032116627774077,3.0412750244140625,2.0694732666015625,1.4163784579141065,,,,,0.37983558303676546,,2.5860791250597686,24.176291416981257,19.22427488840185,99856,18000,3409,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T11:13:41+00:00,lit,baseline written,95.05016879201867,174.55589,1.83646059989593,6.740997314453125,4.42950439453125,1.534952750080265,,,,,1.0702555839670822,,15.416576791089028,77.8209664169699,65.9255551128881,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T11:16:09+00:00,cell_types,baseline written,130.382964166929,231.450815,1.7751614751116875,6.8622894287109375,3.981658935546875,1.5435699590016156,,,,,1.3095381669700146,0.19032041600439698,21.50005891697947,106.61575054202694,91.01664831337985,1000000,18000,3453,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 -2026-11-08T12:05:34+00:00,wide,baseline written,538.8811077499995,1707.675988,3.168929033586076,8.301010131835938,5.4598846435546875,1.430953542003408,,,,,5.039811542024836,,39.993856040993705,490.2085397079354,424.4789078758331,1000000,18000,3546,1000,macOS-27.0.1-arm64-arm-64bit,arm64,10,10,3.12.12,2.4.4,0.65.0 diff --git a/tests/acceptance-results/trajectory_benchmark.json b/tests/acceptance-results/trajectory_benchmark.json deleted file mode 100644 index 3868c42c..00000000 --- a/tests/acceptance-results/trajectory_benchmark.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "name": "trajectory clusters_12: time", - "unit": "s", - "value": 1.3604363750200719 - }, - { - "name": "trajectory clusters_12: peak memory", - "unit": "GB", - "value": 0.75604248046875 - }, - { - "name": "trajectory clusters_30: time", - "unit": "s", - "value": 180.21018641709816 - }, - { - "name": "trajectory clusters_30: peak memory", - "unit": "GB", - "value": 0.760894775390625 - } -] \ No newline at end of file diff --git a/tests/acceptance-results/trajectory_history.csv b/tests/acceptance-results/trajectory_history.csv deleted file mode 100644 index 6d266c92..00000000 --- a/tests/acceptance-results/trajectory_history.csv +++ /dev/null @@ -1,5 +0,0 @@ -timestamp,scenario,outcome,wall_seconds,cpu_seconds,peak_memory_gb,pseudotime_seconds,pseudotimespace_global_seconds,warm_up_seconds,baseline_wall_seconds,baseline_peak_memory_gb,time_vs_baseline,memory_vs_baseline,phase_subclusters_seconds,phase_paga_seconds,phase_diffmap_seconds,phase_dpt_seconds,phase_available_paths_seconds,phase_global_level_seconds,bins,clusters,subclusters_kept,available_paths,lineage_outcomes,platform,cpus,python,networkx,scanpy -2026-11-07T03:05:33+00:00,clusters_12,baseline written,1.3917358750477433,1.3884809999999996,0.7701416015625,0.5911427079699934,0.00602174992673099,0.1225162090267986,,,,,0.19008754205424339,0.11008729203604162,0.10623916692566127,0.003575375070795417,0.04651879204902798,0.7979466641554609,19881,12,23,219,"{""NetworkXPointlessConcept: Connectivity is undefined for the null graph."": 12, ""OK"": 207}",macOS-27.0.1-arm64-arm-64bit,10,3.12.12,3.5,1.12.1 -2026-11-07T03:08:34+00:00,clusters_30,stopped at limit,180.19711387495045,,0.7665863037109375,,,,,,,,,,,,,,,30,,,{},darwin,,,, -2026-11-07T03:09:26+00:00,clusters_12,results identical,1.3604363750200719,1.36041,0.75604248046875,0.581157875014469,0.005809082998894155,0.1231100419536233,1.3917358750477433,0.7701416015625,0.9775104597152116,0.9816928197812649,0.1859595839632675,0.10663875006139278,0.10548845794983208,0.003333208034746349,0.045916917035356164,0.7768145388690755,19881,12,23,219,"{""NetworkXPointlessConcept: Connectivity is undefined for the null graph."": 12, ""OK"": 207}",macOS-27.0.1-arm64-arm-64bit,10,3.12.12,3.5,1.12.1 -2026-11-07T03:12:26+00:00,clusters_30,stopped at limit,180.21018641709816,,0.760894775390625,,,,,,,,,,,,,,,30,,,{},darwin,,,,