cellflow.preprocessing.centered_pca¶
- cellflow.preprocessing.centered_pca(adata, n_comps=50, layer=None, method='scanpy', keep_centered_data=True, copy=False, **kwargs)[source]¶
Performs PCA on the centered data matrix and stores the results in
obsm.- Parameters:
adata (
AnnData) – AnAnnDataobject.n_comps (
int) – Number of principal components to compute.layer (
str|None) – Layer inlayersto use for PCA. If None, uses adata.X.method (
str) – Method to use for PCA. If"rapids", usesrapids_singlecell.pp.pca()with GPU acceleration. Otherwise, usesscanpy.pp.pca().keep_centered_data (
bool) – Whether to keep the centered data. Set toFalseto save memory.copy (
bool) – Return a copy ofadatainstead of updating it in place.kwargs – Additional arguments to pass to
scanpy.pp.pca()orrapids_singlecell.pp.pca()
- Return type:
AnnData|None- Returns:
: If
copyisTrue, returns a newAnnDataobject with the PCA results stored inobsm. Otherwise, updatesadatain place.Sets the following fields:
.obsm["X_pca"]: PCA coordinates..varm["PCs"]: Principal components..varm["X_mean"]: Mean of the data matrix..layers["X_centered"]: Centered data matrix. # TODO adapt.uns['pca']['variance_ratio']: Variance ratio of each principal component..uns['pca']['variance']: Variance of each principal component.