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

[python] Allow obs_query=None/var_query=None in ExperimentAxisQuery #2476

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading