Class MeanVarianceEstimator


  • public class MeanVarianceEstimator
    extends Object
    Estimate mean-variance relationship and use this to compute weights for least squares fitting. R's limma.voom() Charity Law and Gordon Smyth. See Law et al. {@see http://genomebiology.biomedcentral.com/articles/10.1186/gb-2014-15-2-r29}

    Running voom() on data matrices with NaNs is not currently supported.

    Author:
    ptan
    • Constructor Detail

      • MeanVarianceEstimator

        public MeanVarianceEstimator​(DesignMatrix designMatrix,
                                     DoubleMatrix<String,​String> data,
                                     cern.colt.matrix.DoubleMatrix1D librarySize)
        Preferred interface if you want control over how the design is set up. Executes voom() to calculate weights.
        Parameters:
        designMatrix -
        data - expected to be log2cpm, and already filtered
        librarySize - library size (matrix column sum)
      • MeanVarianceEstimator

        public MeanVarianceEstimator​(DesignMatrix designMatrix,
                                     cern.colt.matrix.DoubleMatrix2D data,
                                     cern.colt.matrix.DoubleMatrix1D librarySize)
        Executes voom() to calculate weights.
        Parameters:
        designMatrix -
        data - a normalized count matrix
        librarySize - library size (matrix column sum)
      • MeanVarianceEstimator

        public MeanVarianceEstimator​(cern.colt.matrix.DoubleMatrix2D data)
        Generic method for calculating mean and variance, as a data diagnostic.

        voom() is not executed and therefore no weights are calculated.

        Parameters:
        data - data to be processed
    • Method Detail

      • getLibrarySize

        public cern.colt.matrix.DoubleMatrix1D getLibrarySize()
        Returns:
        total library size
      • getLoess

        public cern.colt.matrix.DoubleMatrix2D getLoess()
        Returns:
        the loess fit of the mean-variance relationship
      • getMeanVariance

        public cern.colt.matrix.DoubleMatrix2D getMeanVariance()
        Returns:
        the mean and variance of the normalized data, columns 0 and 1 respectively
      • getNormalizedValue

        public cern.colt.matrix.DoubleMatrix2D getNormalizedValue()
        Returns:
        data, as supplied (should be log2cpm)
      • getWeights

        public cern.colt.matrix.DoubleMatrix2D getWeights()
        Returns:
        inverse variance weights if voom was applied
      • quarterRootVariance

        protected cern.colt.matrix.DoubleMatrix1D quarterRootVariance​(LeastSquaresFit lsf)