napari-spatialdata 0.7.0__tar.gz → 0.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/workflows/benchmarks.yml +3 -3
  2. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/workflows/benchmarks_report.yml +3 -3
  3. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/workflows/release.yml +1 -1
  4. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/workflows/test.yml +2 -2
  5. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.pre-commit-config.yaml +3 -3
  6. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.readthedocs.yaml +1 -1
  7. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/PKG-INFO +17 -17
  8. napari_spatialdata-0.7.2/docs/notebooks/mibitof_analysis.ipynb +250 -0
  9. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/notebooks/nanostring_analysis.ipynb +3 -43
  10. napari_spatialdata-0.7.2/docs/notebooks/spatialdata.ipynb +299 -0
  11. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/setup.cfg +3 -3
  12. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_model.py +0 -2
  13. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_scatterwidgets.py +8 -16
  14. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_sdata_widgets.py +57 -4
  15. napari_spatialdata-0.7.2/src/napari_spatialdata/_version.py +24 -0
  16. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_view.py +5 -13
  17. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_viewer.py +57 -14
  18. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_widgets.py +0 -7
  19. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/utils/_utils.py +55 -10
  20. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata.egg-info/PKG-INFO +17 -17
  21. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata.egg-info/SOURCES.txt +2 -0
  22. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata.egg-info/requires.txt +3 -3
  23. napari_spatialdata-0.7.2/src/napari_spatialdata.egg-info/scm_file_list.json +92 -0
  24. napari_spatialdata-0.7.2/src/napari_spatialdata.egg-info/scm_version.json +8 -0
  25. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/conftest.py +142 -1
  26. napari_spatialdata-0.7.2/tests/test_3d_visualization.py +350 -0
  27. napari_spatialdata-0.7.0/docs/notebooks/mibitof_analysis.ipynb +0 -435
  28. napari_spatialdata-0.7.0/docs/notebooks/spatialdata.ipynb +0 -567
  29. napari_spatialdata-0.7.0/src/napari_spatialdata/_version.py +0 -34
  30. napari_spatialdata-0.7.0/tests/test_3d_visualization.py +0 -161
  31. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/BENCHMARK_FAIL_TEMPLATE.md +0 -0
  32. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/dependabot.yml +0 -0
  33. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.github/release.yml +0 -0
  34. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.gitignore +0 -0
  35. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.mypy.ini +0 -0
  36. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/.napari/DESCRIPTION.md +0 -0
  37. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/LICENSE +0 -0
  38. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/MANIFEST.in +0 -0
  39. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/README.md +0 -0
  40. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/asv.conf.json +0 -0
  41. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/benchmarks/Readme.md +0 -0
  42. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/benchmarks/__init__.py +0 -0
  43. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/benchmarks/benchmark.in +0 -0
  44. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/benchmarks/benchmark.txt +0 -0
  45. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/benchmarks/benchmark_model.py +0 -0
  46. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/benchmarks/benchmark_qt_widget.py +0 -0
  47. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/Makefile +0 -0
  48. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/_static/.gitkeep +0 -0
  49. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/_templates/.gitkeep +0 -0
  50. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/_templates/autosummary/class.rst +0 -0
  51. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/api.md +0 -0
  52. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/changelog.md +0 -0
  53. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/cli.md +0 -0
  54. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/conf.py +0 -0
  55. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/contributing.md +0 -0
  56. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/extensions/typed_returns.py +0 -0
  57. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/index.md +0 -0
  58. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/limitations.md +0 -0
  59. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/make.bat +0 -0
  60. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/notebooks/scatterwidget.ipynb +0 -0
  61. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/notebooks/scatterwidget_annotation.ipynb +0 -0
  62. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/references.bib +0 -0
  63. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/docs/references.md +0 -0
  64. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/examples/spatialdata_empty.py +0 -0
  65. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/examples/spatialdata_visium.py +0 -0
  66. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/pyproject.toml +0 -0
  67. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/__init__.py +0 -0
  68. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/__main__.py +0 -0
  69. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_annotationwidgets.py +0 -0
  70. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_interactive.py +0 -0
  71. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/_reader.py +0 -0
  72. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/constants/__init__.py +0 -0
  73. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/constants/_constants.py +0 -0
  74. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/constants/_pkg_constants.py +0 -0
  75. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/constants/_utils.py +0 -0
  76. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/constants/config.py +0 -0
  77. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/napari.yaml +0 -0
  78. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/resources/exclamation.png +0 -0
  79. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/resources/icons8-home-48.png +0 -0
  80. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/resources/icons8-pencil-drawing-50.png +0 -0
  81. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/resources/icons8-polygon-80.png +0 -0
  82. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/resources/icons8-rectangle-48.png +0 -0
  83. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/utils/__init__.py +0 -0
  84. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/utils/_categoricals_utils.py +0 -0
  85. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/utils/_test_utils.py +0 -0
  86. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata/utils/_viewer_utils.py +0 -0
  87. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata.egg-info/dependency_links.txt +0 -0
  88. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata.egg-info/entry_points.txt +0 -0
  89. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/src/napari_spatialdata.egg-info/top_level.txt +0 -0
  90. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/__init__.py +0 -0
  91. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/plots/groundtruth/Images_can_add_element_image.png +0 -0
  92. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/plots/groundtruth/Images_can_add_element_label.png +0 -0
  93. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/plots/groundtruth/Images_can_add_element_multiple.png +0 -0
  94. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_cli.py +0 -0
  95. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_interactive.py +0 -0
  96. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_scatterwidgets.py +0 -0
  97. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_spatialdata.py +0 -0
  98. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_utils.py +0 -0
  99. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_view.py +0 -0
  100. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_viewer.py +0 -0
  101. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tests/test_widgets.py +0 -0
  102. {napari_spatialdata-0.7.0 → napari_spatialdata-0.7.2}/tox.ini +0 -0
