Skip to content

Commit

Permalink
Import implementation of ExperimentAxisQuery.
Browse files Browse the repository at this point in the history
As discussed in #76,
the full implementation of `ExperientAxisQuery` should be provided by
the base SOMA implementation since it does not vary from storage engine
to storage engine. This copies most of the implementation from the
existing TileDB version, with some reorganization to make the main
query class a little smaller:

- Pulls more of the caching-specific behavior of join IDs into the
  `_JoinIDCache` class.
- Pulls more indexing-related work into the `_AxisIndexer` class.
  - Makes formerly-public `AxisIndexer` private.
    (If this should be public this can be easily reverted.)
  - Renames methods to `by_[axis]`.
  - Separates out index caching logic from main methods.
- Uses an `_Axis` enum internally for axis selection.
- Shortens `AxisQueryResult` name.
  • Loading branch information
thetorpedodog committed Jan 12, 2023
1 parent 12b033e commit b259155
Show file tree
Hide file tree
Showing 3 changed files with 480 additions and 28 deletions.
4 changes: 3 additions & 1 deletion python-spec/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ dependencies = [
"anndata",
"attrs>=22.1",
"numpy>=1.21",
"pandas",
"pyarrow",
"scipy",
"typing-extensions",
]
requires-python = "~=3.7"
Expand All @@ -32,5 +34,5 @@ single_line_exclusions = ["typing", "typing_extensions"]

[[tool.mypy.overrides]]
# These dependencies do not currently have canonical type stubs.
module = ["anndata", "pyarrow"]
module = ["anndata", "pandas", "pyarrow", "scipy"]
ignore_missing_imports = true
10 changes: 5 additions & 5 deletions python-spec/src/somacore/composed.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Implementations of the composed SOMA data types."""

from typing import Optional

from typing_extensions import Final

from somacore import _wrap
Expand Down Expand Up @@ -76,13 +74,15 @@ def axis_query(
self,
measurement_name: str,
*,
obs_query: Optional[axis.AxisQuery] = None,
var_query: Optional[axis.AxisQuery] = None,
obs_query: axis.AxisQuery = axis.AxisQuery(),
var_query: axis.AxisQuery = axis.AxisQuery(),
) -> query.ExperimentAxisQuery:
"""Creates an axis query over this experiment.
See :class:`query.ExperimentAxisQuery` for details on usage.
"""
raise NotImplementedError()
return query.ExperimentAxisQuery(
self, measurement_name, obs_query=obs_query, var_query=var_query
)

soma_type: Final = "SOMAExperiment"
Loading

0 comments on commit b259155

Please sign in to comment.