Class BaselineSelection

java.lang.Object
ubic.gemma.core.analysis.expression.diff.BaselineSelection

public class BaselineSelection extends Object
Utilities for deciding if a factor value is a baseline condition.
Author:
paul
  • Constructor Details

    • BaselineSelection

      public BaselineSelection()
  • Method Details

    • getControlGroupTerms

      public static Set<String> getControlGroupTerms()
      The control-group terms and URIs themselves, for callers that have to recognise a baseline in SQL rather than over loaded entities.

      Exposed rather than copied so there is one list. The relation harvest needs it because a curated statement whose object is a control-arm marker is not a relation between two concepts — OBI_0000220 reference subject role left in makes every disease that ever had a control arm look implied by it.

      Both sets are already unmodifiable.

    • getControlGroupUris

      public static Set<String> getControlGroupUris()
      See Also:
    • isBaselineCondition

      public static boolean isBaselineCondition(FactorValue factorValue)
      Check if a given factor value indicates a baseline condition.
    • isBaselineCondition

      public static boolean isBaselineCondition(Statement c)
      Check if a given statement indicates a baseline condition.
    • isBaselineCondition

      public static boolean isBaselineCondition(Characteristic c)
      Check if a given characteristic indicate a baseline condition.
    • isForcedBaseline

      public static boolean isForcedBaseline(FactorValue fv)
      Check if this factor value is the baseline, overriding other possible baselines.

      A baseline can be *forced* in two ways: either by setting FactorValue.setIsBaseline(Boolean) to true or by adding a characteristic with the FORCED_BASELINE_VALUE_URI URI. In practice, this is not much different from isBaselineCondition(Statement), but there might be cases where you would want to indicate that the baseline was explicitly forced.

    • getBaselineLevels

      public static Map<ExperimentalFactor, FactorValue> getBaselineLevels(Collection<ExperimentalFactor> factors, @Nullable Collection<BioMaterial> samplesUsed)
      Identify the FactorValue that should be treated as 'Baseline' for each of the given factors. This is done heuristically, and if all else fails we choose arbitrarily. For continuous factors, the minimum value is treated as baseline.
      Parameters:
      factors - factors
      samplesUsed - These are used to make sure we don't bother using factor values as baselines if they are not used by any of the samples. This is important for subsets. If null, this is ignored.
      Returns:
      map of factors to the baseline factorvalue for that factor.
    • getBaselineLevels

      public static Map<ExperimentalFactor, FactorValue> getBaselineLevels(Collection<ExperimentalFactor> factors)
      Identify the FactorValue that should be treated as 'Baseline' for each of the given factors. This is done heuristically, and if all else fails we choose arbitrarily.
      Parameters:
      factors - factors
      Returns:
      map
    • getExplicitBaselines

      public static List<FactorValue> getExplicitBaselines(ExperimentalFactor factor, @Nullable Collection<BioMaterial> samplesUsed)
      The factor values a curator has EXPLICITLY marked as baseline on this factor, restricted to those the given samples actually use.

      More than one is legitimate: a dataset holding two experiments has a reference level per experiment. It does mean the factor cannot be analyzed as a single contrast, which is why LinearModelAnalyzer refuses such a factor unless a subset factor was configured.

      🛑 Deliberately counts only the explicit flag, NOT isBaselineCondition(FactorValue). The inference finds two candidates on a great many factors — any design with, say, both "control" and "untreated" levels — and that is ambiguity to be resolved by picking one, not a curator saying "this design has two reference levels". Treating inferred pairs as an error would fail analyses that run correctly today.

      Parameters:
      samplesUsed - restrict to values used by these samples, or null to consider every value of the factor
    • getBaselineConditions

      public static Map<ExperimentalFactor, FactorValue> getBaselineConditions(Collection<BioMaterial> samplesUsed, Collection<ExperimentalFactor> factors)