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 #2473

Closed
johnkerl opened this issue Apr 23, 2024 · 0 comments
Closed

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

johnkerl opened this issue Apr 23, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request python-api

Comments

@johnkerl
Copy link
Member

johnkerl commented Apr 23, 2024

The default on var_query when it is unsupplied is
https://github.com/single-cell-data/SOMA/blob/python-v1.0.10/python-spec/src/somacore/query/query.py#L92
-- it is expecting axis.AxisQuery() as the 'unsupplied' value, rather than None

Users can avoid setting var_query=None, or, set var_query=tiledbsoma.AxisQuery()

But we should make it so that if users do pass var_query=None or obs_query=None, we can map that to AxisQuery() as the remaining code expects -- saying x=None is a common paradigm and we should let people say that.

Plan (FYI @ryan-williams ):

Repro script:

#!/usr/bin/env python

import tiledbsoma

soma_uri = "/whatever/path/to/pbmc3k"

obs_query = tiledbsoma.AxisQuery(value_filter='louvain == "B cells"')

with tiledbsoma.Experiment.open(soma_uri) as exp:
    query = tiledbsoma.ExperimentAxisQuery(
        experiment=exp,
        measurement_name="RNA",
        obs_query=obs_query,
        var_query=None, # setting this to None used to lead to an error
    )

query.to_anndata(
    "data",
    column_names=tiledbsoma.AxisColumnNames(obs=["soma_joinid", "obs_id", "louvain"], var=["soma_joinid", "var_id"]), 
    X_layers=()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python-api
Projects
None yet
Development

No branches or pull requests

1 participant