corrSeq_fit | R Documentation |
Wrapper function that fits one of five types of models to RNA-Seq data. Available model fitting methods are linear mixed models (lmm) (using transformed data), generalized estimating equations with an optional small sample adjustment (gee), and negative binomial models using a pseudo-likelhood approach (nbmm_pl), a maximum likelihood approach with Laplace approximation (nbmm_lp), or a maximum likelihood approach with adaptive Gaussian quadrature (nbmm_agq).
corrSeq_fit(
formula = NULL,
expr_mat = NULL,
gene_names = NULL,
sample_data = NULL,
method,
id,
small.samp.method = NULL,
parallel = F,
cores = 2,
...
)
formula |
A one-sided linear formula describing the model variables. For models that include them, random effects should be included in the formula using the syntax of the lme4 package. |
expr_mat |
A (G x N) numeric matrix RNA-seq expression data with genes in rows and samples in columns. For |
gene_names |
An optional character vector of gene names (length G). |
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 |
Method to use to fit the models. Possible options are |
id |
Only applicable for models fit using |
small.samp.method |
Only applicable for models fit using |
parallel |
A logical variable indicating whether forking (via mclapply) should be used to parallelize fits. Only available on Mac or linux machines. |
cores |
Number of cores to use if parallelizing (default is 2) |
... |
additional arguments passed on to |
A list of length G of model objects from the following functions: lmer
(method="lmm"
), gee_small_sample
(method="lmm"
),
glmm_nb_lmer
(method="nbmm_pl"
), glmmadmb
(method="nbmm_lp"
), or mixed_model
(method="nbmm_agq").
Elizabeth Wynn
corrSeq_summary
, glmm_nb_lmer
, lmer
, gee_small_sample
, glmmadmb
, and mixed_model
data("simdata")
sample_meta_data <- simdata$metadata
## Subset down to 10 observation (i.e. gene)
counts=simdata$counts[1:10,]
## Fit GEE models using Wang-Long small sample size estimator
## log_offset is the log size factors from the DESeq2 package
gee_fit <- corrSeq_fit(formula = ~ group * time+offset(log_offset),
expr_mat = counts,
sample_data = sample_meta_data,
method="gee",
id=ids,
small.samp.method="wl")
## Fit NBMM-PL models
nbmm_pl_fit <- corrSeq_fit(formula = ~ group * time+(1|ids)+offset(log_offset),
expr_mat = counts,
sample_data = sample_meta_data,
method="nbmm_pl")
## Fit NBMM-AGQ models
nbmm_agq_fit <- corrSeq_fit(formula = ~ group * time+(1|ids)+offset(log_offset),
expr_mat = counts,
sample_data = sample_meta_data,
method="nbmm_agq")
## Fit NBMM-LP models
## Random effects must be factors
sample_meta_data$ids<-factor(sample_meta_data$ids)
nbmm_lp_fit <- corrSeq_fit(formula = ~ group * time+(1|ids)+offset(log_offset),
expr_mat = counts,
sample_data = sample_meta_data,
method="nbmm_lp")
## Fit LMM models to transformed data
## Use the variance transformed counts in the simdata object
## Subset down to 10 genes
vst_expr<-simdata$vst_expr[1:10,]
## Fit the Models
lmm_fit<- corrSeq_fit(formula = ~ group * time + (1|ids),
expr_mat = vst_expr,
sample_data = sample_meta_data,
method="lmm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.