Skip to contents

FitDream - run mixed effects model on aggregated (summed) data using the method 'dream' by Hoffman et. al. Bioinformatics (2021) doi.org/10.1093/bioinformatics/btaa687. Fits mixed model using lme4 with REML and voom weights.

Usage

FitDream(
  pb.list,
  sample.metadata,
  lme4.formula,
  dream.contrast.matrix = NULL,
  returnvoom = FALSE,
  ncores = 4,
  ...
)

Arguments

sample.metadata

metadata, for example, object returned by AggregateCellMetadata

lme4.formula

symbolic model formula for model to be fit, for example, '~ 0 + group.timepoint + age + sex + (1|SubjectID)'. covariates must be in sample.metadata

dge.lists

list of DGEList objects indexed by cell types -- the object returned by `scglmmr::Normalize`

pparam

number of cores for biocparallel. Set with BiocParallel::register(BiocParallel::SnowParam(4)); pparam = BiocParallel::SnowParam(workers = 4, type = "SOCK", progressbar = TRUE). use the desired number of cores

sample_column

quoted character e.g. "sample" the subject level sample variable should have multiple timepoints subjectID_timepoint i.e. s1_0, s1_1

Value

list of model fits indexed by celltype

Examples

if (FALSE) {
# make contrast matrix
L2 = makeContrastsDream(
  formula = f1,
  data = metadata,
  contrasts = c(
    baseline = "Group.time1_0 - Group.time0_0",
    treatment_delta = "( Group.time1_1 - Group.time1_0 ) - ( Group.time0_1 - Group.time0_0 )",
    treatment = "( Group.time1_1 + Group.time0_1 ) / 2 - ( Group.time1_0 + Group.time0_0 ) / 2 "
  )
)
f1 = '0 + group.time + age + sex + (1|SubjectID)'

}

fits = FitDream(pb.list = pb, sample.metadata = metadata, lme4.formula = f1, dream.contrast.matrix = L2, ncores = 4)
#> [1] " Fitting models with dream method "
#> [1] " If using this model cite Hoffman et. al. Bioinformatics (2021) doi.org/10.1093/bioinformatics/btaa687"
#> Error in FitDream(pb.list = pb, sample.metadata = metadata, lme4.formula = f1,     dream.contrast.matrix = L2, ncores = 4): object 'f1' not found