bbknn.ridge_regression
- bbknn.ridge_regression(adata, batch_key, confounder_key=[], chunksize=100000000.0, copy=False, **kwargs)
Perform ridge regression on scaled expression data, accepting both technical and biological categorical variables. The effect of the technical variables is removed while the effect of the biological variables is retained. This is a preprocessing step that can aid BBKNN integration (Park, 2020).
Alters the object’s
.Xto be the regression residuals, and creates.layers['X_explained']with the expression explained by the technical effect.Input
- adata
AnnData Needs scaled data in
.X.- batch_key
list A list of categorical
.obscolumns to regress out as technical effects.- confounder_key
list, optional (default:[]) A list of categorical
.obscolumns to retain as biological effects.- chunksize
int, optional (default: 1e8) How many elements of the expression matrix to process at a time. Potentially useful to manage memory use for larger datasets.
- copy
bool, optional (default:False) If
True, return a copy instead of writing to the supplied adata.- kwargs
Any arguments to pass to Ridge.
- adata