RidgeRegression: Perform ridge regression on scaled expression data

View source: R/ridge_regression.R

RidgeRegressionR Documentation

Perform ridge regression on scaled expression data

Description

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.

Usage

RidgeRegression(object, ...)

## Default S3 method:
RidgeRegression(
  object,
  latent_data,
  batch_key,
  confounder_key,
  lambda = 1,
  seed = 42,
  verbose = TRUE,
  ...
)

## S3 method for class 'Seurat'
RidgeRegression(
  object,
  batch_key,
  confounder_key,
  assay = NULL,
  features = NULL,
  lambda = 1,
  run_pca = TRUE,
  npcs = 50,
  reduction.name = "pca",
  reduction.key = "PC_",
  replace = FALSE,
  seed = 42,
  verbose = TRUE,
  ...
)

Arguments

object

An object

...

Arguments passed to other methods

latent_data

Extra data to regress out, should be cells x latent data

batch_key

Variables to regress out as technical effects. Must be included in column names of latent_data

confounder_key

Variables to to retain as biological effects. Must be included in column names of latent_data

lambda

A user supplied lambda sequence. pass to glmnet

seed

Set a random seed. By default, sets the seed to 42. Setting NULL will not set a seed.

verbose

Whether or not to print output to the console

assay

Name of Assay ridge regression is being run on

features

Features to compute ridge regression on. If features=NULL, ridge regression will be run using the variable features for the Assay.

run_pca

Whether or not to run pca with regressed expression data (TRUE by default)

npcs

Total Number of PCs to compute and store (50 by default)

reduction.name

Dimensional reduction name (pca by default)

reduction.key

Dimensional reduction key, specifies the string before the number for the dimension names (PC by default)

replace

Whether or not to replace original scale.data with regressed expression data (TRUE by default)

Value

Returns a Seurat object.

References

Park, Jong-Eun, et al. "A cell atlas of human thymic development defines T cell repertoire formation." Science 367.6480 (2020): eaay3224.


bbknnR documentation built on Sept. 23, 2022, 1:06 a.m.