use of ubic.gemma.model.analysis.expression.coexpression.CoexpCorrelationDistribution in project Gemma by PavlidisLab.
the class ExpressionExperimentQCController method corrDistFileToPersistent.
/**
* For conversion from legacy system.
*/
private void corrDistFileToPersistent(File file, ExpressionExperiment ee, DoubleArrayList counts) {
log.info("Converting from pvalue distribution file to persistent stored version");
ByteArrayConverter bac = new ByteArrayConverter();
Double[] countArray = (Double[]) counts.toList().toArray(new Double[] {});
byte[] bytes = bac.doubleArrayToBytes(countArray);
CoexpCorrelationDistribution coexpd = CoexpCorrelationDistribution.Factory.newInstance();
coexpd.setNumBins(counts.size());
coexpd.setBinCounts(bytes);
try {
coexpressionAnalysisService.addCoexpCorrelationDistribution(ee, coexpd);
if (file.delete()) {
log.info("Old file deleted");
} else {
log.info("Old file could not be deleted");
}
} catch (Exception e) {
log.info("Could not save the corr dist: " + e.getMessage());
}
}
use of ubic.gemma.model.analysis.expression.coexpression.CoexpCorrelationDistribution in project Gemma by PavlidisLab.
the class ExpressionExperimentQCController method getCorrelHist.
/**
* @return JFreeChart XYSeries representing the histogram.
* @throws FileNotFoundException - only if the coexp dist is being read from a file; when migration to db storage is
* complete this can be removed
* @throws IOException - only if the coexp dist is being read from a file; when migration to db storage is complete
* this can be removed
*/
private XYSeries getCorrelHist(ExpressionExperiment ee) throws IOException {
CoexpCorrelationDistribution coexpCorrelationDistribution = coexpressionAnalysisService.getCoexpCorrelationDistribution(ee);
if (coexpCorrelationDistribution == null) {
// try to get it from the file.
return this.getCorrelHistFromFile(ee);
}
XYSeries series = new XYSeries(ee.getId(), true, true);
byte[] binCountsBytes = coexpCorrelationDistribution.getBinCounts();
ByteArrayConverter bac = new ByteArrayConverter();
double[] binCounts = bac.byteArrayToDoubles(binCountsBytes);
Integer numBins = coexpCorrelationDistribution.getNumBins();
double step = 2.0 / numBins;
double lim = -1.0;
for (double d : binCounts) {
series.add(lim, d);
lim += step;
}
return series;
}
use of ubic.gemma.model.analysis.expression.coexpression.CoexpCorrelationDistribution in project Gemma by PavlidisLab.
the class LinkAnalysis method getCorrelationDistribution.
public CoexpCorrelationDistribution getCorrelationDistribution() {
CoexpCorrelationDistribution result = CoexpCorrelationDistribution.Factory.newInstance();
DoubleArrayList histogramArrayList = this.metricMatrix.getHistogramArrayList();
result.setNumBins(histogramArrayList.size());
ByteArrayConverter bac = new ByteArrayConverter();
result.setBinCounts(bac.doubleArrayToBytes(MatrixUtil.fromList(histogramArrayList).toArray()));
return result;
}
use of ubic.gemma.model.analysis.expression.coexpression.CoexpCorrelationDistribution in project Gemma by PavlidisLab.
the class LinkAnalysisServiceImpl method analyze.
private void analyze(ExpressionExperiment ee, FilterConfig filterConfig, LinkAnalysisConfig linkAnalysisConfig, LinkAnalysis la, Collection<ProcessedExpressionDataVector> dataVectors) {
this.qcCheck(linkAnalysisConfig, ee);
ExpressionDataDoubleMatrix datamatrix = expressionDataMatrixService.getFilteredMatrix(ee, filterConfig, dataVectors);
this.setUpForAnalysis(ee, la, dataVectors, datamatrix);
Map<CompositeSequence, Set<Gene>> probeToGeneMap = la.getProbeToGeneMap();
assert !probeToGeneMap.isEmpty();
/*
* remove probes that have no gene mapped to them, not just those that have no sequence
*/
datamatrix = this.filterUnmappedProbes(datamatrix, probeToGeneMap);
this.checkDatamatrix(datamatrix);
LinkAnalysisServiceImpl.log.info("Starting link analysis... " + ee);
this.normalize(datamatrix, linkAnalysisConfig);
/*
* Link analysis section.
*/
this.addAnalysisObj(ee, filterConfig, linkAnalysisConfig, la);
la.analyze();
CoexpCorrelationDistribution corrDist = la.getCorrelationDistribution();
// another qc check.
if (linkAnalysisConfig.isCheckCorrelationDistribution()) {
this.diagnoseCorrelationDistribution(ee, corrDist);
}
}
Aggregations