pegasus.regress_out
- pegasus.regress_out(data, attrs, rep='pca', n_comps=None)[source]
Regress out effects due to specific observational attributes.
- Parameters
data (
MultimodalData
orUnimodalData
object) – 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.obs
field.rep (
str
, optional, default:pca
) – This is to specify which embedding to be used for regressing out. The key'X_'+rep
must exist indata.obsm
field. 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'])