public class MatrixStats extends Object
Constructor and Description |
---|
MatrixStats() |
Modifier and Type | Method and Description |
---|---|
static <R,C> cern.colt.matrix.DoubleMatrix1D |
colSums(DoubleMatrix<R,C> data)
NaN values are omitted from calculations.
|
static <R,C> void |
convertToLog2(DoubleMatrix<R,C> matrix,
double base)
Convert a log_b-transformed data set to log 2.
|
static <R,C> DoubleMatrix<R,C> |
convertToLog2Cpm(DoubleMatrix<R,C> matrix,
cern.colt.matrix.DoubleMatrix1D librarySize)
Convert a count matrix to log2 counts per million.
|
static <R,C> DoubleMatrix<R,R> |
correlationMatrix(DoubleMatrix<R,C> data)
Compute the correlation matrix of the rows of a matrix.
|
static <R,C> SparseDoubleMatrix<R,R> |
correlationMatrix(DoubleMatrix<R,C> data,
double threshold) |
static cern.colt.matrix.DoubleMatrix2D |
cov2cor(cern.colt.matrix.DoubleMatrix2D cov)
Scale a covariance matrix to the corresponding correlation matrix.
|
static <R,C> DoubleMatrix<R,C> |
doubleStandardize(DoubleMatrix<R,C> matrix)
Iteratively standardize the columns and rows of the matrix.
|
static <R,C> void |
logTransform(DoubleMatrix<R,C> matrix)
Log-transform the values in a matrix (log base 2).
|
static <R,C> double |
max(DoubleMatrix<R,C> matrix)
Compute the maximum value in the matrix.
|
static <R,C> double |
min(DoubleMatrix<R,C> matrix)
Find the minimum of the entire matrix.
|
static boolean[][] |
nanStatusMatrix(double[][] data) |
static <R,C> void |
rbfNormalize(DoubleMatrix<R,C> matrixToNormalize,
double sigma)
Normalize a matrix in place to be a transition matrix.
|
static double[][] |
selfSquaredMatrix(double[][] input) |
static <R,C> DoubleMatrix<R,C> |
standardize(DoubleMatrix<R,C> matrix)
Scale the rows of the matrix; returns a new matrix.
|
static <R,C> void |
unLogTransform(DoubleMatrix<R,C> matrix)
Undo log2 transform.
|
public static <R,C> cern.colt.matrix.DoubleMatrix1D colSums(DoubleMatrix<R,C> data)
R
- C
- data
- public static <R,C> void convertToLog2(DoubleMatrix<R,C> matrix, double base)
matrix
- base
- the current basepublic static <R,C> DoubleMatrix<R,C> convertToLog2Cpm(DoubleMatrix<R,C> matrix, cern.colt.matrix.DoubleMatrix1D librarySize)
t(log2(t(counts+0.5)/(lib.size+1)*1e6))
in R. (NOTE: originally this did the operation in place)matrix
- librarySize
- if null, it will default to colSums(matrix)
.public static <R,C> DoubleMatrix<R,R> correlationMatrix(DoubleMatrix<R,C> data)
data
- public static <R,C> SparseDoubleMatrix<R,R> correlationMatrix(DoubleMatrix<R,C> data, double threshold)
data
- DenseDoubleMatrix2DNamedthreshold
- only correlations with absolute values above this level are stored (others are Double.NaN)public static <R,C> DoubleMatrix<R,C> doubleStandardize(DoubleMatrix<R,C> matrix)
data
- public static <R,C> void logTransform(DoubleMatrix<R,C> matrix)
matrixToNormalize
- public static <R,C> double max(DoubleMatrix<R,C> matrix)
matrix
- DenseDoubleMatrix2DNamedpublic static <R,C> double min(DoubleMatrix<R,C> matrix)
matrix
- DenseDoubleMatrix2DNamedpublic static boolean[][] nanStatusMatrix(double[][] data)
data
- public static <R,C> void rbfNormalize(DoubleMatrix<R,C> matrixToNormalize, double sigma)
Each point is first transformed via v' = exp(-v/sigma). Then the values for each node's edges are adjusted to sum to 1.
matrixToNormalize
- sigma
- a scaling factor for the input values.public static double[][] selfSquaredMatrix(double[][] input)
input
- raw double 2-d matrixpublic static <R,C> DoubleMatrix<R,C> standardize(DoubleMatrix<R,C> matrix)
R
- C
- data
- public static cern.colt.matrix.DoubleMatrix2D cov2cor(cern.colt.matrix.DoubleMatrix2D cov)
cov
- a symmetric matrix of covariancespublic static <R,C> void unLogTransform(DoubleMatrix<R,C> matrix)
R
- C
- matrix
- Copyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.