run.all.lmers: Function that will run a regression for your variable of...

Description Usage Arguments Value Examples

View source: R/run.all.lmers.R

Description

Function that will run a regression for your variable of interest across all genes/metabolites/CpGs, in parallel. Adapted from Vamsee (github.com/vkp3/pillalamarRi)

Usage

1
2
3
4
5
6
7
8
9
run.all.lmers(
  tx_expr,
  cov,
  rcov,
  gene.ids,
  SCORE,
  omit.outlier = T,
  num.cores = 10
)

Arguments

tx_expr

Expression matrix in form: genes x samples. Will be converted to a list(!) of gene-expr vectors (if not input as list)

cov

Regression covariates (fixed effects) cov x samples

rcov

Regression covariates to be treated as random effects

gene.ids

Character vector of gene IDs, corresponding to rows in tx_expr genes x samples

SCORE

Main covariate to be permuted (not included in cov)

omit.outlier

Whether or not you want to omit gene expression outliers

num.cores

The number of cores you would like to use

Value

All regression coefficients for lmer(gene expression ~ SCORE + cov + (1|rcov)) for all genes

Examples

1
2
3
4
5
tx_expr <- w.mt[,which(colnames(w.mt) %in% make.names(metablist))]
cov <- w.mt[,which(colnames(w.mt) %in% c('sex', 'age1c', 'PC1', 'PC2', 'PC3', 'bmi', 'Exam'))]
rcov <- w.mt[,which(colnames(w.mt) %in% c('idno'))]
SCORE <- w.mt[,which(colnames(w.mt) == "dpcrAdjMetric")]
lm_res.sort <- run.all.lmers(tx_expr, cov, rcov, colnames(tx_expr), SCORE, omit.outlier = T, num.cores = 10)

syyang93/lmeR documentation built on July 16, 2020, 12:49 a.m.