Search in sources :

Example 1 with BatchConfoundValueObject

use of ubic.gemma.core.analysis.preprocess.batcheffects.BatchConfoundValueObject in project Gemma by PavlidisLab.

the class ExpressionExperimentServiceImpl method getBatchConfound.

@Override
@Transactional(readOnly = true)
public String getBatchConfound(ExpressionExperiment ee) {
    ee = this.thawBioAssays(ee);
    if (!this.checkHasBatchInfo(ee)) {
        return null;
    }
    Collection<BatchConfoundValueObject> confounds;
    try {
        confounds = BatchConfound.test(ee);
    } catch (NotStrictlyPositiveException e) {
        AbstractService.log.error("Batch confound test threw a NonStrictlyPositiveException! Returning null.");
        return null;
    }
    StringBuilder result = new StringBuilder("");
    for (BatchConfoundValueObject c : confounds) {
        if (c.getP() < ExpressionExperimentServiceImpl.BATCH_CONFOUND_THRESHOLD) {
            String factorName = c.getEf().getName();
            if (!result.toString().isEmpty()) {
                result.append(", ");
            }
            result.append("Factor '").append(factorName).append("' may be confounded with batches; p=").append(String.format("%.2g", c.getP()));
        }
    }
    return Strings.emptyToNull(result.toString());
}
Also used : NotStrictlyPositiveException(org.apache.commons.math3.exception.NotStrictlyPositiveException) BatchConfoundValueObject(ubic.gemma.core.analysis.preprocess.batcheffects.BatchConfoundValueObject) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

NotStrictlyPositiveException (org.apache.commons.math3.exception.NotStrictlyPositiveException)1 Transactional (org.springframework.transaction.annotation.Transactional)1 BatchConfoundValueObject (ubic.gemma.core.analysis.preprocess.batcheffects.BatchConfoundValueObject)1