Class QuantitationTypeUtils

java.lang.Object
ubic.gemma.model.common.quantitationtype.QuantitationTypeUtils

public class QuantitationTypeUtils extends Object
Utilities for working with QuantitationTypes.
Author:
poirigui
  • Constructor Details

    • QuantitationTypeUtils

      public QuantitationTypeUtils()
  • Method Details

    • isLog2cpm

      public static boolean isLog2cpm(QuantitationType qt)
      Check if a given quantitation type holds log2 CPM.
    • isLogTransformed

      public static boolean isLogTransformed(QuantitationType qt)
      Check if a given QT holds log-transformed data.
    • isCount

      public static boolean isCount(QuantitationType qt)
      Check if a given quantitation type contains counting data.

      Note that counting data might not necessarily use the ScaleType.COUNT scale.

    • getDefaultValue

      @Nonnull public static Object getDefaultValue(QuantitationType quantitationType)
      Obtain the default to use for a given quantitation type.

      This can be used as a placeholder for missing values in data vectors.

      Missing double and float values are represented as NaNs unless they are counts in which case they are represented as zeroes.

      For counting data represented as double or float, the default value is transformed as per getDefaultCountValueAsDouble(QuantitationType) and getDefaultCountValueAsFloat(QuantitationType).

    • getDefaultValueAsNumber

      @Nonnull public static Number getDefaultValueAsNumber(QuantitationType quantitationType)
    • getDefaultValueAsDouble

      public static double getDefaultValueAsDouble(QuantitationType qt)
    • getDefaultCountValueAsDouble

      public static double getDefaultCountValueAsDouble(QuantitationType quantitationType)
      Obtain the value that indicates a missing value for counting data.

      The default count is zero, but if the data is on a log-scale, it will be mapped to Double.NEGATIVE_INFINITY.

    • getDefaultCountValueAsFloat

      public static float getDefaultCountValueAsFloat(QuantitationType quantitationType)
      Obtain the value that indicates a missing value for counting data.
    • mergeQuantitationTypes

      public static QuantitationType mergeQuantitationTypes(Collection<QuantitationType> quantitationTypes)
      Merge a given collection of quantitation types.

      All QTs must share the same general type, type, scale, representation and ratio status.

      The QuantitationType.getIsRecomputedFromRawData() status is kept if all QTs are recomputed from raw data,

      It is not possible to merge QTs that were either normalized or batch-corrected.

      Throws:
      IllegalArgumentException - if the QTs are incompatible or if less than two QTs are provided.
    • appendToDescription

      public static void appendToDescription(QuantitationType qt, String s)
      Append a suffix to a QuantitationType description.

      This is used to describe the conversion that was performed.

    • getUnit

      @Nullable public static String getUnit(QuantitationType quantitationType)
      Returns:
      a unit, or null if the QT is unitless (e.g. ratio)