pegasus.regress_out
- pegasus.regress_out(data, attrs, rep='pca', n_comps=None)[source]
Regress out effects due to specific observational attributes.
- Parameters
data (
MultimodalDataorUnimodalDataobject) – Annotated data matrix with rows for cells and columns for genes.attrs (
List[str]) – List of numeric cell attributes to be regressed out. They must exist indata.obsfield.rep (
str, optional, default:pca) – This is to specify which embedding to be used for regressing out. The key'X_'+repmust exist indata.obsmfield. By default, use PCA embedding.n_comps (
int, optional, default:None) – Number of components of the embedding to be used. By default, use all components.
- Return type
str- Returns
res_key (
str) – The key to the resulting new embedding matrix indata.obsm. It’s'X_'+rep+'_regressed'.Update
data.obsm–data.obsm[pca_key]: The PCA matrix with effects of attributes specified regressed out.
Examples
>>> pg.regress_out(data, attrs=['G1/S', 'G2/M'])