lmerSeq.fit: Function to Fit linear mixed models to transformed RNA-Seq...

View source: R/lmerSeq_fit.R

lmerSeq.fitR Documentation

Function to Fit linear mixed models to transformed RNA-Seq data

Description

Wrapper function that its linear mixed models to (transformed) RNA-Seq data using the utilities present in the lme4 package.

Usage

lmerSeq.fit(
  form = NULL,
  expr_mat = NULL,
  gene_names = NULL,
  sample_data = NULL,
  weights = NULL,
  REML = T,
  parallel = F,
  cores = 2
)

Arguments

form

A one-sided linear formula describing both the fixed-effects and random-effects parts of the model using the syntax of the lme4 package

expr_mat

A (G x N) numeric matrix or data frame of transformed RNA-seq counts (e.g. using VST from DESeq2), with genes in rows and samples in columns. G = number of genes. N = number of samples.

gene_names

An optional character vector of gene names (length G). If unspecified, row names from the expression matrix will be used.

sample_data

Data frame with N rows containing the fixed- and random-effects terms included in the formula. The rows of the data frame must correspond (and be in the same order as) the columns of the expression matrix.

weights

An optional (G x N) numeric matrix of weights to be used in the model fitting

REML

Should the models be fit with REML or regular ML?

parallel

If on Mac or linux, use forking (via mclapply) to parallelize fits

cores

Number of cores to use (default is 2)

Examples

data("expr_data")
vst_expr <- expr_example$vst_expr
sample_meta_data <- expr_example$sample_meta_data

##  Only including 10 genes in the expression matrix
vst_expr <- vst_expr[1:10, ]

##  Fit the Model
fit.lmerSeq <- lmerSeq.fit(form = ~ group * time + (1|ids),
                           expr_mat = vst_expr,
                           sample_data = sample_meta_data,
                           REML = T)


stop-pre16/lmerSeq documentation built on July 27, 2022, 9:08 a.m.