Class ExperimentalDesignUtils
- java.lang.Object
-
- ubic.gemma.model.expression.experiment.ExperimentalDesignUtils
-
public class ExperimentalDesignUtils extends Object
- Author:
- paul
-
-
Field Summary
Fields Modifier and Type Field Description static String
BATCH_FACTOR_CATEGORY_NAME
static String
BATCH_FACTOR_CATEGORY_URI
static String
BATCH_FACTOR_NAME
static String
BATCH_FACTOR_NAME_PREFIX
static String
FACTOR_VALUE_RNAME_PREFIX
-
Constructor Summary
Constructors Constructor Description ExperimentalDesignUtils()
-
Method Summary
-
-
-
Field Detail
-
BATCH_FACTOR_CATEGORY_NAME
public static final String BATCH_FACTOR_CATEGORY_NAME
- See Also:
- Constant Field Values
-
BATCH_FACTOR_CATEGORY_URI
public static final String BATCH_FACTOR_CATEGORY_URI
- See Also:
- Constant Field Values
-
BATCH_FACTOR_NAME
public static final String BATCH_FACTOR_NAME
- See Also:
- Constant Field Values
-
BATCH_FACTOR_NAME_PREFIX
public static final String BATCH_FACTOR_NAME_PREFIX
- See Also:
- Constant Field Values
-
FACTOR_VALUE_RNAME_PREFIX
public static final String FACTOR_VALUE_RNAME_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
isComplete
public static boolean isComplete(ExperimentalFactor factor, List<BioMaterial> samplesUsed, Map<ExperimentalFactor,FactorValue> baselines)
Check if a factor has missing values (samples that lack an assigned value)- Parameters:
baselines
- not really important for thissamplesUsed
- the samples usedfactor
- the factor- Returns:
- false if there are any missing values.
-
buildDesignMatrix
public static ObjectMatrix<String,String,Object> buildDesignMatrix(List<ExperimentalFactor> factors, List<BioMaterial> samplesUsed, Map<ExperimentalFactor,FactorValue> baselines)
Convert factors to a matrix usable in R. The rows are in the same order as the columns of our data matrix (defined by samplesUsed).- Parameters:
factors
- in the order they will be usedsamplesUsed
- the samples usedbaselines
- the baselines- Returns:
- a design matrix
-
factorsWithoutBatch
public static Collection<ExperimentalFactor> factorsWithoutBatch(Collection<ExperimentalFactor> factors)
- Parameters:
factors
- factors- Returns:
- a new collection (same order as the input)
-
getBaselineConditions
public static Map<ExperimentalFactor,FactorValue> getBaselineConditions(List<BioMaterial> samplesUsed, List<ExperimentalFactor> factors)
-
getOrderedSamples
public static List<BioMaterial> getOrderedSamples(ExpressionDataDoubleMatrix dmatrix, List<ExperimentalFactor> factors)
This puts the control samples up front if possible.- Parameters:
factors
- factorsdmatrix
- data matrix- Returns:
- ordered samples
-
isBatch
public static boolean isBatch(ExperimentalFactor ef)
- Parameters:
ef
- experimental factor- Returns:
- true if this factor appears to be a "batch" factor.
-
isBatch
public static boolean isBatch(ExperimentalFactorValueObject ef)
- Parameters:
ef
- experimental factor- Returns:
- true if this factor appears to be a "batch" factor.
-
isContinuous
public static boolean isContinuous(ExperimentalFactor ef)
- Parameters:
ef
- experimental factor- Returns:
- true if the factor is continuous; false if it looks to be categorical.
-
nameForR
public static String nameForR(ExperimentalFactor experimentalFactor)
-
nameForR
public static String nameForR(FactorValue fv, boolean isBaseline)
-
sampleInfoMatrix
public static ObjectMatrix<BioMaterial,ExperimentalFactor,Object> sampleInfoMatrix(List<ExperimentalFactor> factors, List<BioMaterial> samplesUsed, Map<ExperimentalFactor,FactorValue> baselines)
- Parameters:
factors
- factorsbaselines
- baselinessamplesUsed
- the samples used- Returns:
- Experimental design matrix
-
sortFactors
public static List<ExperimentalFactor> sortFactors(Collection<ExperimentalFactor> factors)
Sort factors in a consistent way.- Parameters:
factors
- factors- Returns:
- sorted factors
-
-