pegasus.pca
- pegasus.pca(data, n_components=50, features='highly_variable_features', standardize=True, max_value=10.0, n_jobs=-1, random_state=0)[source]
Perform Principle Component Analysis (PCA) to the data.
The calculation uses scikit-learn implementation.
- Parameters
data (
pegasusio.MultimodalData) – Annotated data matrix with rows for cells and columns for genes.n_components (
int, optional, default:50.) – Number of Principal Components to get.features (
str, optional, default:"highly_variable_features".) – Keyword indata.varto specify features used for PCA. IfNone, all features will be selected.standardize (
bool, optional, default:True.) – Whether to scale the data to unit variance and zero mean.max_value (
float, optional, default:10.) – The threshold to truncate data after scaling. IfNone, do not truncate.n_jobs (int, optional (default: -1)) – Number of threads to use. -1 refers to using all physical CPU cores.
random_state (
int, optional, default:0.) – Random seed to be set for reproducing result.
- Return type
None- Returns
None.Update
data.obsm–data.obsm["X_pca"]: PCA matrix of the data.
Update
data.uns–data.uns["PCs"]: The principal components containing the loadings.data.uns["pca_variance"]: Explained variance, i.e. the eigenvalues of the covariance matrix.data.uns["pca_variance_ratio"]: Ratio of explained variance.data.uns["pca_features"]: Record the features used to generate PCA components.
Examples
>>> pg.pca(data)