Class TwoChannelExpressionDataMatrixBuilder

java.lang.Object
ubic.gemma.core.datastructure.matrix.TwoChannelExpressionDataMatrixBuilder

public class TwoChannelExpressionDataMatrixBuilder extends Object
Utility methods for taking an ExpressionExperiment and returning various types of ExpressionDataMatrices, such as the processed data, preferred data, background, etc. This class is not database aware; use the ExpressionDataMatrixService to get ready-to-use matrices starting from an ExpressionExperiment. This handles complexities such as experiments that contain multiple array designs with differing quantitation types.
Author:
pavlidis
  • Constructor Details

  • Method Details

    • getMissingValueQuantitationTypes

      public static Collection<QuantitationType> getMissingValueQuantitationTypes(ExpressionExperiment expressionExperiment)
      Parameters:
      expressionExperiment - (should be lightly thawed)
      Returns:
      a collection of QTs
    • getPreferredAndMissingQuantitationTypes

      public static Collection<QuantitationType> getPreferredAndMissingQuantitationTypes(ExpressionExperiment expressionExperiment)
    • getPreferredQuantitationTypes

      public static Collection<QuantitationType> getPreferredQuantitationTypes(ExpressionExperiment expressionExperiment)
    • getUsefulQuantitationTypes

      public static Collection<QuantitationType> getUsefulQuantitationTypes(Collection<QuantitationType> eeQtTypes)
      Parameters:
      eeQtTypes - the QTs
      Returns:
      just the quantitation types that are likely to be 'useful': Preferred, present/absent, signals and background from both channels (if present).
    • getUsefulQuantitationTypes

      public static Collection<QuantitationType> getUsefulQuantitationTypes(ExpressionExperiment expressionExperiment)
      Parameters:
      expressionExperiment - the EE to get the QTs for
      Returns:
      just the quantitation types that are likely to be 'useful': Preferred, present/absent, signals and background from both channels (if present).
    • getBackgroundChannelA

      public ExpressionDataDoubleMatrix getBackgroundChannelA()
    • getBackgroundChannelB

      public ExpressionDataDoubleMatrix getBackgroundChannelB()
    • getBioAssayDimensions

      public List<BioAssayDimension> getBioAssayDimensions()
    • getBkgSubChannelA

      public ExpressionDataDoubleMatrix getBkgSubChannelA()
    • getExpressionExperiment

      public ExpressionExperiment getExpressionExperiment()
    • getIntensity

      public ExpressionDataDoubleMatrix getIntensity()
      Returns:
      Compute an intensity matrix. For two-channel arrays, this is the geometric mean of the background-subtracted signals on the two channels. For two-color arrays, if one channel is missing (as happens sometimes) the intensities returned are just from the one channel. For one-color arrays, this is the same as the preferred data matrix.
    • getMissingValueData

      @Nullable public ExpressionDataBooleanMatrix getMissingValueData()
      Returns:
      a matrix of booleans, or null if a missing value quantitation type ("absent/present", which may have been computed by our system) is not found. This will return the values whether the array design is two-color or not.
    • getNumMissingValues

      public int getNumMissingValues(QuantitationType qt)
    • getPreferredData

      public ExpressionDataDoubleMatrix getPreferredData()
      Returns:
      The matrix for the preferred data - NOT the processed data (though they may be the same, in fact)
    • getPreferredQTypes

      public List<QuantitationType> getPreferredQTypes()
    • getProcessedData

      public ExpressionDataDoubleMatrix getProcessedData()
    • getRanksByMean

      public Map<CompositeSequence,Double> getRanksByMean()
    • getSignalChannelA

      public ExpressionDataDoubleMatrix getSignalChannelA()
    • getSignalChannelB

      public ExpressionDataDoubleMatrix getSignalChannelB()
    • isAnyMissing

      public boolean isAnyMissing()
    • 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 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 void scalarDivideMatrix(ExpressionDataDoubleMatrix matrix, double dividend)
      Divide all values by the dividend
      Parameters:
      matrix - matrix
      dividend - dividend
      Throws:
      IllegalArgumentException - if dividend == 0.