| setWeight {MAnorm2} | R Documentation |
Set the Weights of Signal Intensities Contained in a bioCond
Description
setWeight modifies the relative precisions of signal intensities
stored in a bioCond object. One typically uses this function
in the form of x <- setWeight(x, weight), where x is a
bioCond object and weight is a matrix of positive weights.
Usage
setWeight(x, weight = NULL, strMatrix = NULL)
Arguments
x |
A |
weight |
A matrix or data frame specifying the relative precisions of
signal intensities contained in |
strMatrix |
An optional list of symmetric matrices specifying directly
the structure matrix of each genomic interval. Elements of it are
recycled if necessary.
This argument, if set, overrides the |
Details
For each genomic interval in a bioCond object, MAnorm2 models
the signal intensities of it as having a common mean and a covariance
matrix proportional to the interval's structure matrix. Put it formally,
cov(Xi | ti) = ti * Si, where Xi is
the vector of signal intensities of the ith interval, ti is a
positive scalar quantifying the variation level of this interval and
Si is a symmetric matrix denoting the interval's structure matrix.
Naturally, assuming there are no correlations between ChIP-seq samples,
each Si is a diagonal matrix, with its diagonal elements being the
reciprocal of the corresponding weights.
The structure matrices will be used to derive the sample mean and sample
variance (i.e., estimate of ti) of signal intensities of each
interval, using the GLS (generalized least squares) estimation. See also
fitMeanVarCurve for modeling their relationship across
intervals.
Value
A bioCond object with an updated strMatrix
field. To be noted, information about the mean-variance dependence of
the original bioCond object, if any, will be removed in the
returned bioCond. You can re-fit it by, for example, calling
fitMeanVarCurve.
Warning
Do not directly modify the strMatrix field in a
bioCond object. Instead, use this function.
References
Tu, S., et al., MAnorm2 for quantitatively comparing groups of ChIP-seq samples. Genome Res, 2021. 31(1): p. 131-145.
See Also
bioCond for creating a bioCond object based on
normalized signal intensities; fitMeanVarCurve for fitting
the mean-variance trend across genomic intervals.
Examples
data(H3K27Ac, package = "MAnorm2")
attr(H3K27Ac, "metaInfo")
## Set the weights of replicate ChIP-seq samples in a bioCond.
# Construct a bioCond object for the GM12891 cell line. By default, all the
# ChIP-seq samples belonging to the bioCond have the same weight for
# estimating the mean signal intensities of genomic intervals in the cell
# line.
norm <- normalize(H3K27Ac, 5:6, 10:11)
GM12891 <- bioCond(norm[5:6], norm[10:11], name = "GM12891")
# Now we set the weight of the 2nd sample to half of the 1st one.
GM12891_2 <- setWeight(GM12891, weight = c(1, 0.5))
# Equivalently, you can achieve the same effect by setting the strMatrix
# parameter.
GM12891_3 <- setWeight(GM12891, strMatrix = list(diag(c(1, 2))))