chrysalis.harmony_integration
- chrysalis.harmony_integration(adata, covariates, input_matrix='chr_X_pca', corrected_matrix=None, random_state=42, **harmony_kw)
Integrate data using harmonypy, the Python implementation of the R package Harmony.
Harmony integration is done on the PCA matrix, therefore chrysalis.pca must be run before this function.
- Parameters:
adata – The AnnData data matrix of shape n_obs × n_vars. Rows correspond to cells and columns to genes.
covariates – String or list of strings containing the covariate columns to integrate over.
input_matrix – Input PCA matrix, by default ‘chr_X_pca’ is used in .obsm.
corrected_matrix – If corrected_matrix is defined, a new .obsm matrix will be created for the integrated results instead of overwriting the input_matrix.
harmony_kw – harmonypy.run_harmony() keyword arguments.
- Returns:
Replaces .obsm[input_matrix] with the corrected one, or saves the new matrix as a new .`.obsm` matrix specified with corrected_matrix.