Class DifferentialExpressionAnalysisConfig

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

public class DifferentialExpressionAnalysisConfig extends Object
Holds the settings used for differential expression analysis, and defines some defaults.
Author:
keshav
  • Field Details

    • DEFAULT_MODERATE_STATISTICS

      public static final boolean DEFAULT_MODERATE_STATISTICS
      Default value for whether moderated test statistics should be used.
      See Also:
  • Constructor Details

    • DifferentialExpressionAnalysisConfig

      public DifferentialExpressionAnalysisConfig()
    • DifferentialExpressionAnalysisConfig

      public DifferentialExpressionAnalysisConfig(DifferentialExpressionAnalysisConfig baseConfig)
      Copy constructor.
  • Method Details

    • setContrastCoding

      public void setContrastCoding(ExperimentalFactor factor, ContrastCoding coding)
      Choose how one factor's levels are coded. Continuous factors have no levels and are rejected.
    • getContrastCoding

      public ContrastCoding getContrastCoding(ExperimentalFactor factor)
      How the given factor's levels are coded; ContrastCoding.TREATMENT unless set.
    • addFactorsToInclude

      public void addFactorsToInclude(Collection<ExperimentalFactor> factors)
    • setBlockingFactors

      public void setBlockingFactors(Collection<ExperimentalFactor> factors)
      Mark factors as blocking terms (subjects of a paired design). Categorical factors only; each must also be in factorsToInclude to reach the model.
    • addInteractionToInclude

      public void addInteractionToInclude(Collection<ExperimentalFactor> factors)
      Add an interaction of two factors to include in the analysis.

      A blocking factor (a paired-design subject term) cannot take part: subject-by-treatment terms are exactly what a mixed model is for, and this analyzer does not support those. Model the treatment effect with the subject as a pure block instead.

    • addInteractionsToInclude

      public void addInteractionsToInclude(Collection<Collection<ExperimentalFactor>> interactions)
    • getAnalysisType

      public AnalysisType getAnalysisType()
      Type of analysis to perform.
    • isModerateStatistics

      public boolean isModerateStatistics()
      Whether moderated test statistics should be used.

      This is usually done with the empirical Bayes method.

    • getFactorsToInclude

      public Set<ExperimentalFactor> getFactorsToInclude()
    • getContrastCoding

      public Map<ExperimentalFactor, ContrastCoding> getContrastCoding()
      How each categorical factor's levels are coded in the design matrix, which decides what its coefficients mean. A factor absent from this map is ContrastCoding.TREATMENT.

      Per factor rather than per analysis because the two codings answer different questions and a single model can want both: a genotype factor with a wild-type control is read against that control, while a tissue factor in the same design has no control to be read against and wants ContrastCoding.SUM_TO_ZERO, where every level is reported against the mean of the level means.

      See Also:
    • getInteractionsToInclude

      public Set<Set<ExperimentalFactor>> getInteractionsToInclude()
    • getBlockingFactors

      public Set<ExperimentalFactor> getBlockingFactors()
      Factors whose levels are blocking terms (e.g. subjects in a paired or repeated-measures design). Their columns stay in the design so every other factor's contrasts are adjusted for them, but the blocking factor itself gets no result set: the subject-to-subject differences are nuisance, not findings.

      Categorical factors only. The factor must still be in factorsToInclude; a factor here but not there is ignored with a warning. Explicit config overrides any curator hint the factor carries, and no blocking factor is guessed automatically.

      See Also:
    • isPersist

      public boolean isPersist()
      Indicate if this analysis should be persisted.
    • isDeleteOtherAnalyses

      public boolean isDeleteOtherAnalyses()
      After the new analyses are saved, delete the experiment's other analyses on the same subset factor: without a subset factor, every other analysis that is not a subset analysis; with one, every other analysis of that factor's subsets.

      Only a fresh run honours this, and only when persist is set. Nothing is deleted before the new analyses are saved, so a run that fails leaves the existing analyses in place.

    • getSubsetFactor

      @Nullable public ExperimentalFactor getSubsetFactor()
      Factor to subset the analysis on, if non-null.
    • getSubsetFactorValue

      @Nullable public FactorValue getSubsetFactorValue()
      If this is non-null, this is a subset analysis for this factor value.

      Only applicable for analysis on a ExpressionExperimentSubSet.

    • isIgnoreFailingSubsets

      public boolean isIgnoreFailingSubsets()
      Keep processing other subsets when encountering an AnalysisException on a subset.

      This is about carrying on when SOME subsets succeed. If no subset yields an analysis, an AllSubSetAnalysesFailedException is raised regardless of this setting — it carries whichever subset failures were collected, and a subset can also leave the loop skipped rather than failed (DE_Exclude, no samples left to analyze, or no factor the subset can model).

    • isUseWeights

      public boolean isUseWeights()
      Set true for RNA-seq data sets
    • getMinimumNumberOfCellsPerSample

      @Nullable public Integer getMinimumNumberOfCellsPerSample()
      Override the minimum number of cells for a particular sample to be included in the analysis.

      This is only applied if ExpressionDataDoubleMatrix.getNumberOfCells() or BioAssay.getNumberOfCells() is populated. Note that the BioAssay-level number of cells is only considered for preferred QTs.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_NUMBER_OF_CELLS_PER_SAMPLE.

    • getMinimumNumberOfCellsPerGene

      @Nullable public Integer getMinimumNumberOfCellsPerGene()
      Override the minimum number of cells for a particular gene to be included in the analysis.

      This is only applied if ExpressionDataDoubleMatrix.getNumberOfCells() is populated.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_NUMBER_OF_CELLS_PER_GENE.

    • getRepetitiveValuesFilterMode

      @Nullable public DifferentialExpressionAnalysisFilter.RepetitiveValuesFilterMode getRepetitiveValuesFilterMode()
    • getMinimumNumberOfSamplesToApplyRepetitiveValuesFilter

      @Nullable public Integer getMinimumNumberOfSamplesToApplyRepetitiveValuesFilter()
      Override the minimum number of samples to apply the repetitive value filter.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_NUMBER_OF_SAMPLES_TO_APPLY_REPETITIVE_VALUES_FILTER

    • getMinimumFractionOfUniqueValues

      @Nullable public Double getMinimumFractionOfUniqueValues()
      Override the minimum number of unique values (as a fraction of the number of assays) for a particular design element to be included in the analysis.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_FRACTION_OF_UNIQUE_VALUES.

    • getMinimumVariance

      @Nullable public Double getMinimumVariance()
      Override the minimum variance for a particular design element to be included in the analysis.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_VARIANCE.

    • isMakeArchiveFile

      public boolean isMakeArchiveFile()
      Whether to create archive files.
    • getMaxAnalysisTimeMillis

      public long getMaxAnalysisTimeMillis()
      Maximum time to spend on the analysis, in milliseconds. Ignored if zero or less.
    • isEstimateBlockingCorrelation

      public boolean isEstimateBlockingCorrelation()
      Fit the blocking factor as a random intercept (mixed model) instead of fixed-effect columns: the inter-block correlation is estimated from the data (limma duplicateCorrelation) and the fit runs by GLS (limma gls.series). The blocking factor then has NO columns in the design -- it lives in the correlation structure -- so its factor values are only used to assign samples to blocks.

      Requires blockingFactors to be non-empty and the data to be complete and unweighted: the per-observation gls.series branch (voom weights + correlation, or missing values + correlation) is not ported yet and the analyzer rejects the combination. Consensus correlation only (limma's default), not per-probe correlations.

    • setAnalysisType

      public void setAnalysisType(AnalysisType analysisType)
      Type of analysis to perform.
    • setModerateStatistics

      public void setModerateStatistics(boolean moderateStatistics)
      Whether moderated test statistics should be used.

      This is usually done with the empirical Bayes method.

    • setPersist

      public void setPersist(boolean persist)
      Indicate if this analysis should be persisted.
    • setDeleteOtherAnalyses

      public void setDeleteOtherAnalyses(boolean deleteOtherAnalyses)
      After the new analyses are saved, delete the experiment's other analyses on the same subset factor: without a subset factor, every other analysis that is not a subset analysis; with one, every other analysis of that factor's subsets.

      Only a fresh run honours this, and only when persist is set. Nothing is deleted before the new analyses are saved, so a run that fails leaves the existing analyses in place.

    • setSubsetFactor

      public void setSubsetFactor(@Nullable ExperimentalFactor subsetFactor)
      Factor to subset the analysis on, if non-null.
    • setSubsetFactorValue

      public void setSubsetFactorValue(@Nullable FactorValue subsetFactorValue)
      If this is non-null, this is a subset analysis for this factor value.

      Only applicable for analysis on a ExpressionExperimentSubSet.

    • setIgnoreFailingSubsets

      public void setIgnoreFailingSubsets(boolean ignoreFailingSubsets)
      Keep processing other subsets when encountering an AnalysisException on a subset.

      This is about carrying on when SOME subsets succeed. If no subset yields an analysis, an AllSubSetAnalysesFailedException is raised regardless of this setting — it carries whichever subset failures were collected, and a subset can also leave the loop skipped rather than failed (DE_Exclude, no samples left to analyze, or no factor the subset can model).

    • setUseWeights

      public void setUseWeights(boolean useWeights)
      Set true for RNA-seq data sets
    • setMinimumNumberOfCellsPerSample

      public void setMinimumNumberOfCellsPerSample(@Nullable Integer minimumNumberOfCellsPerSample)
      Override the minimum number of cells for a particular sample to be included in the analysis.

      This is only applied if ExpressionDataDoubleMatrix.getNumberOfCells() or BioAssay.getNumberOfCells() is populated. Note that the BioAssay-level number of cells is only considered for preferred QTs.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_NUMBER_OF_CELLS_PER_SAMPLE.

    • setMinimumNumberOfCellsPerGene

      public void setMinimumNumberOfCellsPerGene(@Nullable Integer minimumNumberOfCellsPerGene)
      Override the minimum number of cells for a particular gene to be included in the analysis.

      This is only applied if ExpressionDataDoubleMatrix.getNumberOfCells() is populated.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_NUMBER_OF_CELLS_PER_GENE.

    • setRepetitiveValuesFilterMode

      public void setRepetitiveValuesFilterMode(@Nullable DifferentialExpressionAnalysisFilter.RepetitiveValuesFilterMode repetitiveValuesFilterMode)
    • setMinimumNumberOfSamplesToApplyRepetitiveValuesFilter

      public void setMinimumNumberOfSamplesToApplyRepetitiveValuesFilter(@Nullable Integer minimumNumberOfSamplesToApplyRepetitiveValuesFilter)
      Override the minimum number of samples to apply the repetitive value filter.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_NUMBER_OF_SAMPLES_TO_APPLY_REPETITIVE_VALUES_FILTER

    • setMinimumFractionOfUniqueValues

      public void setMinimumFractionOfUniqueValues(@Nullable Double minimumFractionOfUniqueValues)
      Override the minimum number of unique values (as a fraction of the number of assays) for a particular design element to be included in the analysis.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_FRACTION_OF_UNIQUE_VALUES.

    • setMinimumVariance

      public void setMinimumVariance(@Nullable Double minimumVariance)
      Override the minimum variance for a particular design element to be included in the analysis.

      Defaults to DifferentialExpressionAnalysisFilter.DEFAULT_MINIMUM_VARIANCE.

    • setMakeArchiveFile

      public void setMakeArchiveFile(boolean makeArchiveFile)
      Whether to create archive files.
    • setMaxAnalysisTimeMillis

      public void setMaxAnalysisTimeMillis(long maxAnalysisTimeMillis)
      Maximum time to spend on the analysis, in milliseconds. Ignored if zero or less.
    • setEstimateBlockingCorrelation

      public void setEstimateBlockingCorrelation(boolean estimateBlockingCorrelation)
      Fit the blocking factor as a random intercept (mixed model) instead of fixed-effect columns: the inter-block correlation is estimated from the data (limma duplicateCorrelation) and the fit runs by GLS (limma gls.series). The blocking factor then has NO columns in the design -- it lives in the correlation structure -- so its factor values are only used to assign samples to blocks.

      Requires blockingFactors to be non-empty and the data to be complete and unweighted: the per-observation gls.series branch (voom weights + correlation, or missing values + correlation) is not ported yet and the analyzer rejects the combination. Consensus correlation only (limma's default), not per-probe correlations.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object