spatialdata-io 0.1.1__tar.gz → 0.1.3__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 (65) hide show
  1. spatialdata_io-0.1.3/.github/codecov.yml +17 -0
  2. spatialdata_io-0.1.3/.github/workflows/prepare_test_data.yaml +35 -0
  3. spatialdata_io-0.1.3/.github/workflows/release.yaml +31 -0
  4. spatialdata_io-0.1.1/.github/workflows/test_and_deploy.yaml → spatialdata_io-0.1.3/.github/workflows/test.yaml +19 -28
  5. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.gitignore +6 -2
  6. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.pre-commit-config.yaml +4 -4
  7. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/CHANGELOG.md +33 -1
  8. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/PKG-INFO +12 -9
  9. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/README.md +9 -7
  10. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/_version.py +2 -2
  11. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/api.md +33 -11
  12. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/conf.py +2 -0
  13. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/pyproject.toml +2 -1
  14. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/__init__.py +6 -0
  15. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/_constants/_constants.py +165 -0
  16. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/converters/legacy_anndata.py +4 -4
  17. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/experimental/__init__.py +2 -1
  18. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/_utils/_utils.py +18 -0
  19. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/cosmx.py +1 -1
  20. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/dbit.py +66 -35
  21. spatialdata_io-0.1.3/src/spatialdata_io/readers/iss.py +112 -0
  22. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/merscope.py +136 -44
  23. spatialdata_io-0.1.3/src/spatialdata_io/readers/seqfish.py +190 -0
  24. spatialdata_io-0.1.3/src/spatialdata_io/readers/stereoseq.py +341 -0
  25. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/visium.py +6 -0
  26. spatialdata_io-0.1.3/src/spatialdata_io/readers/visium_hd.py +380 -0
  27. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/xenium.py +91 -56
  28. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/tests/converters/test_legacy_anndata.py +2 -3
  29. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/tests/test_xenium.py +31 -0
  30. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.bumpversion.cfg +0 -0
  31. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.codecov.yaml +0 -0
  32. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.editorconfig +0 -0
  33. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.flake8 +0 -0
  34. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.github/workflows/build.yaml +0 -0
  35. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.mypy.ini +0 -0
  36. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/.readthedocs.yaml +0 -0
  37. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/LICENSE +0 -0
  38. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/Makefile +0 -0
  39. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/_static/.gitkeep +0 -0
  40. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/_templates/.gitkeep +0 -0
  41. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/_templates/autosummary/class.rst +0 -0
  42. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/changelog.md +0 -0
  43. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/contributing.md +0 -0
  44. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/extensions/.gitkeep +0 -0
  45. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/extensions/typed_returns.py +0 -0
  46. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/index.md +0 -0
  47. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/make.bat +0 -0
  48. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/references.bib +0 -0
  49. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/references.md +0 -0
  50. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/docs/template_usage.md +0 -0
  51. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/_constants/__init__.py +0 -0
  52. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/_constants/_enum.py +0 -0
  53. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/_docs.py +0 -0
  54. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/_utils.py +0 -0
  55. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/converters/__init__.py +0 -0
  56. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/__init__.py +0 -0
  57. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/_utils/__init__.py +0 -0
  58. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/_utils/_read_10x_h5.py +0 -0
  59. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/codex.py +0 -0
  60. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/curio.py +0 -0
  61. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/mcmicro.py +0 -0
  62. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/src/spatialdata_io/readers/steinbock.py +0 -0
  63. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/tests/__init__.py +0 -0
  64. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/tests/converters/__init__.py +0 -0
  65. {spatialdata_io-0.1.1 → spatialdata_io-0.1.3}/tests/test_basic.py +0 -0
