Search in sources :

Example 1 with DesignMatrix

use of ubic.basecode.math.linearmodels.DesignMatrix in project Gemma by PavlidisLab.

the class ComBat method computeDesignMatrix.

/**
 * ComBat parameterizes the model without an intercept, instead using all possible columns for batch (what the heck
 * do you call this parameterization?) This is important. Each batch has its own parameter.
 *
 * @return double matrix 2d
 */
private DoubleMatrix2D computeDesignMatrix() {
    DoubleMatrix2D design;
    /*
         * Find the batch
         */
    DesignMatrix d = null;
    int batchFactorColumnIndex = sampleInfo.getColIndexByName(ComBat.BATCH_COLUMN_NAME);
    Object[] batchFactor = sampleInfo.getColumn(batchFactorColumnIndex);
    if (batchFactor != null) {
        d = new DesignMatrix(batchFactor, 1, ComBat.BATCH_COLUMN_NAME);
    }
    if (d == null) {
        throw new IllegalStateException("No batch factor was found");
    }
    ObjectMatrix<String, String, Object> sampleInfoWithoutBatchFactor = this.getSampleInfoWithoutBatchFactor(batchFactorColumnIndex);
    d.add(sampleInfoWithoutBatchFactor);
    design = d.getDoubleMatrix();
    return design;
}
Also used : DoubleMatrix2D(cern.colt.matrix.DoubleMatrix2D) DenseDoubleMatrix2D(cern.colt.matrix.impl.DenseDoubleMatrix2D) DesignMatrix(ubic.basecode.math.linearmodels.DesignMatrix)

Aggregations

DoubleMatrix2D (cern.colt.matrix.DoubleMatrix2D)1 DenseDoubleMatrix2D (cern.colt.matrix.impl.DenseDoubleMatrix2D)1 DesignMatrix (ubic.basecode.math.linearmodels.DesignMatrix)1