@@ -170,7 +170,7 @@ jobs:
170
170
 
171
171
  fi
172
172
 
173
- - uses: actions/upload-artifact@v5
173
+ - uses: actions/upload-artifact@v7
174
174
  if: always()
175
175
  with:
176
176
  name: asv-benchmark-results-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.benchmark-name }}
@@ -182,13 +182,13 @@ jobs:
182
182
  if: always()
183
183
  steps:
184
184
  - name: Download artifact
185
- uses: actions/download-artifact@v6
185
+ uses: actions/download-artifact@v8
186
186
  with:
187
187
  pattern: asv-benchmark-results*
188
188
  path: asv_result
189
189
  merge-multiple: true
190
190
  - name: Upload artifact
191
- uses: actions/upload-artifact@v5
191
+ uses: actions/upload-artifact@v7
192
192
  with:
193
193
  name: asv-benchmark-results-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
194
194
  path: asv_result
@@ -24,7 +24,7 @@ jobs:
24
24
  runs-on: ubuntu-latest
25
25
  steps:
26
26
  - name: "Download artifact"
27
- uses: actions/github-script@v8
27
+ uses: actions/github-script@v9
28
28
  with:
29
29
  script: |
30
30
  let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
@@ -68,7 +68,7 @@ jobs:
68
68
 
69
69
  - name: "Comment on PR"
70
70
  if: env.PR_NUMBER != ''
71
- uses: actions/github-script@v8
71
+ uses: actions/github-script@v9
72
72
  with:
73
73
  github-token: ${{ secrets.GITHUB_TOKEN }}
74
74
  script: |
@@ -84,7 +84,7 @@ jobs:
84
84
 
85
85
  - name: "Remove run-benchmarks label"
86
86
  if: env.PR_NUMBER != ''
87
- uses: actions/github-script@v8
87
+ uses: actions/github-script@v9
88
88
  with:
89
89
  github-token: ${{ secrets.GITHUB_TOKEN }}
90
90
  script: |
@@ -21,7 +21,7 @@ jobs:
21
21
 
22
22
  steps:
23
23
  - name: Download built artifact to dist/
24
- uses: actions/download-artifact@v6
24
+ uses: actions/download-artifact@v8
25
25
  with:
26
26
  name: Packages
27
27
  path: dist
@@ -62,11 +62,11 @@ jobs:
62
62
  PLATFORM: ${{ matrix.platform }}
63
63
 
64
64
  - name: Coverage
65
- uses: codecov/codecov-action@v5
65
+ uses: codecov/codecov-action@v6
66
66
 
67
67
  - name: Archive figures generated during testing
68
68
  if: always()
69
- uses: actions/upload-artifact@v5
69
+ uses: actions/upload-artifact@v7
70
70
  with:
71
71
  name: plotting-results-${{ matrix.python-version }}-${{ matrix.platform }}
