🍑 PEACH Documentation#
Version: 0.3.0
Quick Start#
import peach as pc
import scanpy as sc
# Load and prepare data
adata = sc.read_h5ad('your_data.h5ad')
sc.pp.pca(adata, n_comps=50) # recommend using lowest n PCs that makes sense for your dataset for better results
# Train archetypal model
results = pc.tl.train_archetypal(adata, n_archetypes=5, n_epochs=100)
# Extract coordinates and assign cells
pc.tl.archetypal_coordinates(adata)
pc.tl.assign_archetypes(adata, percentage_per_archetype=0.15)
# Statistical analysis
gene_results = pc.tl.gene_associations(adata, fdr_scope='global')
# Visualize
pc.pl.archetypal_space(adata, color_by='archetypes').show()
See Installation for setup instructions.
Tutorials#
Interactive Jupyter notebooks walking through each analysis step:
Tutorial |
Description |
|---|---|
Data loading and preprocessing |
|
Cross-validation for optimal archetypes |
|
Training archetypal models |
|
Coordinate extraction and cell assignment |
|
Gene and pathway associations |
|
Trajectory analysis with CellRank |
|
07 pointed to a set of experimental features that are not yet ready for release, check back later |
|
Comprehensive visualization guide |
Workflow Scripts#
Standalone Python scripts for each workflow stage:
Script |
Purpose |
|---|---|
Data loading, QC, PCA |
|
Hyperparameter optimization |
|
Model training |
|
Coordinates and assignment |
|
Gene/pathway enrichment |
|
CellRank integration |
|
Visualization |
API Structure#
pp (5): load_data, generate_synthetic, prepare_training,
load_pathway_networks, compute_pathway_scores
tl (16): train_archetypal, hyperparameter_search, archetypal_coordinates,
assign_archetypes, extract_archetype_weights, gene_associations,
pathway_associations, pattern_analysis, conditional_associations,
archetype_exclusive_patterns, specialization_patterns, tradeoff_patterns,
setup_cellrank, compute_lineage_pseudotimes, compute_lineage_drivers,
compute_transition_frequencies
pl (14): archetypal_space, archetypal_space_multi, training_metrics,
elbow_curve, dotplot, archetype_positions, archetype_positions_3d,
archetype_statistics, pattern_dotplot, pattern_summary_barplot,
pattern_heatmap, fate_probabilities, gene_trends, lineage_drivers
Developer Reference#
For function signatures and return types, consult (in order):
src/peach/_core/types_index.py(~270 lines) - Function → return type mappingsrc/peach/_core/tools_schema.py(~1000 lines) - Function → input parameterssrc/peach/_core/types.py- Full Pydantic type definitions (grep as needed)