Quick Start
This guide offers a brief overview of functionality
Install the library
The best way to interact with our API is to use one of our official libraries:
# Install via pip
pip install adata_queryAnnData
This package is downstream of data loading and assumes a generally typical implementation of adata created using the AnnData package or Scanpy.
import anndata
h5ad_path = "/path/to/your/adata.h5ad"
adata = anndata.read_h5ad(h5ad_path)Once you have some data, you are ready to interface with adata_query.
adata_query.fetch:
adata_query.fetch:This is probably the most useful function in the library and relies on the two functions, below. In short, this function takes a string and returns a matrix by the string, from adata. You can do this in grouped fashion, based on pd.groupby
import adata_query
key = "X_pca" # stored in adata.obsm
data = adata_query.fetch(adata = adata, key = "X_pca")adata_query.format_data
adata_query.format_dataThese functions seem trivial, but they become useful for adding flexibility into more complex workflows.
For some data stored as np.ndarray.
import adata_query
data = adata_query.format(data) # returns np.ndarrayadata_query.locate
adata_query.locateI don't anticipate this function to be widely used beyond its implementation in adata_query.fetch.
import adata_query
key = "X_pca"
attr_key = adata_query.locate(adata, key = key) # attr_key = "obsm"Example notebook
Try some examples in Google Colab:
Last updated
