Skip to content

Commit

Permalink
[python] Allow obs_query=None/var_query=None in `ExperimentAxisQu…
Browse files Browse the repository at this point in the history
…ery` (#2476) (#2478)

Co-authored-by: John Kerl <[email protected]>
  • Loading branch information
github-actions[bot] and johnkerl authored Apr 24, 2024
1 parent 8c7c3b7 commit deb863b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: mypy
additional_dependencies:
- "pandas-stubs==1.5.3.230214"
- "somacore==1.0.10"
- "somacore==1.0.11"
- "types-setuptools==67.4.0.3"
args: ["--config-file=apis/python/pyproject.toml", "apis/python/src", "apis/python/devtools"]
pass_filenames: false
3 changes: 2 additions & 1 deletion apis/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def run(self):
"pyarrow>=9.0.0; platform_system!='Darwin'",
"scanpy>=1.9.2",
"scipy",
"somacore==1.0.10",
# Note: the somacore version is in .pre-commit-config.yaml too
"somacore==1.0.11",
"tiledb~=0.28.0",
"typing-extensions", # Note "-" even though `import typing_extensions`
],
Expand Down
15 changes: 15 additions & 0 deletions apis/python/tests/test_experiment_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,21 @@ def test_experiment_query_none(soma_experiment):
assert len(query.X("raw").tables().concat()) == 0


@pytest.mark.parametrize("n_obs,n_vars", [(1001, 99)])
def test_experiment_axis_query_with_none(soma_experiment):
"""Test query by value filter"""
obs_label_values = ["3", "7", "38", "99"]

with soma.ExperimentAxisQuery(
experiment=soma_experiment,
measurement_name="RNA",
obs_query=soma.AxisQuery(value_filter=f"label in {obs_label_values}"),
var_query=None,
) as query:
assert query.n_obs == len(obs_label_values)
assert query.obs().concat()["label"].to_pylist() == obs_label_values


@pytest.mark.parametrize("n_obs,n_vars,X_layer_names", [(1001, 99, ["A"])])
def test_joinid_caching(soma_experiment):
"""
Expand Down

0 comments on commit deb863b

Please sign in to comment.