API#

IO: io#

Tools for loading and saving Popari data and parameters.

io.save_anndata(filepath, datasets[, ...])

Save Popari state as AnnData object.

io.load_anndata(filepath)

Load AnnData object from h5ad file and reformat for Popari.

Model#

Entry points for implementations of the Popari algorithm.

model.Popari(K[, replicate_names, datasets, ...])

Popari optimization model.

model.load_trained_model(dataset_path[, context])

Load trained Popari model for downstream analysis.

Components#

Objects that are helpful for working with Popari.

components.PopariDataset(dataset, replicate_name)

Wrapper around AnnData object.

Analysis: tl#

Functions for visualizing and evaluating Popari results.

tl.preprocess_embeddings(datasets[, ...])

Normalize embeddings per each cell.

tl.leiden(datasets[, resolution, tolerance])

Compute Leiden clustering for all datasets.

tl.compute_ari_scores(dataset, labels, ...)

Compute adjusted Rand index (ARI) score between a set of ground truth labels and an unsupervised clustering.

tl.compute_silhouette_scores(dataset, ...[, ...])

Compute silhouette score for a clustering based on Popari embeddings.

tl.compute_empirical_correlations(trained_model)

Compute the empirical spatial correlation for a feature set across all datasets.

tl.propagate_labels(trained_model, label_key)

Propagate a label from the most binned layer to the least binned layer.

tl.metagene_gsea(trained_model, metagene_index)

Run GSEA on metagenes from trained model.

tl.find_differential_genes(trained_model[, ...])

Identify genes/features that distinguish differential metagenes within a group.

tl.plot_gene_activations(trained_model, ...)

Plot metagene activation heatmaps for target genes across all groups.

tl.plot_gene_trajectories(trained_model, ...)

Plot metagene activation lineplots for target genes across all groups.

tl.evaluate_classification_task(dataset, ...)

tl.compute_confusion_matrix(dataset, labels, ...)

Compute confusion matrix for labels and predictions.

tl.compute_columnwise_autocorrelation(dataset)

Plotting: pl#

Functions for visualizing and evaluating Popari results.

pl.in_situ(dataset[, axes, fig, color])

Plot a categorical label across all datasets in-situ.

pl.all_embeddings(trained_model[, ...])

Plot all learned metagenes in-situ across all replicates.

pl.metagene_embedding(datasets, metagene_index)

Plot a single metagene in-situ across all datasets.

pl.multireplicate_heatmap(datasets[, ...])

Plot 2D heatmap data across all datasets.

pl.multigroup_heatmap(trained_model[, ...])

Plot 2D heatmap data across all datasets.

pl.confusion_matrix(dataset, labels[, ax, ...])

pl.metagene_signature_enrichment(datasets, ...)

Plot enrichment of metagene signature across categories.

pl.clusters_to_categories(datasets, ...[, ...])

Plot clusters to category correspondence, based on category marker gene expression.

Simulation#

Tools to generate simulated (multisample) spatially-resolved transcriptomics, or (m)SRT.

simulation_framework.SimulationParameters([...])

Container for simulation parameters.

simulation_framework.SyntheticDataset(...[, ...])

Simulated spatial transcriptomics dataset.

simulation_framework.MultiReplicateSyntheticDataset(...)

Synthetic multireplicate dataset to model biological variation and batch effects in spatial transcriptomics data.