API overview

Import chrysalis as:

import chrysalis as ch

Core functions

Identifying spatially variable genes, dimensionality reduction, archetypal analysis.

Main functions required to identify tissue compartments.

detect_svgs(adata[, min_spots, top_svg, ...])

Calculate spatial autocorrelation (Moran's I) to define spatially variable genes.

pca(adata[, n_pcs])

Perform PCA (Principal Component Analysis) to calculate PCA coordinates, loadings, and variance decomposition.

aa(adata[, n_archetypes, pca_key, n_pcs, ...])

Run archetypal analysis on the low-dimensional embedding.

Plotting

Visualization module.

Tissue compartments

Visualizations to examine the identified compartments in the tissue space.

plot(adata[, dim, hexcodes, seed, ...])

Visualize tissue compartments using MIP (Maximum Intensity Projection).

plot_samples(adata, rows, cols, dim[, ...])

Visualize multiple samples from an AnnData object integrated with chrysalis.integrate_adatas in a single figure.

plot_compartment(adata, fig, ax, selected_dim)

Visualize individual tissue compartments.

plot_compartments(adata[, ncols, size, ...])

Visualize all compartments as individual subplots.

Quality control

Plot quality control metrics to determine the correct number of spatially variable genes or PCs (Principal Components).

plot_explained_variance(adata)

Plot the explained variance of the calculated PCs (Principal Components).

plot_svgs(adata)

Plot a rank-order chart displaying the Moran's I values.

Compartment-associated genes

Generate a visualization of the top-contributing genes for each tissue compartment.

plot_heatmap(adata[, figsize, ...])

Plot heatmap showing the weights of spatially variable genes for each identified tissue compartment.

plot_weights(adata[, hexcodes, seed, ...])

Plot 20 top genes for each tissue compartment.

Utility functions

Sample interation, spatially variable gene contributions.

integrate_adatas(adatas[, sample_names, ...])

Integrate multiple samples stored in AnnData objects.

harmony_integration(adata, covariates[, ...])

Integrate data using harmonypy, the Python implementation of the R package Harmony.

get_compartment_df(adata[, weights])

Get spatially variable gene weights/expression values as a pandas DataFrame.