% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/voomWithDreamWeights.R
\name{voomWithDreamWeights}
\alias{voomWithDreamWeights}
\title{Transform RNA-Seq Data Ready for Linear Mixed Modelling with \code{dream()}}
\usage{
voomWithDreamWeights(
  counts,
  formula,
  data,
  lib.size = NULL,
  normalize.method = "none",
  span = 0.5,
  plot = FALSE,
  save.plot = FALSE,
  quiet = FALSE,
  BPPARAM = bpparam(),
  ...
)
}
\arguments{
\item{counts}{a numeric \code{matrix} containing raw counts, or an \code{ExpressionSet} containing raw counts, or a \code{DGEList} object. Counts must be non-negative and NAs are not permitted.}

\item{formula}{specifies variables for the linear (mixed) model.  Must only specify covariates, since the rows of exprObj are automatically used a a response. e.g.: \code{~ a + b + (1|c)}  Formulas with only fixed effects also work, and \code{lmFit()} followed by contrasts.fit() are run.}

\item{data}{\code{data.frame} with columns corresponding to formula}

\item{lib.size}{numeric vector containing total library sizes for each sample.  Defaults to the normalized (effective) library sizes in \code{counts} if \code{counts} is a \code{DGEList} or to the columnwise count totals if \code{counts} is a matrix.}

\item{normalize.method}{the microarray-style normalization method to be applied to the logCPM values (if any).  Choices are as for the \code{method} argument of \code{normalizeBetweenArrays} when the data is single-channel.  Any normalization factors found in \code{counts} will still be used even if \code{normalize.method="none"}.}

\item{span}{width of the lowess smoothing window as a proportion.}

\item{plot}{logical, should a plot of the mean-variance trend be displayed?}

\item{save.plot}{logical, should the coordinates and line of the plot be saved in the output?}

\item{quiet}{suppress message, default FALSE}

\item{BPPARAM}{parameters for parallel evaluation}

\item{...}{other arguments are passed to \code{lmer}.}
}
\value{
An \code{EList} object just like the result of \code{limma::voom()}
}
\description{
Transform count data to log2-counts per million (logCPM), estimate the mean-variance relationship and use this to compute appropriate observation-level weights. The data are then ready for linear mixed modelling with \code{dream()}.   This method is the same as limma::voom(), except that it allows random effects in the formula
}
\details{
Adapted from \code{vomm()} in \code{limma} v3.40.2
}
\examples{
# library(variancePartition)
library(edgeR)
library(BiocParallel)

data(varPartDEdata)

# normalize RNA-seq counts
dge = DGEList(counts = countMatrix)
dge = calcNormFactors(dge)

# specify formula with random effect for Individual
form <- ~ Disease + (1|Individual) 

# compute observation weights
vobj = voomWithDreamWeights( dge[1:20,], form, metadata)

# fit dream model 
res = dream( vobj, form, metadata)

# extract results
topTable(res, coef="Disease1")


}
\seealso{
limma::voom()
}
