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

View source: R/lmerSeq_fit_gls.R

lmerSeq.fit.glsR 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 using the gls function from the nlme package.

Usage

lmerSeq.fit.gls(
  form = NULL,
  cor_str = NULL,
  expr_mat = NULL,
  gene_names = NULL,
  sample_data = NULL,
  weights = NULL,
  method = "REML",
  parallel = F,
  cores = 2
)

Arguments

form

A one-sided linear formula describing both the fixed-effects part of the model using the syntax of the nlme package

cor_str

Correlation structure defined as one of the corStruct options available in the nlme 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.

method

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.gls <- lmerSeq.fit.gls(form = ~ group * time,
                           cor_str = nlme::corCompSymm(form = ~ 1 | ids),
                           expr_mat = vst_expr,
                           sample_data = sample_meta_data,
                           method = 'REML')


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