RunLinearModel: Wrapper function for running a ElasticNet model on a single...

View source: R/glmnet.R

RunLinearModelR Documentation

Wrapper function for running a ElasticNet model on a single cell dataset

Description

Wrapper function for running a ElasticNet model on a single cell dataset

Usage

RunLinearModel(
  obj,
  pert.col,
  batch.col = NULL,
  size.factor.col = NULL,
  mito.col = NULL,
  response.col = NULL,
  features.use = NULL,
  test.prop = 0.2,
  family = NULL,
  alpha.seq = c(0.1, 0.4, 0.7, 0.9, 0.95, 1),
  plot.cv = T,
  n.cores = 4,
  nlambda = 10,
  lambda.min.ratio = 0.01,
  nfolds = 4,
  seed = NULL,
  seq.lambda.pred = F,
  eval.metric = NULL
)

Arguments

obj

Seurat object

pert.col

Metadata column containing perturbation info (required)

batch.col

Metadata column containing batch info (default: NULL)

size.factor.col

Metadata column containing library size info (default: NULL)

mito.col

Metadata column containing mitochondrial fraction info (default: NULL)

response.col

Metadata column containing the desired response. If NULL, the normalized data in the Seurat object will be used as the response.

features.use

If response.col is NULL, a subset of features to use for the response

test.prop

Proportion of cells held out for model evaluation

family

GLM family to use for elasticnet (default: mgaussian)

alpha.seq

Sequence of alpha values to test

plot.cv

Plot cross validation results (default: True)

n.cores

Number of cores to use (default: 4)

nlambda

Number of lambda values to test (default: 10)

lambda.min.ratio

Sets the minimum lambda value to test (default: 0.01)

nfolds

Number of folds to cross validate over (default: 5)

seed

Random seed for fold reproducibility

seq.lambda.pred

Predict expression at each lambda value sequentially to save memory (default: F)

eval.metric

Model evaluation metric

Value

Returns a list with the design matrix, response, train/test split cross validation results, fitted model, model coefficients, and evaluation metrics


yanwu2014/perturbLM documentation built on Aug. 24, 2023, 2:28 p.m.