regressout: Regress out a variable from a gene expression matrix with...

View source: R/analysis.R

regressoutR Documentation

Regress out a variable from a gene expression matrix with linear regression

Description

Remove the effect of a variable from a gene expression matrix. This is done with linear regression. For each gene, we take lm(gene expression ~ var_to_reg). We use the residuals from this linear model as the new expression values. This was inspired by the Seurat::ScaleData function for single-cell analysis.

Usage

regressout(gem, var_to_reg, scale = NULL, center = NULL)

Arguments

gem

a matrix or data.frame; gene expression values with rows = genes aand columns = samples

var_to_reg

a vector with length = ncol(gem) (ie a variable with some number for each sample)

scale

T/F, default T, scale gem before lm

center

T/F, default T, center gem before lm


FerrenaAlexander/FerrenaBulkRNAseq documentation built on Oct. 16, 2022, 8:18 a.m.