use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.
the class ExpressionExperimentDaoImpl method removeProcessedVectors.
private void removeProcessedVectors(Session session, Set<BioAssayDimension> dims, Set<QuantitationType> qts, int count, Collection<ProcessedExpressionDataVector> processedVectors) {
for (ProcessedExpressionDataVector dv : processedVectors) {
BioAssayDimension bad = dv.getBioAssayDimension();
dims.add(bad);
QuantitationType qt = dv.getQuantitationType();
qts.add(qt);
dv.setBioAssayDimension(null);
dv.setQuantitationType(null);
session.delete(dv);
if (++count % 1000 == 0) {
session.flush();
}
if (count % 20000 == 0) {
AbstractDao.log.info(count + " processed design Element data vectors deleted");
}
// put back..
dv.setBioAssayDimension(bad);
dv.setQuantitationType(qt);
}
}
use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.
the class QuantitationTypeData method getPreferredDataVectors.
/**
* @return The 'preferred' data vectors - NOT the processed data vectors!
*/
private Collection<DesignElementDataVector> getPreferredDataVectors() {
Collection<DesignElementDataVector> result = new HashSet<>();
List<BioAssayDimension> dimensions = this.getBioAssayDimensions();
List<QuantitationType> qtypes = this.getPreferredQTypes();
for (DesignElementDataVector vector : vectors) {
if (!(vector instanceof ProcessedExpressionDataVector) && dimensions.contains(vector.getBioAssayDimension()) && qtypes.contains(vector.getQuantitationType()))
result.add(vector);
}
return result;
}
use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.
the class QuantitationTypeData method getProcessedDataVectors.
/**
* @return Collection of <em>ProcessedExpressionDataVector</em>s.
*/
private Collection<ProcessedExpressionDataVector> getProcessedDataVectors() {
if (this.processedDataVectors != null) {
return this.processedDataVectors;
}
Collection<ProcessedExpressionDataVector> result = new HashSet<>();
List<BioAssayDimension> dimensions = this.getBioAssayDimensions();
List<QuantitationType> qtypes = this.getPreferredQTypes();
for (DesignElementDataVector vector : vectors) {
if (vector instanceof ProcessedExpressionDataVector && dimensions.contains(vector.getBioAssayDimension()) && qtypes.contains(vector.getQuantitationType()))
result.add((ProcessedExpressionDataVector) vector);
}
return result;
}
use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.
the class ProcessedExpressionDataVectorCreateHelperServiceImpl method updateRanks.
/**
* @return expression ranks based on computed intensities
*/
@Override
public ExpressionExperiment updateRanks(ExpressionExperiment ee) {
ee = expressionExperimentDao.thaw(ee);
Collection<ProcessedExpressionDataVector> processedVectors = ee.getProcessedExpressionDataVectors();
processedExpressionDataVectorService.thaw(processedVectors);
StopWatch timer = new StopWatch();
timer.start();
ExpressionDataDoubleMatrix intensities = this.loadIntensities(ee, processedVectors);
if (intensities == null) {
return ee;
}
ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Load intensities: " + timer.getTime() + "ms");
Collection<ProcessedExpressionDataVector> updatedVectors = this.computeRanks(processedVectors, intensities);
if (updatedVectors == null) {
ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Could not get preferred data vectors, not updating ranks data");
return ee;
}
ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Updating ranks data for " + updatedVectors.size() + " vectors ...");
this.processedExpressionDataVectorService.update(updatedVectors);
ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Done");
return ee;
}
use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector 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