Skip to content

Commit

Permalink
Merge branch 'main' into deprecate_napari
Browse files Browse the repository at this point in the history
  • Loading branch information
giovp authored Oct 5, 2023
2 parents 7b742a9 + 6e9f0a9 commit 63b722b
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ default_stages:
minimum_pre_commit_version: 2.9.3
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies: [numpy, pandas, types-requests]
exclude: .scripts/ci/download_data.py|squidpy/datasets/_(dataset|image).py # See https://github.com/pre-commit/mirrors-mypy/issues/33
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
additional_dependencies: [toml]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
rev: v3.0.3
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -51,12 +51,12 @@ repos:
name: Check executable files use .sh extension
types: [shell, executable]
- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.281
rev: v0.0.292
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
19 changes: 18 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
|PyPI| |Downloads| |CI| |Docs| |Coverage| |Discourse| |Zulip|
|PyPI| |Downloads| |CI| |Docs| |Coverage| |Discourse| |Zulip| |NumFOCUS|

Squidpy - Spatial Single Cell Analysis in Python
================================================
Expand All @@ -10,6 +10,11 @@ tissue images if available.

Visit our `documentation`_ for installation, tutorials, examples and more.

Squidpy is part of the scverse project (`website`_, `governance`_) and is fiscally sponsored by `NumFOCUS`_.
Please consider making a tax-deductible `donation`_ to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.

|NumFOCUS logo|

Manuscript
----------
Please see our manuscript `Palla, Spitzer et al. (2022)`_ in **Nature Methods** to learn more.
Expand Down Expand Up @@ -69,9 +74,21 @@ We are happy about any contributions! Before you start, check out our `contribut
:target: https://scverse.zulipchat.com
:alt: Zulip

.. |NumFOCUS| image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
:target: http://numfocus.org
:alt: NumFOCUS

.. |NumFOCUS logo| image:: https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png
:target: https://numfocus.org/project/scverse
:width: 200

.. _Palla, Spitzer et al. (2022): https://doi.org/10.1038/s41592-021-01358-2
.. _scanpy: https://scanpy.readthedocs.io/en/stable/
.. _anndata: https://anndata.readthedocs.io/en/stable/
.. _napari: https://napari.org/
.. _skimage: https://scikit-image.org/
.. _documentation: https://squidpy.readthedocs.io/en/stable/
.. _website: https://scverse.org/
.. _governance: https://scverse.org/about/roles/
.. _NumFOCUS: https://numfocus.org/
.. _donation: https://numfocus.org/donate-to-scverse/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies = [
"numba>=0.56.4",
"numpy>=1.23.0",
"omnipath>=1.0.7",
"pandas>=1.5.0",
"pandas>=2.1.0",
"Pillow>=8.0.0",
"scanpy>=1.9.3",
"scikit-image>=0.19,<=0.20",
Expand Down
9 changes: 7 additions & 2 deletions src/squidpy/gr/_ligrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,13 @@ def find_min_gene_in_complex(_complex: str | None) -> str | None:
return complexes[0]

df = self._data[complexes].mean()

return str(df.index[df.argmin()])
try:
return str(df.index[df.argmin()])
except ValueError as e:
if "attempt to get argmin of an empty sequence" in str(e):
return str(df.index[0])
else:
logg.error(e)

if TYPE_CHECKING:
assert isinstance(self._interactions, pd.DataFrame)
Expand Down
2 changes: 1 addition & 1 deletion src/squidpy/gr/_ppatterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def co_occurrence(
labs_splits = tuple(s for s in np.array_split(labs, n_splits, axis=0) if len(s)) # type: ignore[arg-type]
# create idx array including unique combinations and self-comparison
x, y = np.triu_indices_from(np.empty((n_splits, n_splits))) # type: ignore[arg-type]
idx_splits = [(i, j) for i, j in zip(x, y)]
idx_splits = list(zip(x, y))

n_jobs = _get_n_cores(n_jobs)
start = logg.info(
Expand Down
2 changes: 1 addition & 1 deletion src/squidpy/im/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ def uncrop(

scales.discard(None)
if len(scales) != 1:
raise ValueError(f"Unable to uncrop images of different scales `{sorted((scales))}`.")
raise ValueError(f"Unable to uncrop images of different scales `{sorted(scales)}`.")
scale, *_ = scales

if shape is None:
Expand Down
Binary file modified tests/_data/ligrec_no_numba.pickle
Binary file not shown.
Binary file modified tests/_data/paul15_means.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/plotting/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_plot_cbar_kwargs(self, adata: AnnData):
gr.spatial_neighbors(adata)
gr.nhood_enrichment(adata, cluster_key=C_KEY)

pl.nhood_enrichment(adata, cluster_key=C_KEY, cbar_kwargs={"label": "FOOBARBAZQUUX", "filled": False})
pl.nhood_enrichment(adata, cluster_key=C_KEY, cbar_kwargs={"label": "FOOBARBAZQUUX"})


class TestLigrec(PlotTester, metaclass=PlotTesterMeta):
Expand Down

0 comments on commit 63b722b

Please sign in to comment.