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

how to list values for query filter ? #2761

Open
HugoCornu opened this issue Jun 27, 2024 · 1 comment
Open

how to list values for query filter ? #2761

HugoCornu opened this issue Jun 27, 2024 · 1 comment
Assignees

Comments

@HugoCornu
Copy link

For exemple, is it possible to list all the possible diseases or cell types that can be used in the obs_value_filter ? Ideally in python ?

@johnkerl
Copy link
Member

@HugoCornu we can put up a sample notebook -- for the moment though here's a snippet. The gist is, read as Pandas and use .groupby().

def count_obs(exp: tiledbsoma.Experiment, attr_name: str) -> None:
    print(
        exp.obs.read(column_names=[attr_name])
        .concat()
        .to_pandas()
        .groupby(attr_name)
        .size()
        .sort_values()
    )
>>> exp = tiledbsoma.Experiment.open(your_uri)
>>> exp.obs.schema
soma_joinid: int64 not null
obs_id: large_string not null
...
cell_type: large_string not null
...
>>> count_obs(exp, 'cell_type')
cell_type
enteroendocrine cell of small intestine            18
paneth cell of epithelium of small intestine       34
transit amplifying cell of small intestine         53
smooth muscle fiber of ileum                       54
mast cell                                          92
endothelial cell of lymphatic vessel               96
pericyte cell                                     121
glial cell                                        175
ileal goblet cell                                 230
progenitor cell                                   382
endothelial cell                                  565
fibroblast                                        571
enterocyte of epithelium proper of ileum          809
innate lymphoid cell                             1382
mononuclear phagocyte                            1635
B cell                                           3183
plasma cell                                      3898
native cell                                      4203
alpha-beta T cell                               14957
dtype: int64

@johnkerl johnkerl self-assigned this Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants