xchrom.tl.calc_pca

xchrom.tl.calc_pca(ad: AnnData, max_value: float | None = None, n_comps: int | None = None) AnnData[source]

Calculate the PCA of the given data, and save the PCA components in .obsm[‘X_pca’].

Parameters:
  • ad (anndata.AnnData) – The data to calculate the PCA.

  • max_value (float = None) – The maximum value of the data.

  • n_comps (int = None) – The number of components to calculate.

Return type:

anndata.AnnData, With the PCA components in .obsm[‘X_pca’].

Examples

>>> ad = calc_pca(ad, max_value=10, n_comps=32)
>>> print(f"The PCA components are saved in ad.obsm['X_pca']")