simba.pp.pca
- simba.pp.pca(adata, n_components=50, algorithm='randomized', n_iter=5, random_state=2021, tol=0.0, feature=None, **kwargs)[source]
perform Principal Component Analysis (PCA)
- Parameters:
adata (AnnData) – Annotated data matrix.
n_components (int, optional (default: 50)) – Desired dimensionality of output data
algorithm (str, optional (default: ‘randomized’)) – SVD solver to use. Choose from {‘arpack’, ‘randomized’}.
n_iter (int, optional (default: ‘5’)) – Number of iterations for randomized SVD solver. Not used by ARPACK.
tol (float, optional (default: 0)) – Tolerance for ARPACK. 0 means machine precision. Ignored by randomized SVD solver.
feature (str, optional (default: None)) – Feature used to perform PCA. The data type of .var[feature] needs to be bool If None, adata.X will be used.
kwargs – Other keyword arguments are passed down to TruncatedSVD()
- Returns:
updates adata with the following fields
`.obsm[‘X_pca’]` (array) – PCA transformed X.
`.uns[‘pca’][‘PCs’]` (array) – Principal components in feature space, representing the directions of maximum variance in the data.
`.uns[‘pca’][‘variance’]` (array) – The variance of the training samples transformed by a projection to each component.
`.uns[‘pca’][‘variance_ratio’]` (array) – Percentage of variance explained by each of the selected components.