dynamo.pp.pca_monocle(adata, X_data=None, n_pca_components=30, pca_key='X', pcs_key='PCs', genes_to_append=None, layer=None, return_all=False)[source]

Perform PCA reduction for monocle recipe.

  • adata (AnnData) – an AnnData object.

  • X_data (Optional[ndarray]) – the data to perform dimension reduction on. Defaults to None.

  • n_pca_components (int) – number of PCA components reduced to. Defaults to 30.

  • pca_key (str) – the key to store the reduced data. Defaults to “X”.

  • pcs_key (str) – the key to store the principle axes in feature space. Defaults to “PCs”.

  • genes_to_append (Optional[List[str]]) – a list of genes should be inspected. Defaults to None.

  • layer (Union[List[str], str, None]) – the layer(s) to perform dimension reduction on. Would be overrided by X_data. Defaults to None.

  • return_all (bool) – whether to return the PCA fit model and the reduced array together with the updated AnnData object. Defaults to False.

Return type:

Union[AnnData, Tuple[AnnData, Union[PCA, TruncatedSVD], ndarray]]


The the updated AnnData object with reduced data if return_all is False. Otherwise, a tuple (adata, fit, X_pca), where adata is the updated AnnData object, fit is the fit model for dimension reduction, and X_pca is the reduced array, will be returned.