From deb863b2d4257d0d088bc7403f54b448ae42db39 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 15:04:07 -0400 Subject: [PATCH] [python] Allow `obs_query=None`/`var_query=None` in `ExperimentAxisQuery` (#2476) (#2478) Co-authored-by: John Kerl --- .pre-commit-config.yaml | 2 +- apis/python/setup.py | 3 ++- apis/python/tests/test_experiment_query.py | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d920d802c9..f06b1b7884 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/apis/python/setup.py b/apis/python/setup.py index ce0e0205ed..5cfe70762e 100644 --- a/apis/python/setup.py +++ b/apis/python/setup.py @@ -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` ], diff --git a/apis/python/tests/test_experiment_query.py b/apis/python/tests/test_experiment_query.py index fd1bccc671..5b889e86d6 100644 --- a/apis/python/tests/test_experiment_query.py +++ b/apis/python/tests/test_experiment_query.py @@ -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): """