cellflow.preprocessing.reconstruct_pca¶
- cellflow.preprocessing.reconstruct_pca(query_adata, use_rep='X_pca', ref_adata=None, ref_means=None, ref_pcs=None, layers_key_added='X_recon', copy=False)[source]¶
Performs PCA on the data matrix and projects the data to the principal components.
- Parameters:
query_adata (
AnnData) – AnAnnDataobject with the query data.use_rep (str) – Representation to use for PCA. If
'X', usesX. Otherwise, usesadata.obsm[use_rep].ref_adata (
AnnData|None) – AnAnnDataobject with the reference data containingadata.varm["X_mean"]andadata.varm["PCs"].ref_means (
ndarray[tuple[Any,...],dtype[float64]] |None) – Mean of the reference data. Only used ifref_adataisNone.ref_pcs (
ndarray[tuple[Any,...],dtype[float64]] |None) – Principal components of the reference data. Only used ifref_adataisNone.layers_key_added (
str) – Key inlayersto store the reconstructed data matrix.copy (
bool) – Return a copy ofadatainstead of updating it in place.
- Return type:
AnnData|None- Returns:
: If copy is
True, returns a newAnnDataobject with the PCA results stored inobsm. Otherwise, updatesadatain place.Sets the following fields:
.layers["X_recon"]: Reconstructed data matrix.