peach.tl.specialization_patterns

peach.tl.specialization_patterns#

peach.tl.specialization_patterns(adata, *, data_obsm_key='pathway_scores', obs_key='archetypes', test_method='mannwhitneyu', fdr_method='benjamini_hochberg', fdr_scope='global', min_cells=10, verbose=True, **kwargs)[source]#

Identify specialization features relative to centroid archetype.

Compares each archetype to archetype_0 (centroid/generalist) to find features representing specialized states or differentiation away from the central cellular state.

Parameters:
  • adata (AnnData) – Annotated data object with archetypal assignments.

  • data_obsm_key (str, default: "pathway_scores") – Key in adata.obsm for scores.

  • 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_cells (int, default: 10) – Minimum cells per archetype.

  • verbose (bool, default: True) – Print progress.

Returns:

Results showing specialization from archetype_0.

Return type:

pd.DataFrame

Notes

Archetype_0 typically represents the centroid or generalist state where cells have balanced contributions from all archetypes. Features elevated in other archetypes relative to archetype_0 represent specialized cellular programs.

Examples

>>> spec = pc.tl.specialization_patterns(adata)
>>> # Find archetype_4 specialization features
>>> arch4_spec = spec[(spec["archetype"] == "archetype_4") & (spec["significant"])]

See also

peach.tl.archetype_exclusive_patterns

Exclusive pattern analysis