Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new spatial foundational types #219

Merged
merged 24 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0c7f1c6
Add new spatial datatypes to SOMA
jp-dark Sep 13, 2024
7ccefb6
Update MultiscaleImage docstring and other small updates
jp-dark Sep 13, 2024
462678a
Move docstring updates
jp-dark Sep 13, 2024
5ed68f7
Update python-spec/src/somacore/spatialdata.py
jp-dark Sep 19, 2024
ff83352
Fix docstring for spatialdata read_region
jp-dark Sep 19, 2024
d681d32
Remove SpatialDataFrame from spec
jp-dark Sep 19, 2024
d520396
Rename `spatialdata.py` -> `spatialdata`
jp-dark Sep 24, 2024
616beaf
Add coordinate space to PointCloud and GeometryDataFrame
jp-dark Sep 24, 2024
4985a42
Remove the `extra_coords` param in `read_region`
jp-dark Sep 24, 2024
953512b
Rename param `transform` -> `region_transform` in `read_region`
jp-dark Sep 24, 2024
a881e0c
Match `axis_names` order in `MultiscaleImage` to `image_type` order
jp-dark Sep 24, 2024
b907c53
Fix typo in ValueError
jp-dark Sep 24, 2024
77a3a35
Drop `create_mask` option from `DenseArray.read_region`
jp-dark Sep 24, 2024
89e970b
Merge branch 'main' into dark/spatial-datatypes
jp-dark Sep 24, 2024
d2cb621
Fix shapely type for SpatialRegion
jp-dark Sep 25, 2024
78b980f
Run linters
jp-dark Sep 25, 2024
69c585c
Replace 'image_type' with 'axis_types'
jp-dark Sep 25, 2024
4f36f8e
Fix typo in docstring
jp-dark Sep 26, 2024
4843ba6
Add clarity to docstring
jp-dark Sep 26, 2024
5bd118a
Fix typos and improve clarity in docstrings
jp-dark Sep 26, 2024
0e8ee9b
Rename `read_region` to `read_spatial_region`
jp-dark Sep 26, 2024
76f07c7
Replace `_transformation_` with `_transform_` in method names
jp-dark Sep 26, 2024
e485020
Fix incomplete docstring
jp-dark Sep 26, 2024
531af3d
Expand spatial dataframe docstrings (#230)
aaronwolen Sep 26, 2024
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
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies = [
# Remove this once we can specify a recent pyarrow.
"pyarrow-hotfix",
"scipy",
"shapely",
"typing-extensions>=4.1", # For LiteralString (py3.11)
]
requires-python = ">=3.9"
Expand Down Expand Up @@ -62,5 +63,5 @@ python_version = 3.9

[[tool.mypy.overrides]]
# These dependencies do not currently have canonical type stubs.
module = ["anndata", "pyarrow", "pyarrow_hotfix", "scipy"]
module = ["anndata", "pyarrow", "pyarrow.compute", "pyarrow_hotfix", "scipy", "shapely"]
ignore_missing_imports = true
1 change: 1 addition & 0 deletions python-spec/requirements-py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pyarrow-hotfix==0.6
python-dateutil==2.9.0.post0
pytz==2024.1
scipy==1.13.1
shapely==2.0.4
six==1.16.0
typing_extensions==4.12.2
tzdata==2024.1
1 change: 1 addition & 0 deletions python-spec/requirements-py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pyarrow==16.1.0
pyarrow-hotfix==0.6
python-dateutil==2.9.0.post0
pytz==2024.1
shapely==2.0.4
scipy==1.13.1
six==1.16.0
typing_extensions==4.12.2
Expand Down
1 change: 1 addition & 0 deletions python-spec/requirements-py3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ python-dateutil==2.9.0.post0
pytz==2024.1
scipy==1.13.1
setuptools==70.0.0
shapely==2.0.4
six==1.16.0
typing_extensions==4.12.2
tzdata==2024.1
Expand Down
1 change: 1 addition & 0 deletions python-spec/requirements-py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pytz==2024.1
rsa==4.7.2
s3transfer==0.6.0
scipy==1.13.1
shapely==2.0.4
six==1.16.0
typing_extensions==4.12.2
tzdata==2024.1
11 changes: 11 additions & 0 deletions python-spec/src/somacore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
from .query import AxisColumnNames
from .query import AxisQuery
from .query import ExperimentAxisQuery
from .spatial import GeometryDataFrame
from .spatial import ImageProperties
from .spatial import MultiscaleImage
from .spatial import PointCloud
from .spatial import SpatialRead
from .types import ContextBase

try:
Expand All @@ -59,8 +64,14 @@
"ReadIter",
"SparseNDArray",
"SparseRead",
"SpatialRead",
"Experiment",
"Measurement",
"ImageProperties",
"MultiscaleImage",
"SpatialDataFrame",
"GeometryDataFrame",
"PointCloud",
"BatchSize",
"IOfN",
"ResultOrder",
Expand Down
10 changes: 10 additions & 0 deletions python-spec/src/somacore/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
import numpy as np
import numpy.typing as npt
import pyarrow as pa
import shapely
from typing_extensions import Final, Literal

from . import types

SOMA_JOINID: Final = "soma_joinid"
"""Global constant for the SOMA join ID."""

SOMA_GEOMETRY: Final = "soma_geometry"
"""Global constant for SOMA spatial geometry type."""

OpenMode = Literal["r", "w"]
"""How to open a SOMA object: read or write."""

Expand Down Expand Up @@ -177,5 +181,11 @@ class ResultOrder(enum.Enum):
pa.ChunkedArray,
]
"""A single coordinate range for one dimension of a sparse ndarray."""

SparseNDCoords = Sequence[SparseNDCoord]
"""A sequence of coordinate ranges for reading sparse ndarrays."""

SpatialRegion = Union[
Sequence[int], Sequence[float], shapely.geometry.base.BaseGeometry
]
"""A spatial region used for reading spatial dataframes and multiscale images."""
Loading
Loading