use of ubic.basecode.math.distribution.Histogram in project Gemma by PavlidisLab.
the class DifferentialExpressionResultDaoImpl method loadPvalueDistribution.
@Override
public Histogram loadPvalueDistribution(Long resultSetId) {
List<?> pvds = this.getHibernateTemplate().findByNamedParam("select rs.pvalueDistribution from ExpressionAnalysisResultSet rs where rs.id=:rsid ", "rsid", resultSetId);
if (pvds.isEmpty()) {
return null;
}
assert pvds.size() == 1;
PvalueDistribution pvd = (PvalueDistribution) pvds.get(0);
ByteArrayConverter bac = new ByteArrayConverter();
double[] counts = bac.byteArrayToDoubles(pvd.getBinCounts());
Integer numBins = pvd.getNumBins();
assert numBins == counts.length;
Histogram hist = new Histogram(resultSetId.toString(), numBins, 0.0, 1.0);
for (int i = 0; i < numBins; i++) {
hist.fill(i, (int) counts[i]);
}
return hist;
}
Aggregations