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_query# Install the developer version via GitHub
git clone https://github.com/mvinyard/AnnDataQuery.git; cd ./AnnDataQuery;
pip install -e .AnnData
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")import adata_query
key = "X_pca" # stored in adata.obsm
groupby = "cluster" # cell annotation in adata.obs
data = adata_query.fetch(
adata = adata,
key = key,
groupby = groupby,
)In this example, the returned data is now of type: List.
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.
For some data stored as np.ndarray.
For some data stored as np.ndarray.
adata_query.locate
adata_query.locateI don't anticipate this function to be widely used beyond its implementation in adata_query.fetch.
Example notebook
Try some examples in Google Colab:
Last updated
