peach.tl.archetype_exclusive_patterns#
- peach.tl.archetype_exclusive_patterns(adata, *, data_obsm_key='pathway_scores', obs_key='archetypes', test_method='mannwhitneyu', fdr_method='benjamini_hochberg', fdr_scope='global', min_effect_size=0.05, min_cells=10, use_pairwise=True, verbose=True, **kwargs)[source]#
Identify features exclusively high in single archetypes.
Finds genes or pathways specifically elevated in only one archetype compared to all others. Supports two methods:
Pairwise (default): Tests each archetype vs every other archetype individually. Feature is exclusive if significantly higher vs ALL others. More stringent.
1-vs-all filtering: Tests each archetype vs all other cells. Feature is exclusive if significant in only ONE archetype’s test. More permissive, higher statistical power.
- Parameters:
adata (AnnData) – Annotated data object with archetypal assignments.
data_obsm_key (str, default: "pathway_scores") – Key in adata.obsm for scores. Use None for gene expression.
obs_key (str, default: "archetypes") – Column in adata.obs with archetypal assignments.
test_method (str, default: "mannwhitneyu") – Statistical test method.
fdr_method (str, default: "benjamini_hochberg") – FDR correction method.
fdr_scope ({'global', 'per_archetype', 'none'}, default: 'global') – Scope of FDR correction.
min_effect_size (float, default: 0.05) – Minimum effect size (mean_diff for pathways, log_fc for genes).
min_cells (int, default: 10) – Minimum cells per archetype.
use_pairwise (bool, default: True) – If True, use rigorous pairwise comparisons. If False, use 1-vs-all filtering.
verbose (bool, default: True) – Print progress.
- Returns:
Results with columns:
pathway/gene: Feature identifierarchetype: Exclusive archetypemean_archetype: Mean in exclusive archetypemean_other: Mean in other archetypesmean_diff/log_fold_change: Effect sizeexclusivity_score: Ratio vs max other archetypepvalue,fdr_pvalue,significantpattern_type: ‘exclusive’ or ‘exclusive_pairwise’
- Return type:
pd.DataFrame
Examples
>>> # Pairwise method (more stringent) >>> exclusive = pc.tl.archetype_exclusive_patterns(adata) >>> # 1-vs-all method (more permissive) >>> exclusive = pc.tl.archetype_exclusive_patterns(adata, use_pairwise=False) >>> # Find markers for specific archetype >>> arch3_markers = exclusive[exclusive["archetype"] == "archetype_3"] >>> top_markers = arch3_markers.nlargest(10, "exclusivity_score")
See also
peach.tl.pattern_analysisComprehensive pattern analysis
peach._core.types.ExclusivePatternResultResult row structure