Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions src/squidpy/gr/_ppatterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,6 @@ def co_occurrence(
spatial_key: str = Key.obsm.spatial,
interval: int | NDArrayA = 50,
copy: bool = False,
n_splits: int | None = None,
n_jobs: int | None = None,
backend: str = "loky",
show_progress_bar: bool = True,
) -> tuple[NDArrayA, NDArrayA] | None:
"""
Compute co-occurrence probability of clusters.
Expand All @@ -365,10 +361,6 @@ def co_occurrence(
Distances interval at which co-occurrence is computed. If :class:`int`, uniformly spaced interval
of the given size will be used.
%(copy)s
n_splits
Number of splits in which to divide the spatial coordinates in
:attr:`anndata.AnnData.obsm` ``['{spatial_key}']``.
%(parallelize)s

Returns
-------
Expand Down Expand Up @@ -406,9 +398,7 @@ def co_occurrence(

# Compute co-occurrence probabilities using the fast numba routine.
out = _co_occurrence_helper(spatial_x, spatial_y, interval, labs)
start = logg.info(
f"Calculating co-occurrence probabilities for `{len(interval)}` intervals using `{n_jobs}` core(s) and `{n_splits}` splits"
)
start = logg.info(f"Calculating co-occurrence probabilities for `{len(interval)}` intervals")

if copy:
logg.info("Finish", time=start)
Expand Down
8 changes: 3 additions & 5 deletions tests/graph/test_ppatterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ def test_co_occurrence(adata: AnnData):
assert arr.shape[1] == arr.shape[0] == adata.obs["leiden"].unique().shape[0]


# @pytest.mark.parametrize(("ys", "xs"), [(10, 10), (None, None), (10, 20)])
@pytest.mark.parametrize(("n_jobs", "n_splits"), [(1, 2), (2, 2)])
def test_co_occurrence_reproducibility(adata: AnnData, n_jobs: int, n_splits: int):
def test_co_occurrence_reproducibility(adata: AnnData):
"""Check co_occurrence reproducibility results."""
arr_1, interval_1 = co_occurrence(adata, cluster_key="leiden", copy=True, n_jobs=n_jobs, n_splits=n_splits)
arr_2, interval_2 = co_occurrence(adata, cluster_key="leiden", copy=True, n_jobs=n_jobs, n_splits=n_splits)
arr_1, interval_1 = co_occurrence(adata, cluster_key="leiden", copy=True)
arr_2, interval_2 = co_occurrence(adata, cluster_key="leiden", copy=True)

np.testing.assert_array_equal(sorted(interval_1), sorted(interval_2))
np.testing.assert_allclose(arr_1, arr_2)
Expand Down