@@ -0,0 +1,17 @@
1
+ # Based on pydata/xarray
2
+ codecov:
3
+ require_ci_to_pass: false
4
+
5
+ coverage:
6
+ status:
7
+ project:
8
+ default:
9
+ # Require 1% coverage, i.e., always succeed
10
+ target: 1
11
+ patch: false
12
+ changes: false
13
+
14
+ comment:
15
+ layout: "diff, flags, files"
16
+ behavior: once
17
+ require_base: false
@@ -0,0 +1,35 @@
1
+ name: Prepare test data
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ # uncomment and adjust the branch name if you need to add new datasets to the artifact
6
+ # push:
7
+ # branches:
8
+ # - main
9
+
10
+ jobs:
11
+ prepare-data:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - name: Download test datasets
18
+ run: |
19
+ mkdir -p ./data
20
+ cd ./data
21
+ curl -O https://cf.10xgenomics.com/samples/xenium/2.0.0/Xenium_V1_human_Breast_2fov/Xenium_V1_human_Breast_2fov_outs.zip
22
+ curl -O https://cf.10xgenomics.com/samples/xenium/2.0.0/Xenium_V1_human_Lung_2fov/Xenium_V1_human_Lung_2fov_outs.zip
23
+
24
+ - name: Unzip files
25
+ run: |
26
+ unzip ./data/Xenium_V1_human_Breast_2fov_outs.zip -d ./data/Xenium_V1_human_Breast_2fov_outs
27
+ unzip ./data/Xenium_V1_human_Lung_2fov_outs.zip -d ./data/Xenium_V1_human_Lung_2fov_outs
28
+ rm ./data/Xenium_V1_human_Breast_2fov_outs.zip
29
+ rm ./data/Xenium_V1_human_Lung_2fov_outs.zip
30
+
31
+ - name: Upload artifacts
32
+ uses: actions/upload-artifact@v3
33
+ with:
34
+ name: data
35
+ path: ./data
@@ -0,0 +1,31 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ release:
9
+ # requires that you have put your twine API key in your
10
+ # github secrets (see readme for details)
11
+ runs-on: ubuntu-latest
12
+ if: contains(github.ref, 'tags')
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v3
16
+
17
+ - name: Set up Python 3.10
18
+ uses: actions/setup-python@v4
19
+ with:
20
+ python-version: "3.10"
21
+
22
+ - name: Install hatch
23
+ run: pip install hatch
24
+
25
+ - name: Build project for distribution
26
+ run: hatch build
27
+
28
+ - name: Publish a Python distribution to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
30
+ with:
31
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -28,7 +28,7 @@ jobs:
28
28
  steps:
29
29
  - uses: actions/checkout@v2
30
30
  - name: Set up Python ${{ matrix.python }}
31
- uses: actions/setup-python@v2
31
+ uses: actions/setup-python@v4
32
32
  with:
33
33
  python-version: ${{ matrix.python }}
34
34
 
@@ -50,6 +50,21 @@ jobs:
50
50
  - name: Install dependencies
51
51
  run: |
52
52
  pip install --pre -e ".[dev,test]"
53
+
54
+ - name: Download artifact of test data
55
+ if: matrix.python == '3.10'
56
+ uses: dawidd6/action-download-artifact@v2
57
+ with:
58
+ workflow: prepare_test_data.yaml
59
+ name: data
60
+ path: ./data
61
+
62
+ - name: List the data directory
63
+ if: matrix.python == '3.10'
64
+ run: |
65
+ ls -l ./data
66
+ pwd
67
+
53
68
  - name: Test
54
69
  env:
55
70
  MPLBACKEND: agg
@@ -58,33 +73,9 @@ jobs:
58
73
  run: |
59
74
  pytest -v --cov --color=yes --cov-report=xml
60
75
  - name: Upload coverage to Codecov
61
- uses: codecov/codecov-action@v3.1.1
76
+ uses: codecov/codecov-action@v4
62
77
  with:
63
78
  name: coverage
64
79
  verbose: true
