cellflow.preprocessing.project_pca¶
- cellflow.preprocessing.project_pca(query_adata, ref_adata=None, ref_means=None, ref_pcs=None, layer=None, obsm_key_added='X_pca', copy=False)[source]¶
Projects the query data to the principal components of the reference data.
- Parameters:
query_adata (
AnnData) – AnAnnDataobject with the query data.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.obsm_key_added (
str) – Key inobsmto store the PCA coordinates.copy (bool)
- 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.