% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/computeDeviationsWeighted.R
\name{computeDeviationsWeighted}
\alias{computeDeviationsWeighted}
\title{computeDeviationsWeighted}
\usage{
computeDeviationsWeighted(
  weightedMotifCounts,
  unweightedPeakCounts,
  annotations,
  bg = NULL,
  retSE = TRUE,
  ...
)
}
\arguments{
\item{weightedMotifCounts}{A matrix of weighted counts per motif (rows) and
sample (columns), or a \code{SummarizedExperiment} containing this as first
assay.}

\item{unweightedPeakCounts}{A matrix of unweighted counts per peak (rows) and
sample (columns), or a \code{SummarizedExperiment} containing this as first
assay.}

\item{annotations}{Peak annotation (sparse) matrix, with motifs as columns,
or a SummarizedExperiment containing this in the first assay. Values
should be either logical or between 0 and 1.}

\item{bg}{Either a \code{\link[betterChromVAR]{bcvBackground-class}} object
as produced by \code{\link{computeBackgrounds}}, or a
\code{SummarizedExperiment} of background peak counts (with bias data in
\code{rowData}). If missing, will be created based on \code{unweightedPeakCounts}.}

\item{retSE}{Logical; whether to return a SummarizedExperiment object.}

\item{...}{Passed to \link{getBackgroundBins} (can for instance be used to
pass bias info if not contained in the objects). Ignored if \code{bg} is a
\code{\link[betterChromVAR]{bcvBackground-class}} object.}
}
\value{
A SummarizedExperiment (or a list if \code{retSE=FALSE}). If overall
motif variability and their significance are additionally needed, see
\code{\link{computeMotifVariability}}.
}
\description{
A variant of \code{\link{computeDeviationsWeighted}} enabling the
computation of deviations from weighted foreground counts. Specifically, this
functions handles the normalization of the difference in magnitude between
the (weighted) foreground and background.
}
\examples{
attach(getDummyData())
# if GC content not already in the object, use:
# counts <- addGCBias(counts, genome=YOUR_GENOME)
# For the purpose of this example, we'll use standard (unweighted counts),
# although at this step we'd compute counts weighted in the desired fashion:
motifCounts <- Matrix::t(motifMatches) \%*\% assay(counts)
dev1 <- computeDeviationsWeighted(motifCounts, counts, motifMatches)
dev1
# in this case, the results are identical to :
dev2 <- betterChromVAR(counts, motifMatches)
stopifnot(identical(assays(dev1), assays(dev2)))
}
\seealso{
\code{\link[=computeDeviationsAnalytic]{computeDeviationsAnalytic()}}
}
