vampire.anno.tl.motif_abundance_pca

vampire.anno.tl.motif_abundance_pca#

vampire.anno.tl.motif_abundance_pca(adata, layer=None, clr_transform=False, n_components=10)[source]#

PCA on motif abundance percentage vectors.

Row-normalises the motif abundance matrix to percentages, optionally applies a centered log-ratio (CLR) transform, then performs PCA. Results are stored in adata.obs, adata.var, and adata.uns.

Parameters:
  • adata (AnnData) – Annotated data with motif abundance in X or layers.

  • layer (str | None) – Layer key to use instead of adata.X.

  • clr_transform (bool) – If True, apply a centered log-ratio transform before PCA.

  • n_components (int) – Number of principal components to compute.

Returns:

The updated AnnData with PCA results.

Return type:

AnnData

Notes

Stores the following fields (following scanpy conventions):

  • obsm["X_motif_abundance_pca"] — PC coordinates (ndarray, n_obs × n_components)

  • varm["motif_abundance_PCs"] — motif loadings (ndarray, n_vars × n_components)

  • uns["motif_abundance_pca"] — PCA metadata (variance, variance_ratio)

Examples

>>> import vampire as vp
>>> adata = vp.datasets.wdr7_hprc()
>>> vp.anno.tl.motif_abundance_pca(adata)