72
72
  path: /Users/runner/work/napari-spatialdata/napari-spatialdata/tests/plots/generated/*
@@ -7,13 +7,13 @@ default_stages:
7
7
  minimum_pre_commit_version: 2.9.3
8
8
  repos:
9
9
  - repo: https://github.com/pre-commit/mirrors-mypy
10
- rev: v1.19.1
10
+ rev: v1.20.2
11
11
  hooks:
12
12
  - id: mypy
13
13
  additional_dependencies: [numpy>=1.23]
14
14
  exclude: docs
15
15
  - repo: https://github.com/psf/black-pre-commit-mirror
16
- rev: 25.12.0
16
+ rev: 26.3.1
17
17
  hooks:
18
18
  - id: black
19
19
  additional_dependencies: [toml]
@@ -49,7 +49,7 @@ repos:
49
49
  hooks:
50
50
  - id: blacken-docs
51
51
  - repo: https://github.com/astral-sh/ruff-pre-commit
52
- rev: v0.14.10
52
+ rev: v0.15.12
53
53
  hooks:
54
54
  - id: ruff
55
55
  args: [--fix, --exit-non-zero-on-fix]
@@ -12,7 +12,7 @@ python:
12
12
  - method: pip
13
13
  path: .
14
14
  extra_requirements:
15
- - "doc"
15
+ - "docs"
16
16
  - "all"
17
17
  - "readthedocs"
18
18
  - "pre"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: napari-spatialdata
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Interactive visualization of spatial omics data with napari
5
5
  Home-page: https://github.com/scverse/napari-spatialdata.git
6
6
  Author: giovanni palla
@@ -44,7 +44,7 @@ Requires-Dist: scanpy
44
44
  Requires-Dist: scipy
45
45
  Requires-Dist: shapely
46
46
  Requires-Dist: scikit-learn
47
- Requires-Dist: spatialdata>=0.7.0dev1
47
+ Requires-Dist: spatialdata>=0.7.2
48
48
  Requires-Dist: superqt
49
49
  Requires-Dist: typing_extensions>=4.8.0
50
50
  Requires-Dist: vispy
@@ -59,24 +59,24 @@ Requires-Dist: pytest-cov; extra == "test"
59
59
  Requires-Dist: pytest-mock; extra == "test"
60
60
  Requires-Dist: pytest-qt; extra == "test"
61
61
  Requires-Dist: pre-commit>=2.9.0; extra == "test"
62
- Provides-Extra: doc
63
- Requires-Dist: sphinx>=4.5; extra == "doc"
64
- Requires-Dist: sphinx-book-theme>=1.0.0; extra == "doc"
65
- Requires-Dist: myst-parser>=2.0.0; extra == "doc"
66
- Requires-Dist: sphinxcontrib-bibtex>=2.5.0; extra == "doc"
67
- Requires-Dist: sphinx-autodoc-typehints>=1.11.0; extra == "doc"
68
- Requires-Dist: sphinx-autobuild; extra == "doc"
69
- Requires-Dist: scanpydoc; extra == "doc"
70
- Requires-Dist: ipykernel; extra == "doc"
71
- Requires-Dist: ipython; extra == "doc"
72
- Requires-Dist: sphinx-copybutton; extra == "doc"
73
- Requires-Dist: sphinx-qt-documentation; extra == "doc"
74
- Requires-Dist: myst-nb>=1.0.0; extra == "doc"
75
- Requires-Dist: squidpy; extra == "doc"
62
+ Provides-Extra: docs
63
+ Requires-Dist: sphinx>=4.5; extra == "docs"
64
+ Requires-Dist: sphinx-book-theme>=1.0.0; extra == "docs"
65
+ Requires-Dist: myst-parser>=2.0.0; extra == "docs"
66
+ Requires-Dist: sphinxcontrib-bibtex>=2.5.0; extra == "docs"
67
+ Requires-Dist: sphinx-autodoc-typehints>=1.11.0; extra == "docs"
68
+ Requires-Dist: sphinx-autobuild; extra == "docs"
69
+ Requires-Dist: scanpydoc; extra == "docs"
70
+ Requires-Dist: ipykernel; extra == "docs"
71
+ Requires-Dist: ipython; extra == "docs"
72
+ Requires-Dist: sphinx-copybutton; extra == "docs"
73
+ Requires-Dist: sphinx-qt-documentation; extra == "docs"
74
+ Requires-Dist: myst-nb>=1.0.0; extra == "docs"
75
+ Requires-Dist: squidpy; extra == "docs"
76
76
  Provides-Extra: readthedocs
77
77
  Requires-Dist: pydantic>2; extra == "readthedocs"
78
78
  Provides-Extra: pre
79
- Requires-Dist: spatialdata>=0.7.0dev0; extra == "pre"
79
+ Requires-Dist: spatialdata>=0.7.3a1; extra == "pre"
80
80
  Provides-Extra: all
81
81
  Requires-Dist: napari[pyqt5]; extra == "all"
82
82
  Dynamic: license-file
@@ -0,0 +1,250 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "attachments": {},
5
+ "cell_type": "markdown",
6
+ "metadata": {},
7
+ "source": "# Analyse MIBI-TOF in Napari-SpatialData\n"
8
+ },
9
+ {
10
+ "attachments": {},
11
+ "cell_type": "markdown",
12
+ "metadata": {},
13
+ "source": "This tutorial shows how to load and analyse the MIBI-TOF dataset with the Napari-SpatialData plugin.\n"
14
+ },
15
+ {
16
+ "attachments": {},
17
+ "cell_type": "markdown",
18
+ "metadata": {},
19
+ "source": [
20
+ "## Import packages and data"
21
+ ]
22
+ },
23
+ {
24
+ "attachments": {},
25
+ "cell_type": "markdown",
26
+ "metadata": {},
27
+ "source": [
28
+ "There are two options to install napari-spatialdata:\n",
29
+ "\n",
30
+ "(1) Install [napari](https://napari.org/stable/tutorials/fundamentals/installation.html) \n",
31
+ "\n",
32
+ "(2a) Run `pip install napari-spatialdata`\n",
33
+ "\n",
34
+ "or, \n",
35
+ "\n",
36
+ "(2b) Clone this [repo](https://github.com/scverse/napari-spatialdata) and run `pip install -e .`"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 1,
42
+ "metadata": {},
43
+ "outputs": [],
44
+ "source": [
45
+ "%matplotlib inline\n",
46
+ "import matplotlib.pyplot as plt\n",
47
+ "from napari_spatialdata import Interactive\n",
48
+ "from spatialdata import SpatialData\n",
49
+ "import squidpy as sq\n",
50
+ "import scanpy as sc\n",
51
+ "\n",
52
+ "plt.rcParams['figure.figsize'] = (20, 20)"
53
+ ]
54
+ },
55
+ {
56
+ "attachments": {},
57
+ "cell_type": "markdown",
58
+ "metadata": {},
59
+ "source": [
60
+ "Please download the MIBI-TOF data from https://spatialdata.scverse.org/en/stable/tutorials/notebooks/datasets/README.html and adjust the variable containing the location of the .zarr file.\n",
61
+ "\n",
62
+ "Information regarding data licensing and attribution for the dataset listed above is available at: https://github.com/scverse/spatialdata-notebooks/tree/main/datasets."
63
+ ]
64
+ },
65
+ {
66
+ "attachments": {},
67
+ "cell_type": "markdown",
68
+ "metadata": {},
69
+ "source": [
70
+ "We will load the dataset from the filepath and create a {class}`spatialdata.SpatialData` object. We'll use this object with the class `Interactive` to visualise this dataset in Napari."
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "markdown",
75
+ "metadata": {},
76
+ "source": [
77
+ "FILE_PATH = \"tutorial_data/mibitof_data/data.zarr\" # Path to the data file. Change if your data is stored in a different location.\n",
78
+ "sdata = SpatialData.read(FILE_PATH)"
79
+ ]
80
+ },
81
+ {
82
+ "attachments": {},
83
+ "cell_type": "markdown",
84
+ "metadata": {},
85
+ "source": "To make it easier to analyse our data, we will filter the SpatialData object by the coordinate system \"point8\"."
86
+ },
87
+ {
88
+ "attachments": {},
89
+ "cell_type": "code",
90
+ "metadata": {},
91
+ "source": [
92
+ "sdata = sdata.filter_by_coordinate_system(\"point8\")\n",
93
+ "adata = sdata.table"
94
+ ],
95
+ "outputs": [],
96
+ "execution_count": null
97
+ },
98
+ {
99
+ "cell_type": "markdown",
100
+ "metadata": {},
101
+ "source": "The `scikit-misc package` could be required for highly variable genes identification."
102
+ },
103
+ {
104
+ "attachments": {},
105
+ "cell_type": "markdown",
106
+ "metadata": {},
107
+ "source": [
108
+ "Next, we will use the Scatter Widget offered by Napari SpatialData to visualize the UMAP coordinates.\n",
109
+ "\n",
110
+ "First, we instantiate the `Interactive` class with our {class}`spatialdata.SpatialData` object, and view it in Napari."
111
+ ]
112
+ },
113
+ {
114
+ "attachments": {},
115
+ "cell_type": "code",
116
+ "metadata": {},
117
+ "source": [
118
+ "interactive = Interactive(sdata)\n",
119
+ "interactive.run()"
120
+ ],
121
+ "outputs": [],
122
+ "execution_count": null
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": null,
127
+ "metadata": {},
128
+ "outputs": [],
129
+ "source": [
130
+ "plt.imshow(interactive.screenshot())\n",
131
+ "plt.axis('off')"
132
+ ]
133
+ },
134
+ {
135
+ "cell_type": "markdown",
136
+ "metadata": {},
137
+ "source": "We select the coordinate system \"point8\" and load the elements \"point8_image\" and \"point8_labels\" into the viewer."
138
+ },
139
+ {
140
+ "attachments": {},
141
+ "cell_type": "code",
142
+ "metadata": {},
143
+ "source": [
144
+ "plt.imshow(interactive.screenshot())\n",
145
+ "plt.axis('off')"
146
+ ],
147
+ "outputs": [],
148
+ "execution_count": null
149
+ },
150
+ {
151
+ "cell_type": "markdown",
152
+ "metadata": {},
153
+ "source": "Select \"point8_labels\" in the list of layers. Then, we open the \"Scatter\" Widget by using the menu bar and going to Plugins > napari-spatialdata > Scatter. This loads the AnnData object associated with that layer into the \"Scatter\" Widget."
154
+ },
155
+ {
156
+ "attachments": {},
157
+ "cell_type": "code",
158
+ "metadata": {},
159
+ "source": [
160
+ "plt.imshow(interactive.screenshot())\n",
161
+ "plt.axis('off')"
162
+ ],
163
+ "outputs": [],
164
+ "execution_count": null
165
+ },
166
+ {
167
+ "cell_type": "markdown",
168
+ "metadata": {},
169
+ "source": [
170
+ "Then, we can now pick specific x-axis, y-axis and color values to visualize in the scatterplot.\n",
171
+ "\n",
172
+ "In the example below, we're visualizing the UMAP (Uniform Manifold Approximation and Projection) coordinates of two different axes and coloring it by cell size."
173
+ ]
174
+ },
175
+ {
176
+ "attachments": {},
177
+ "cell_type": "code",
178
+ "metadata": {},
179
+ "source": [
180
+ "plt.imshow(interactive.screenshot())\n",
181
+ "plt.axis('off')"
182
+ ],
183
+ "outputs": [],
184
+ "execution_count": null
185
+ },
186
+ {
187
+ "cell_type": "markdown",
188
+ "metadata": {},
189
+ "source": [
190
+ "After plotting, it is possible to interactively select clusters and export it to AnnData.\n",
191
+ "\n",
192
+ "In the example below, we used the cursor to select a cluster on the left half of the scatterplot. We can export it into AnnData by clicking on the \"Annotate\" button."
193
+ ]
194
+ },
195
+ {
196
+ "attachments": {},
197
+ "cell_type": "code",
198
+ "metadata": {},
199
+ "source": [
200
+ "plt.imshow(interactive.screenshot())\n",
201
+ "plt.axis('off')"
202
+ ],
203
+ "outputs": [],
204
+ "execution_count": null
205
+ },
206
+ {
207
+ "cell_type": "markdown",
208
+ "metadata": {},
209
+ "source": "After exporting, we can now view the selected points with the View widget. Close the Scatter Widget and from the menu bar, go to Plugins > napari-spatialdata > View. You should be able to observe \"my_annotation\" under \"Observations:\". This is selected points we exported in the previous step."
210
+ },
211
+ {
212
+ "attachments": {},
213
+ "cell_type": "markdown",
214
+ "metadata": {},
215
+ "source": "Double clicking on \"my_annotation\" loads it as a layer in the Napari viewer."
216
+ },
217
+ {
218
+ "attachments": {},
219
+ "cell_type": "code",
220
+ "metadata": {},
221
+ "source": [
222
+ "plt.imshow(interactive.screenshot())\n",
223
+ "plt.axis('off')"
224
+ ],
225
+ "outputs": [],
226
+ "execution_count": null
227
+ }
228
+ ],
229
+ "metadata": {
230
+ "kernelspec": {
231
+ "display_name": "Python 3 (ipykernel)",
232
+ "language": "python",
233
+ "name": "python3"
234
+ },
235
+ "language_info": {
236
+ "codemirror_mode": {
237
+ "name": "ipython",
238
+ "version": 3
239
+ },
240
+ "file_extension": ".py",
241
+ "mimetype": "text/x-python",
242
+ "name": "python",
243
+ "nbconvert_exporter": "python",
244
+ "pygments_lexer": "ipython3",
245
+ "version": "3.10.14"
246
+ }
247
+ },
248
+ "nbformat": 4,
249
+ "nbformat_minor": 4
250
+ }
@@ -4,17 +4,13 @@
4
4
  "attachments": {},
5
5
  "cell_type": "markdown",
6
6
  "metadata": {},
7
- "source": [
8
- "# Analyse Nanostring data in Napari-SpatialData \n"
9
- ]
7
+ "source": "# Analyse Cosmx data in Napari-SpatialData\n"
10
8
  },
11
9
  {
12
10
  "attachments": {},
13
11
  "cell_type": "markdown",
14
12
  "metadata": {},
15
- "source": [
16
- "This tutorial shows how to load and analyse Nanostring data with the Napari-SpatialData plugin.\n"
17
- ]
13
+ "source": "This tutorial shows how to load and analyze Cosmx data with the Napari-SpatialData plugin.\n"
18
14
  },
19
15
  {
20
16
  "attachments": {},
@@ -60,43 +56,7 @@
60
56
  "attachments": {},
61
57
  "cell_type": "markdown",
62
58
  "metadata": {},
63
- "source": [
64
- "Next, we will download the Nanostring dataset (cosmx_io) for analysis. \n",
65
- "\n",
66
- "If on Windows, download the dataset from https://s3.embl.de/spatialdata/spatialdata-sandbox/cosmx_io.zip.\n",
67
- "\n",
68
- "In on Linux, uncomment the lines below to download the dataset. "
69
- ]
70
- },
71
- {
72
- "cell_type": "code",
73
- "execution_count": 2,
74
- "metadata": {},
75
- "outputs": [
76
- {
77
- "name": "stdout",
78
- "output_type": "stream",
79
- "text": [
80
- "--2023-05-03 21:11:58-- https://s3.embl.de/spatialdata/spatialdata-sandbox/cosmx_io.zip\n",
81
- "Resolving s3.embl.de (s3.embl.de)... 194.94.45.80\n",
82
- "Connecting to s3.embl.de (s3.embl.de)|194.94.45.80|:443... connected.\n",
83
- "HTTP request sent, awaiting response... 200 OK\n",
84
- "Length: 2210531049 (2,1G) [application/zip]\n",
85
- "Saving to: ‘tutorial_data/nanostring_data/cosmx_io.zip’\n",
86
- "\n",
87
- "cosmx_io.zip 100%[===================>] 2,06G 10,9MB/s in 3m 21s \n",
88
- "\n",
89
- "2023-05-03 21:15:19 (10,5 MB/s) - ‘tutorial_data/nanostring_data/cosmx_io.zip’ saved [2210531049/2210531049]\n",
90
- "\n"
91
- ]
92
- }
93
- ],
94
- "source": [
95
- "# !mkdir tutorial_data\n",
96
- "# !mkdir tutorial_data/nanostring_data\n",
97
- "# !wget -P tutorial_data/nanostring_data https://s3.embl.de/spatialdata/spatialdata-sandbox/cosmx_io.zip\n",
98
- "# !unzip tutorial_data/nanostring_data/cosmx_io.zip -d tutorial_data/nanostring_data"
99
- ]
59
+ "source": "Please download the CosMx raw data from https://brukerspatialbiology.com/products/cosmx-spatial-molecular-imager/ffpe-dataset/nsclc-ffpe-dataset/, parse it using `spatialdata_io` and save it to the SpatialData Zarr format (you can for instance [use this script](https://github.com/giovp/spatialdata-sandbox/blob/main/cosmx_io/to_zarr.py)).\n"
100
60
  },
101
61
  {
102
62
  "attachments": {},