simba.tl.query
- simba.tl.query(adata, obsm='X_umap', layer=None, metric='euclidean', anno_filter=None, filters=None, entity=None, pin=None, k=20, use_radius=False, r=None, **kwargs)[source]
Query the “database” of entites
- Parameters:
adata (AnnData) – Anndata object to query.
obsm (str, optional (default: “X_umap”)) – The multi-dimensional annotation to use for calculating the distance.
layer (str, optional (default: None)) – The layer to use for calculating the distance.
metric (str, optional (default: “euclidean”)) – The distance metric to use. More metrics can be found at “DistanceMetric class”
anno_filter (str, optional (default: None)) – The annotation of filter to use. It should be one of
adata.obs_keys()
filters (list, optional (default: None)) – The filters to use. It should be a list of values in
adata.obs[anno_filter]
entity (list, optional (default: None)) – Query entity. It needs to be in
adata.obs_names()
k (int, optional (default: 20)) – The number of nearest neighbors to return. Only valid if
use_radius
is Falseuse_radius (bool, optional (default: False)) – If True, query for neighbors within a given radius
r (float, optional (default: None)) – Distance within which neighbors are returned. If None, it will be estimated based the range of the space.
**kwargs (dict, optional) – Extra arguments to
sklearn.neighbors.KDTree
.
- Returns:
updates adata with the following fields.
params (dict, (adata.uns[‘query’][‘params’])) – Parameters used for the query
output (pandas.DataFrame, (adata.uns[‘query’][‘output’])) – Query result.