Class ExpressionDataDoubleMatrixUtil


  • public class ExpressionDataDoubleMatrixUtil
    extends Object
    Perform various computations on ExpressionDataMatrices (usually in-place).
    Author:
    pavlidis
    • Constructor Detail

      • ExpressionDataDoubleMatrixUtil

        public ExpressionDataDoubleMatrixUtil()
    • Method Detail

      • filterAndLog2Transform

        public static ExpressionDataDoubleMatrix filterAndLog2Transform​(ExpressionDataDoubleMatrix dmatrix)
        Log2 transform if necessary, do any required filtering prior to analysis. Count data is converted to log2CPM (but we store log2cpm as the processed data, so that is what would generally be used).
        Parameters:
        dmatrix - matrix
        Returns:
        ee data double matrix
      • subtractMatrices

        public static void subtractMatrices​(ExpressionDataDoubleMatrix a,
                                            ExpressionDataDoubleMatrix b)
        Subtract two matrices. Ideally, they matrices are conformant, but if they are not (as some rows are sometimes missing for some quantitation types), this method attempts to handle it anyway (see below). The rows and columns do not have to be in the same order, but they do have to have the same column keys and row keys (with the exception of missing rows). The result is stored in a. (a - b). If the number of rows are not the same, and/or the rows have different keys in the two matrices, some rows will simply not get subtracted and a warning will be issued.
        Parameters:
        a - matrix a
        b - matrix b
        Throws:
        IllegalArgumentException - if the matrices are not column-conformant.
      • logTransformMatrix

        public static void logTransformMatrix​(ExpressionDataDoubleMatrix matrix)
        Log-transform the values in the matrix (base 2). Non-positive values (which have no logarithm defined) are entered as NaN.
        Parameters:
        matrix - matrix
      • addMatrices

        public static void addMatrices​(ExpressionDataDoubleMatrix a,
                                       ExpressionDataDoubleMatrix b)
        Add two matrices. Ideally, they matrices are conformant, but if they are not (as some rows are sometimes missing for some quantitation types), this method attempts to handle it anyway (see below). The rows and columns do not have to be in the same order, but they do have to have the same column keys and row keys (with the exception of missing rows). The result is stored in a. If the number of rows are not the same, and/or the rows have different keys in the two matrices, some rows will simply not get added and a warning will be issued.
        Parameters:
        a - matrix a
        b - matrix b
        Throws:
        IllegalArgumentException - if the matrices are not column-conformant.
      • scalarDivideMatrix

        public static void scalarDivideMatrix​(ExpressionDataDoubleMatrix matrix,
                                              double dividend)
        Divide all values by the dividend
        Parameters:
        matrix - matrix
        dividend - dividend
        Throws:
        IllegalArgumentException - if dividend == 0.
      • maskMatrix

        public static void maskMatrix​(ExpressionDataDoubleMatrix matrix,
                                      ExpressionDataBooleanMatrix mask)
        Use the mask matrix to turn some values in a matrix to NaN. Ideally, they matrices are conformant, but if they are not (as some rows are sometimes missing for some quantitation types), this method attempts to handle it anyway (see below). The rows and columns do not have to be in the same order, but they do have to have the same column keys and row keys (with the exception of missing rows). The result is stored in matrix.
        Parameters:
        matrix - matrix
        mask - if null, masking is not attempted.