65
- deploy:
66
- # this will run when you have tagged a commit, starting with "v*"
67
- # and requires that you have put your twine API key in your
68
- # github secrets (see readme for details)
69
- needs: [test]
70
- runs-on: ubuntu-latest
71
- if: contains(github.ref, 'tags')
72
- steps:
73
- - name: Checkout code
74
- uses: actions/checkout@v3
75
-
76
- - name: Set up Python 3.10
77
- uses: actions/setup-python@v4
78
- with:
79
- python-version: "3.10"
80
-
81
- - name: Install hatch
82
- run: pip install hatch
83
-
84
- - name: Build project for distribution
85
- run: hatch build
86
-
87
- - name: Publish a Python distribution to PyPI
88
- uses: pypa/gh-action-pypi-publish@release/v1
89
- with:
90
- password: ${{ secrets.PYPI_API_TOKEN }}
80
+ env:
81
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -2,6 +2,7 @@
2
2
  .DS_Store
3
3
  *~
4
4
  *.tmp
5
+ temp/
5
6
 
6
7
  # Compiled files
7
8
  __pycache__/
@@ -31,6 +32,9 @@ __pycache__/
31
32
 
32
33
  # other
33
34
  _version.py
34
- .code-workspace
35
- temp/
36
35
  node_modules/
36
+ .code-workspace
37
+
38
+ # test datasets (e.g. Xenium ones)
39
+ data/
40
+ tests/data
@@ -7,7 +7,7 @@ default_stages:
7
7
  minimum_pre_commit_version: 2.16.0
8
8
  repos:
9
9
  - repo: https://github.com/psf/black
10
- rev: 24.3.0
10
+ rev: 24.4.2
11
11
  hooks:
12
12
  - id: black
13
13
  - repo: https://github.com/pre-commit/mirrors-prettier
@@ -23,7 +23,7 @@ repos:
23
23
  hooks:
24
24
  - id: isort
25
25
  - repo: https://github.com/pre-commit/mirrors-mypy
26
- rev: v1.9.0
26
+ rev: v1.10.0
27
27
  hooks:
28
28
  - id: mypy
29
29
  additional_dependencies: [numpy, types-PyYAML]
@@ -40,7 +40,7 @@ repos:
40
40
  - flake8-bugbear
41
41
  - flake8-blind-except
42
42
  - repo: https://github.com/pre-commit/pre-commit-hooks
43
- rev: v4.5.0
43
+ rev: v4.6.0
44
44
  hooks:
45
45
  - id: detect-private-key
46
46
  - id: check-ast
@@ -70,7 +70,7 @@ repos:
70
70
  - flake8-bugbear
71
71
  - flake8-blind-except
72
72
  - repo: https://github.com/asottile/pyupgrade
73
- rev: v3.15.1
73
+ rev: v3.16.0
74
74
  hooks:
75
75
  - id: pyupgrade
76
76
  args: [--py3-plus, --py39-plus, --keep-runtime-typing]
@@ -8,7 +8,39 @@ and this project adheres to [Semantic Versioning][].
8
8
  [keep a changelog]: https://keepachangelog.com/en/1.0.0/
9
9
  [semantic versioning]: https://semver.org/spec/v2.0.0.html
10
10
 
11
- ## [0.1.0] - 2024-03-24
11
+ ## [0.1.4] - xxxx-xx-xx
12
+
13
+ ## [0.1.3] - 2024-07-03
14
+
15
+ ### Added
16
+
17
+ - (Xenium) support reading multi-polygon selection files from the Xenium Explorer
18
+ - (ISS) An experimental loader to load elemental ISS data objects, e.g. raw.tif, label.tif and anndata.h5ad
19
+ - (Stereo-seq) Added reader @LLehner @timtreis @florianingelfinger #70
20
+ - (MERSCOPE) Optional rioxarray backend for MERSCOPE data (reads chunks)
21
+ - (MERSCOPE) Can choose which elements should be loaded
22
+
23
+ ### Fixed
24
+
25
+ - (Visium) Fixed issue with joining a SpatialElement with a table due to index values not being unique.
26
+ obs_names_make_unique is now called internally to enforce unique index values allowing for join operations.
27
+
28
+ ### Changed
29
+
30
+ - (MERSCOPE) "global" coordinate system is used as a default instead of "microns"
31
+
32
+ ## [0.1.2] - 2024-03-30
33
+
34
+ ### Added
35
+
36
+ - (Visium HD) added reader, coauthored by @LLehner
37
+
38
+ ### Fixed
39
+
40
+ - (Xenium) reader for 1.0.1 (paper data) and unknown versions
41
+ - (Xenium) fix in reading "minimalistic" Xenium datasets #132
42
+
43
+ ## [0.1.1] - 2024-03-24
12
44
 
