dotools_py.tl.run_harmony#
- dotools_py.tl.run_harmony(adata, batch_key, use_rep='X_pca', rep_added='X_harmony', random_state=0, use_gpu=False, max_iter_harmony=150, workers=1, **kwargs)[source]#
Run Harmony integration.
This functions runs the Pytorch implementation of Harmony.
- Parameters:
- adata
AnnData Annotated data matrix.
- batch_key
str Key in adata.obs with batch information.
- use_rep
str(default:'X_pca') Representation in adata.obsm that represents the input embedding with rows for cells and columns for embedding coordinates.
- rep_added
str(default:'X_harmony') Name of the adjusted embedding.
- random_state
int(default:0) Seed for random number generator.
- use_gpu
bool(default:False) If set to
Truewill use GPU if available.- max_iter_harmony
int(default:150) Maximum number of iterations for harmony.
- workers
int(default:1) Number of threads to use.
- kwargs
Additional arguments pass to harmony.harmonize.
- adata
- Return type:
- Returns:
Returns
None. A new slot will be set inadata.obsm[rep_added].
Example
>>> import dotools_py as do >>> adata = do.dt.example_10x_processed() >>> adata.obsm_keys() ['X_CCA', 'X_pca', 'X_umap'] >>> do.tl.run_harmony(adata, batch_key="batch") >>> adata.obsm_keys() ['X_CCA', 'X_pca', 'X_umap', 'X_harmony']