Tools#
Point features#
Compute spatial summary statistics describing groups of molecules e.g. distance to the cell membrane, relative symmetry, dispersion, etc.
A list of available cell features and their names is stored in the dict :func:bt.tl.point_features
.
|
Calculate the set of specified features for each point group. |
|
Register a new point feature function. |
Shape features#
Compute spatial properties of shape features e.g. area, aspect ratio, etc. of the cell, nucleus, or other region of interest.
A list of available cell features and their names is stored in the dict :func:bt.tl.shape_features
.
|
Analyze features of shapes. |
|
Register a shape feature function. |
|
Compute features for each cell shape. |
RNAflux: Subcellular RNA embeddings and domains#
Methods for computing RNAflux embeddings and semantic segmentation of subcellular domains.
|
RNAflux: Embedding each pixel as normalized local composition normalized by cell composition. |
|
Cluster flux embeddings using self-organizing maps (SOMs) and vectorize clusters as Polygon shapes. |
|
Perform functional enrichment on point embeddings. |
|
Compute enrichment scores from subcellular compartment gene sets from Fazal et al. 2019 (APEX-seq). |
|
Load a gene set from bento. |
RNAforest: Predict RNA localization patterns#
Perform multilabel classification of RNA localization patterns using spatial summary statistics as features.
|
Predict transcript subcellular localization patterns. |
|
Computes frequencies of localization patterns across cells and genes. |
|
Gene-wise test for differential localization across phenotype of interest. |
Colocalization analysis#
Methods for colocalization analyses of gene pairs.
|
Decompose a tensor of pairwise colocalization quotients into signatures. |
|
Calculate pairwise gene colocalization quotient in each cell. |
Plotting#
Spatial plots#
These are convenient functions for quick 2D visualizations of cells, molecules, and embeddings. We generate matplotlib
style figures for accessible publication quality plots.
|
|
|
|
|
|
|
|
|
Plot fluxmap shapes in different colors. |
Shape features#
|
Plot shape statistic distributions for each cell. |
RNAflux#
|
Plot RNAflux summary with a radviz plot describing gene embedding across flux clusters. |
|
RNAforest#
|
Plot the pattern distribution of each group in a RadViz plot. |
|
Plot the cell fraction distribution of each pattern as a density plot. |
|
Plot pattern combination frequencies as an UpSet plot. |
|
Visualize gene pattern frequencies between groups of cells by plotting log2 fold change and -log10p, similar to volcano plot. |
Colocalization analysis#
|
Plot signatures for specified rank across each dimension. |
|
Plot error for each rank. |
|
Plot a heatmap representation of a loadings matrix, optionally z-scored and subsetted to the n_top rows of each factor. |
|
Plot colocation of signatures for specified rank across each dimension. |
Manipulating spatial data#
Convenient methods for setting, getting, and reformatting data.
|
Count points in shapes and add as layers to data. |
|
Returns a view of data within specified coordinates. |
|
Get points DataFrame synced to AnnData object. |
|
Get points metadata synced to AnnData object. |
|
Get a GeoSeries of Polygon objects from an AnnData object. |
|
Rename shape columns in adata.obs and points columns in adata.uns. |
|
Index points to shapes and add as columns to data.uns[points_key]. |
Read/Write#
|
Load bento processed AnnData object from h5ad. |
|
Write AnnData to h5ad. |
|
|
|
Prepare AnnData with molecule-level spatial data. |
Datasets#
|
Load a builtin dataset. |
Return DataFrame with info about builtin datasets. |
Utility functions#
|
Sync existing point sets and associated metadata with data.obs_names and data.var_names |
|
Convert data.obs scanpy columns to GeoPandas compatible types. |
|
Convert data.obs GeoPandas columns to string for compatibility with scanpy. |
|
Maps list of categorical labels to a color palette. |