API Reference#

PEACH provides a scVerse-compatible API with three main modules:

peach.pp

Preprocessing functions for archetypal analysis.

peach.tl

Tools for archetypal analysis.

peach.pl

Plotting functions for archetypal analysis.

Preprocessing (pp)#

peach.pp.load_data(path[, use_raw, ...])

Load AnnData for archetypal analysis.

peach.pp.generate_synthetic([n_points, ...])

Generate synthetic convex data for testing.

peach.pp.prepare_training(adata[, ...])

Create DataLoader from AnnData for training with HPC optimizations.

peach.pp.load_pathway_networks([sources, ...])

Load pathway networks from MSigDB or OmniPath.

peach.pp.compute_pathway_scores(adata[, ...])

Compute pathway activity scores using MSigDB pathways.

Tools (tl)#

Training & Coordinates

peach.tl.train_archetypal(adata[, ...])

Train Deep Archetypal Analysis model to discover cellular archetypes.

peach.tl.hyperparameter_search(adata, *[, ...])

Perform cross-validation hyperparameter search for archetypal analysis.

peach.tl.archetypal_coordinates(adata, *[, ...])

Extract archetypal coordinates for all cells.

peach.tl.assign_archetypes(adata, *[, ...])

Assign cells to archetypes based on distances.

peach.tl.extract_archetype_weights(adata[, ...])

Extract cell archetype weights from trained Deep_AA model.

peach.tl.compute_conditional_centroids(...)

Compute centroid positions in PCA space for each level of a categorical condition.

peach.tl.assign_to_centroids(adata, ...[, ...])

Assign cells to nearest centroid based on distance (top bin_prop% closest).

Statistical Analysis

peach.tl.gene_associations(adata, *[, ...])

Test gene expression associations with archetypal assignments.

peach.tl.pathway_associations(adata, *[, ...])

Test pathway activity associations with archetypal assignments.

peach.tl.conditional_associations(adata, *, ...)

Test associations between archetypes and categorical metadata.

Pattern Analysis

peach.tl.pattern_analysis(adata, *[, ...])

Comprehensive archetypal pattern analysis.

peach.tl.archetype_exclusive_patterns(adata, *)

Identify features exclusively high in single archetypes.

peach.tl.specialization_patterns(adata, *[, ...])

Identify specialization features relative to centroid archetype.

peach.tl.tradeoff_patterns(adata, *[, ...])

Identify mutual exclusivity and tradeoff patterns.

CellRank Integration

peach.tl.setup_cellrank(adata[, ...])

Set up CellRank workflow for archetypal or centroid-based trajectory analysis.

peach.tl.compute_lineage_pseudotimes(adata)

Convert fate probabilities to lineage-specific pseudotimes.

peach.tl.compute_lineage_drivers(adata, lineage)

Identify genes driving commitment to a specific lineage.

peach.tl.compute_transition_frequencies(adata)

Compute frequency of transitions between archetypal states.

peach.tl.single_trajectory_analysis(adata, ...)

Analyze single archetype-to-archetype trajectory.

Plotting (pl)#

Core Visualizations

peach.pl.archetypal_space(adata, *[, ...])

Visualize cells in 3D archetypal coordinate space.

peach.pl.archetypal_space_multi(adata_list, *)

Compare multiple archetypal analysis fits in 3D PCA space.

peach.pl.training_metrics(history, *[, ...])

Visualize training metrics over epochs.

peach.pl.elbow_curve(cv_summary, *[, metrics])

Plot elbow curves for hyperparameter selection.

Archetype Analysis

peach.pl.archetype_positions(adata, *[, ...])

Visualize archetype positions in PCA space with distance matrix.

peach.pl.archetype_positions_3d(adata, *[, ...])

Visualize archetype positions in 3D PCA space.

peach.pl.archetype_statistics(adata, *[, ...])

Compute and display statistics about archetype positions.

peach.pl.dotplot(results_df, *[, x_col, ...])

Create dotplot visualization for statistical results.

Pattern Visualization

peach.pl.pattern_dotplot(pattern_df[, ...])

Create dotplot for pattern analysis results.

peach.pl.pattern_summary_barplot(pattern_results)

Create summary barplot showing pattern counts across different analyses.

peach.pl.pattern_heatmap(pattern_df, adata)

Create heatmap showing pattern expression across archetypes.

Trajectory Analysis

peach.pl.fate_probabilities(adata[, ...])

Plot fate probabilities on embedding.

peach.pl.lineage_drivers(adata, lineage[, ...])

Plot heatmap of top driver genes for a lineage.

Configuration#

peach.tl.SearchConfig([n_archetypes_range, ...])

Configuration for hyperparameter search space and CV settings.