13
45
  ### Added
14
46
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spatialdata-io
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: SpatialData IO for common techs
5
5
  Project-URL: Documentation, https://spatialdata-io.readthedocs.io/
6
6
  Project-URL: Source, https://github.com/scverse/spatialdata-io
@@ -46,8 +46,9 @@ Requires-Dist: joblib
46
46
  Requires-Dist: numpy
47
47
  Requires-Dist: pyarrow
48
48
  Requires-Dist: readfcs
49
+ Requires-Dist: scanpy
49
50
  Requires-Dist: scikit-image
50
- Requires-Dist: spatialdata
51
+ Requires-Dist: spatialdata>=0.1.2
51
52
  Provides-Extra: dev
52
53
  Requires-Dist: bump2version; extra == 'dev'
53
54
  Requires-Dist: pre-commit; extra == 'dev'
@@ -75,21 +76,23 @@ Description-Content-Type: text/markdown
75
76
  [![Documentation][badge-docs]][link-docs]
76
77
  [![DOI](https://zenodo.org/badge/544045123.svg)](https://zenodo.org/badge/latestdoi/544045123)
77
78
 
78
- [badge-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test_and_deploy.yaml/badge.svg
79
- [link-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test_and_deploy.yaml
79
+ [badge-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml/badge.svg
80
+ [link-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml
80
81
  [badge-docs]: https://img.shields.io/readthedocs/spatialdata-io
81
82
 
82
83
  This package contains reader functions to load common spatial omics formats into SpatialData. Currently, we provide support for:
83
84
 
84
- - NanoString CosMx
85
- - MCMICRO (output data)
86
- - Steinbock (output data)
87
85
  - 10x Genomics Visium
86
+ - 10x Genomics Visium HD
88
87
  - 10x Genomics Xenium
89
- - Curio Seeker
90
88
  - Akoya PhenoCycler (formerly CODEX)
91
- - Vizgen MERSCOPE (MERFISH)
89
+ - Curio Seeker
92
90
  - DBiT-seq
91
+ - MCMICRO (output data)
92
+ - NanoString CosMx
93
+ - Steinbock (output data)
94
+ - STOmics Stereo-seq
95
+ - Vizgen MERSCOPE (MERFISH)
93
96
 
94
97
  ## Getting started
95
98
 
@@ -6,21 +6,23 @@
6
6
  [![Documentation][badge-docs]][link-docs]
7
7
  [![DOI](https://zenodo.org/badge/544045123.svg)](https://zenodo.org/badge/latestdoi/544045123)
8
8
 
9
- [badge-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test_and_deploy.yaml/badge.svg
10
- [link-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test_and_deploy.yaml
9
+ [badge-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml/badge.svg
10
+ [link-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml
11
11
  [badge-docs]: https://img.shields.io/readthedocs/spatialdata-io
12
12
 
13
13
  This package contains reader functions to load common spatial omics formats into SpatialData. Currently, we provide support for:
14
14
 
15
- - NanoString CosMx
16
- - MCMICRO (output data)
17
- - Steinbock (output data)
18
15
  - 10x Genomics Visium
16
+ - 10x Genomics Visium HD
19
17
  - 10x Genomics Xenium
20
- - Curio Seeker
21
18
  - Akoya PhenoCycler (formerly CODEX)
22
- - Vizgen MERSCOPE (MERFISH)
19
+ - Curio Seeker
23
20
  - DBiT-seq
21
+ - MCMICRO (output data)
22
+ - NanoString CosMx
23
+ - Steinbock (output data)
24
+ - STOmics Stereo-seq
25
+ - Vizgen MERSCOPE (MERFISH)
24
26
 
25
27
  ## Getting started
26
28
 
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.1.1'
16
- __version_tuple__ = version_tuple = (0, 1, 1)
15
+ __version__ = version = '0.1.3'
16
+ __version_tuple__ = version_tuple = (0, 1, 3)
@@ -15,29 +15,39 @@ I/O for the `spatialdata` project.
15
15
  :toctree: generated
16
16
 
17
17
  codex
18
- curio
19
18
  cosmx
19
+ curio
20
+ dbit
21
+ mcmicro
22
+ merscope
23
+ seqfish
24
+ steinbock
25
+ stereoseq
20
26
  visium
27
+ visium_hd
21
28
  xenium
22
- steinbock
23
- merscope
24
- mcmicro
25
- dbit
26
29
  ```
27
30
 
28
- ### Conversion functions
29
-
30
- ### Utility functions
31
+ ### Experimental readers
31
32
 
32
33
  ```{eval-rst}
34
+ .. currentmodule:: spatialdata_io.experimental
35
+
33
36
  .. autosummary::
34
37
  :toctree: generated
35
38
 
36
- xenium_aligned_image
37
- xenium_explorer_selection
39
+ iss
38
40
  ```
39
41
 
40
- ### Experimental readers
42
+ ### Conversion functions
43
+
44
+ ```{eval-rst}
45
+ .. currentmodule:: spatialdata_io
46
+
47
+ .. autosummary::
48
+ :toctree: generated
49
+
50
+ ```
41
51
 
42
52
  ### Experimental conversion functions
43
53
 
@@ -50,3 +60,15 @@ I/O for the `spatialdata` project.
50
60
  from_legacy_anndata
51
61
  to_legacy_anndata
52
62
  ```
63
+
64
+ ### Utility functions
65
+
66
+ ```{eval-rst}
67
+ .. currentmodule:: spatialdata_io
68
+
69
+ .. autosummary::
70
+ :toctree: generated
71
+
72
+ xenium_aligned_image
73
+ xenium_explorer_selection
74
+ ```
@@ -98,6 +98,7 @@ intersphinx_mapping = {
98
98
  "xarray": ("https://docs.xarray.dev/en/stable/", None),
99
99
  "datatree": ("https://datatree.readthedocs.io/en/latest/", None),
100
100
  "shapely": ("https://shapely.readthedocs.io/en/stable/", None),
101
+ "imageio": ("https://imageio.readthedocs.io/en/stable/", None),
101
102
  }
102
103
 
103
104
  # List of patterns, relative to source directory, that match files and
@@ -125,6 +126,7 @@ nitpick_ignore = [
125
126
  ("py:class", "Path"),
126
127
  ("py:class", "AnnData"),
127
128
  ("py:class", "SpatialData"),
129
+ ("py:func", "imageio.imread"), # maybe this can be fixed
128
130
  ]
129
131
 
130
132
 
@@ -24,7 +24,8 @@ urls.Home-page = "https://github.com/scverse/spatialdata-io"
24
24
  dependencies = [
25
25
  "anndata",
26
26
  "numpy",
27
- "spatialdata",
27
+ "scanpy",
28
+ "spatialdata>=0.1.2",
28
29
  "scikit-image",
29
30
  "h5py",
30
31
  "joblib",
@@ -6,8 +6,11 @@ from spatialdata_io.readers.curio import curio
6
6
  from spatialdata_io.readers.dbit import dbit
7
7
  from spatialdata_io.readers.mcmicro import mcmicro
8
8
  from spatialdata_io.readers.merscope import merscope
9
+ from spatialdata_io.readers.seqfish import seqfish
9
10
  from spatialdata_io.readers.steinbock import steinbock
11
+ from spatialdata_io.readers.stereoseq import stereoseq
10
12
  from spatialdata_io.readers.visium import visium
13
+ from spatialdata_io.readers.visium_hd import visium_hd
11
14
  from spatialdata_io.readers.xenium import (
12
15
  xenium,
13
16
  xenium_aligned_image,
@@ -16,16 +19,19 @@ from spatialdata_io.readers.xenium import (
16
19
 
17
20
  __all__ = [
18
21
  "curio",
22
+ "seqfish",
19
23
  "visium",
20
24
  "xenium",
21
25
  "codex",
22
26
  "cosmx",
23
27
  "mcmicro",
24
28
  "steinbock",
29
+ "stereoseq",
25
30
  "merscope",
26
31
  "xenium_aligned_image",
27
32
  "xenium_explorer_selection",
28
33
  "dbit",
34
+ "visium_hd",
29
35
  ]
30
36
 
31
37
  __version__ = version("spatialdata-io")
@@ -59,6 +59,36 @@ class CosmxKeys(ModeEnum):
59
59
  TARGET_OF_TRANSCRIPT = "target"
60
60
 
61
61
 
62
+ @unique
63
+ class SeqfishKeys(ModeEnum):
64
+ """Keys for *Spatial Genomics SeqFISH* formatted dataset."""
65
+
66
+ # file extensions
67
+ CSV_FILE = ".csv"
68
+ TIFF_FILE = ".tiff"
69
+ OME_TIFF_FILE = ".ome.tiff"
70
+ # file identifiers
71
+ SECTION = "section"
72
+ TRANSCRIPT_COORDINATES = "TranscriptCoordinates"
73
+ DAPI = "DAPI"
74
+ COUNTS_FILE = "CxG"
75
+ CELL_MASK_FILE = "CellMask"
76
+ CELL_COORDINATES = "CellCoordinates"
77
+ # transcripts
78
+ TRANSCRIPTS_X = "x"
79
+ TRANSCRIPTS_Y = "y"
80
+ FEATURE_KEY = "name"
81
+ INSTANCE_KEY_POINTS = "cell"
82
+ # cells
83
+ AREA = "area"
84
+ CELL_X = "center_x"
85
+ CELL_Y = "center_y"
86
+ # metadata
87
+ SPATIAL_KEY = "spatial"
88
+ REGION_KEY = "region"
89
+ INSTANCE_KEY_TABLE = "instance_id"
90
+
91
+
62
92
  @unique
63
93
  class XeniumKeys(ModeEnum):
64
94
  """Keys for *10X Genomics Xenium* formatted dataset."""
@@ -121,6 +151,10 @@ class XeniumKeys(ModeEnum):
121
151
  NUCLEUS_COUNT = "nucleus_count"
122
152
  Z_LEVEL = "z_level"
123
153
 
154
+ EXPLORER_SELECTION_X = "X"
155
+ EXPLORER_SELECTION_Y = "Y"
156
+ EXPLORER_SELECTION_KEY = "Selection"
157
+
124
158
 
125
159
  @unique
126
160
  class VisiumKeys(ModeEnum):
@@ -161,6 +195,79 @@ class SteinbockKeys(ModeEnum):
161
195
  LABEL_SUFFIX = ".tiff"
162
196
 
163
197
 
198
+ @unique
199
+ class StereoseqKeys(ModeEnum):
200
+ """Keys for *Stereo-seq* formatted dataset."""
201
+
202
+ # file extensions
203
+ GEF_FILE = ".gef"
204
+ TIF_FILE = ".tif"
205
+ # directories
206
+ MERGE = "01.merge"
207
+ COUNT_DIRECTORY = "02.count"
208
+ REGISTER = "03.register"
209
+ TISSUECUT = "04.tissuecut"
210
+ SPATIALCLUSTER = "05.spatialcluster"
211
+ SATURATION = "06.saturation"
212
+ CELLCUT = "041.cellcut"
213
+ CELLCLUSTER = "051.cellcluster"
214
+ # file identifiers
215
+ MASK_TIF = "_mask.tif"
216
+ REGIST_TIF = "_regist.tif"
217
+ TISSUE_TIF = "_tissue_cut.tif"
218
+ CELL_CLUSTER_H5AD = "cell.cluster.h5ad"
219
+ RAW_GEF = ".raw.gef"
220
+ CELLBIN_GEF = ".cellbin.gef"
221
+ TISSUECUT_GEF = ".tissuecut.gef"
222
+ TISSUE_GEM = ".tissue.gem.gz"
223
+ # transcripts
224
+ FEATURE_KEY = "gene"
225
+ GENE_NAME = "geneName"
226
+ CELL_COUNT = "cellCount"
227
+ MAX_MID_COUNT = "maxMIDcount"
228
+ GENE_EXP = "geneExp"
229
+ EXPRESSION = "expression"
230
+ EXON = "exon"
231
+ GENE_ID = "geneID"
232
+ GENE_EXP_EXON = "geneExpExon"
233
+ # cells
234
+ ID = "id"
235
+ CELL_ID = "cellID"
236
+ GENE_COUNT = "geneCount"
237
+ DNBCOUNT = "dnbCount"
238
+ CELL_AREA = "area"
239
+ CELL_TYPE_ID = "cellTypeID"
240
+ CLUSTER_ID = "clusterID"
241
+ CELL_BIN = "cellBin"
242
+ CELL_EXON = "cellExon"
243
+ CELL_DATASET = "cell"
244
+ GENE_EXON = "geneExon"
245
+ CELL_BORDER = "cellBorder"
246
+ CELL_EXP = "cellExp"
247
+ CELL_EXP_EXON = "cellExpExon"
248
+ PADDING_VALUE = 32767
249
+ # metadata
250
+ COUNT = "count"
251
+ EXP_COUNT = "expCount"
252
+ OFFSET = "offset"
253
+ COORD_X = "x"
254
+ COORD_Y = "y"
255
+ SPATIAL_KEY = "spatial"
256
+ REGION = "cells"
257
+ REGION_KEY = "region"
258
+ INSTANCE_KEY = "instance_id"
259
+ BLOCK_INDEX = "blockIndex"
260
+ BLOCK_SIZE = "blockSize"
261
+ CELL_TYPE_LIST = "cellTypeList"
262
+ # bin data and metadata
263
+ BIN1 = "bin1"
264
+ MIN_X = "minX"
265
+ MIN_Y = "minY"
266
+ MAX_X = "maxX"
267
+ MAX_Y = "maxY"
268
+ RESOLUTION = "resolution"
269
+
270
+
164
271
  @unique
165
272
  class McmicroKeys(ModeEnum):
166
273
  """Keys for *Mcmicro* formatted dataset."""
@@ -227,3 +334,61 @@ class DbitKeys(ModeEnum):
227
334
  BARCODE_POSITION = "barcode_list"
228
335
  # image
229
336
  IMAGE_LOWRES_FILE = "tissue_lowres_image.png"
337
+
338
+
339
+ @unique
340
+ class VisiumHDKeys(ModeEnum):
341
+ """Keys for *10X Genomics Visium hd* formatted dataset."""
342
+
343
+ # directories
344
+ SPATIAL = "spatial"
345
+ DEFAULT_BIN = "square_008um"
346
+ BIN_PREFIX = "square_"
347
+ MICROSCOPE_IMAGE = "microscope_image"
348
+ BINNED_OUTPUTS = "binned_outputs"
349
+
350
+ # counts and locations files
351
+ FILTERED_COUNTS_FILE = "filtered_feature_bc_matrix.h5"
352
+ RAW_COUNTS_FILE = "raw_feature_bc_matrix.h5"
353
+ TISSUE_POSITIONS_FILE = "tissue_positions.parquet"
354
+
355
+ # images
356
+ IMAGE_HIRES_FILE = "spatial/tissue_hires_image.png"
357
+ IMAGE_LOWRES_FILE = "spatial/tissue_lowres_image.png"
358
+ IMAGE_CYTASSIST = "spatial/cytassist_image.tiff"
359
+
360
+ # scalefactors
361
+ SCALEFACTORS_FILE = "scalefactors_json.json"
362
+
363
+ # scalefactors keys
364
+ SCALEFACTORS_HIRES = "tissue_hires_scalef"
365
+ SCALEFACTORS_LOWRES = "tissue_lowres_scalef"
366
+ SCALEFACTORS_SPOT_DIAMETER_FULLRES = "spot_diameter_fullres"
367
+ SCALEFACTORS_BIN_SIZE_UM = "bin_size_um"
368
+ SCALEFACTORS_MICRONS_PER_PIXEL = "microns_per_pixel"
369
+
370
+ # locations keys
371
+ LOCATIONS_X = "pxl_col_in_fullres"
372
+ LOCATIONS_Y = "pxl_row_in_fullres"
373
+ BARCODE = "barcode"
374
+ IN_TISSUE = "in_tissue"
375
+ ARRAY_ROW = "array_row"
376
+ ARRAY_COL = "array_col"
377
+
378
+ # table keys
379
+ REGION_KEY = "region"
380
+ INSTANCE_KEY = "location_id"
381
+
382
+ # feature slice file (it contains transformation matrices in the metadata)
383
+ FEATURE_SLICE_FILE = "feature_slice.h5"
384
+
385
+ # METADATA_KEYS
386
+ METADATA_JSON = "metadata_json"
387
+ HD_LAYOUT_JSON = "hd_layout_json"
388
+ TRANSFORM = "transform"
389
+ TRANSFORM_MATRICES = "transform_matrices"
390
+ CYTASSIST_COLROW_TO_SPOT_COLROW = ("cytassist_colrow_to_spot_colrow",)
391
+ SPOT_COLROW_TO_CYTASSIST_COLROW = ("spot_colrow_to_cytassist_colrow",)
392
+ MICROSCOPE_COLROW_TO_SPOT_COLROW = ("microscope_colrow_to_spot_colrow",)
393
+ SPOT_COLROW_TO_MICROSCOPE_COLROW = ("spot_colrow_to_microscope_colrow",)
394
+ FILE_FORMAT = "file_format"
@@ -8,7 +8,7 @@ from spatialdata import (
8
8
  SpatialData,
9
9
  get_centroids,
10
10
  get_extent,
11
- join_sdata_spatialelement_table,
11
+ join_spatialelement_table,
12
12
  to_circles,
13
13
  )
14
14
  from spatialdata._core.operations._utils import transform_to_data_extent
@@ -149,8 +149,8 @@ def to_legacy_anndata(
149
149
  shapes = to_circles(element)
150
150
  circles_sdata = SpatialData(tables={table_name: table}, shapes={region_name: shapes})
151
151
 
152
- joined_elements, new_table = join_sdata_spatialelement_table(
153
- sdata=circles_sdata, spatial_element_name=region_name, table_name=table_name, how="inner", match_rows="left"
152
+ joined_elements, new_table = join_spatialelement_table(
153
+ sdata=circles_sdata, spatial_element_names=region_name, table_name=table_name, how="inner", match_rows="left"
154
154
  )
155
155
 
156
156
  # the table after the filtering must not be empty
@@ -173,7 +173,7 @@ def to_legacy_anndata(
173
173
  sdata_images = sdata.subset(element_names=list(sdata.images.keys()))
174
174
  for image_name, image in sdata_images.images.items():
175
175
  sdata_pre_rasterize[image_name] = image
176
- bb = get_extent(sdata_images)
176
+ bb = get_extent(sdata_images, coordinate_system=coordinate_system)
177
177
 
178
178
  parameters_dict = {"x": "target_width", "y": "target_height", "z": "target_depth"}
179
179
  longest_side = max(bb, key=bb.get)