use of cern.colt.list.DoubleArrayList in project Gemma by PavlidisLab.
the class ExpressionExperimentQCController method getCorrelHistFromFile.
/**
* For backwards compatibility - read from the file. Remove this method when no longer needed.
*/
private XYSeries getCorrelHistFromFile(ExpressionExperiment ee) throws IOException {
File file = this.locateProbeCorrFile(ee);
// Current format is to have just one file for each analysis.
if (file == null) {
return null;
} else if (!file.canRead()) {
return null;
}
try (BufferedReader in = new BufferedReader(new FileReader(file))) {
XYSeries series = new XYSeries(ee.getId(), true, true);
DoubleArrayList counts = new DoubleArrayList();
while (in.ready()) {
String line = in.readLine().trim();
if (line.startsWith("#"))
continue;
String[] split = StringUtils.split(line);
if (split.length < 2)
continue;
try {
double x = Double.parseDouble(split[0]);
double y = Double.parseDouble(split[1]);
series.add(x, y);
counts.add(y);
} catch (NumberFormatException e) {
// line wasn't useable.. no big deal. Heading is included.
}
}
if (!counts.isEmpty()) {
// Backfill.
this.corrDistFileToPersistent(file, ee, counts);
}
return series;
}
}
use of cern.colt.list.DoubleArrayList in project Gemma by PavlidisLab.
the class ExpressionExperimentQCController method getEigenGene.
/**
* Get the eigengene for the given component.
* The values are rescaled so that jfreechart can cope. Small numbers give it fits.
*/
private Double[] getEigenGene(SVDValueObject svdo, Integer component) {
DoubleArrayList eigenGeneL = new DoubleArrayList(ArrayUtils.toPrimitive(svdo.getvMatrix().getColObj(component)));
DescriptiveWithMissing.standardize(eigenGeneL);
return ArrayUtils.toObject(eigenGeneL.elements());
}
use of cern.colt.list.DoubleArrayList in project beast-mcmc by beast-dev.
the class KernelDensityEstimator2D method bandwidthNRD.
// bandwidth.nrd =
// function (x)
// {
// r <- quantile(x, c(0.25, 0.75))
// h <- (r[2] - r[1])/1.34
// 4 * 1.06 * min(sqrt(var(x)), h) * length(x)^(-1/5)
// }
public double bandwidthNRD(double[] in) {
DoubleArrayList inList = new DoubleArrayList(in.length);
for (double d : in) inList.add(d);
inList.sort();
final double h = (Descriptive.quantile(inList, 0.75) - Descriptive.quantile(inList, 0.25)) / 1.34;
return 4 * 1.06 * Math.min(Math.sqrt(DiscreteStatistics.variance(in)), h) * Math.pow(in.length, -0.2);
}
use of cern.colt.list.DoubleArrayList in project EnrichmentMapApp by BaderLab.
the class HeatMapTableModel method median.
private static double median(double[] vals) {
if (vals.length == 0)
return 0.0;
// DoubleArrayList is just a wrapper for vals, we must make a copy of the array
// before sorting or else the expression values will be moved to the wrong order.
double[] copy = Arrays.copyOf(vals, vals.length);
Arrays.sort(copy);
return Descriptive.median(new DoubleArrayList(copy));
}
use of cern.colt.list.DoubleArrayList in project Gemma by PavlidisLab.
the class ProcessedExpressionDataVectorCreateHelperServiceImpl method computeRanks.
private Collection<ProcessedExpressionDataVector> computeRanks(Collection<ProcessedExpressionDataVector> processedDataVectors, ExpressionDataDoubleMatrix intensities) {
DoubleArrayList ranksByMean = this.getRanks(intensities, ProcessedExpressionDataVectorDao.RankMethod.mean);
assert ranksByMean != null;
DoubleArrayList ranksByMax = this.getRanks(intensities, ProcessedExpressionDataVectorDao.RankMethod.max);
assert ranksByMax != null;
for (ProcessedExpressionDataVector vector : processedDataVectors) {
CompositeSequence de = vector.getDesignElement();
if (intensities.getRow(de) == null) {
ProcessedExpressionDataVectorCreateHelperServiceImpl.log.warn("No intensity value for " + de + ", rank for vector will be null");
vector.setRankByMean(null);
vector.setRankByMax(null);
continue;
}
Integer i = intensities.getRowIndex(de);
double rankByMean = ranksByMean.get(i) / ranksByMean.size();
double rankByMax = ranksByMax.get(i) / ranksByMax.size();
vector.setRankByMean(rankByMean);
vector.setRankByMax(rankByMax);
}
return processedDataVectors;
}
Aggregations