use of ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentControllerTest method testLoadStatusSummariesLimit.
@Test
public void testLoadStatusSummariesLimit() {
ArrayList<Long> ids = new ArrayList<>();
int limit;
// Default ordering is by date last updated
ExpressionExperiment lastUpdated = null;
for (int i = 0; i < 2; i++) {
ExpressionExperiment ee = this.getTestPersistentCompleteExpressionExperiment(false);
if (lastUpdated == null || lastUpdated.getCurationDetails().getLastUpdated().before(ee.getCurationDetails().getLastUpdated())) {
lastUpdated = ee;
}
ids.add(ee.getId());
}
limit = 1;
Collection<ExpressionExperimentDetailsValueObject> ret = eeController.loadStatusSummaries(-1L, ids, limit, null, true);
assertEquals(1, ret.size());
ExpressionExperimentDetailsValueObject out = ret.iterator().next();
assertEquals(lastUpdated.getId(), out.getId());
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentReportServiceImpl method populateEventInformation.
/**
* Fills in event and security information from the database. This will only retrieve the latest event (if any).
* This is rather slow so should be avoided if the information isn't needed.
*/
@Override
public void populateEventInformation(Collection<ExpressionExperimentDetailsValueObject> vos) {
StopWatch timer = new StopWatch();
timer.start();
Collection<Long> ids = EntityUtils.getIds(vos);
// do this ahead to avoid round trips - this also filters...
Collection<ExpressionExperiment> ees = expressionExperimentService.load(ids);
if (ees.size() == 0) {
return;
}
Map<Long, ExpressionExperiment> eeMap = EntityUtils.getIdMap(ees);
Map<Long, Date> lastArrayDesignUpdates = expressionExperimentService.getLastArrayDesignUpdate(ees);
Collection<Class<? extends AuditEventType>> typesToGet = Arrays.asList(eventTypes);
Map<Class<? extends AuditEventType>, Map<Auditable, AuditEvent>> events = this.getEvents(ees, typesToGet);
Map<Auditable, AuditEvent> linkAnalysisEvents = events.get(LinkAnalysisEvent.class);
Map<Auditable, AuditEvent> missingValueAnalysisEvents = events.get(MissingValueAnalysisEvent.class);
Map<Auditable, AuditEvent> rankComputationEvents = events.get(ProcessedVectorComputationEvent.class);
Map<Auditable, AuditEvent> differentialAnalysisEvents = events.get(DifferentialExpressionAnalysisEvent.class);
Map<Auditable, AuditEvent> batchFetchEvents = events.get(BatchInformationFetchingEvent.class);
Map<Auditable, AuditEvent> pcaAnalysisEvents = events.get(PCAAnalysisEvent.class);
Map<Long, Collection<AuditEvent>> sampleRemovalEvents = this.getSampleRemovalEvents(ees);
/*
* add in the last events of interest for all eeVos This step is remarkably slow.
*/
for (ExpressionExperimentDetailsValueObject eeVo : vos) {
Long id = eeVo.getId();
ExpressionExperiment ee = eeMap.get(id);
if (linkAnalysisEvents.containsKey(ee)) {
AuditEvent event = linkAnalysisEvents.get(ee);
if (event != null) {
Date date = event.getDate();
eeVo.setDateLinkAnalysis(date);
eeVo.setLinkAnalysisEventType(event.getEventType().getClass().getSimpleName());
}
}
if (missingValueAnalysisEvents.containsKey(ee)) {
AuditEvent event = missingValueAnalysisEvents.get(ee);
if (event != null) {
Date date = event.getDate();
eeVo.setDateMissingValueAnalysis(date);
eeVo.setMissingValueAnalysisEventType(event.getEventType().getClass().getSimpleName());
}
}
if (rankComputationEvents.containsKey(ee)) {
AuditEvent event = rankComputationEvents.get(ee);
if (event != null) {
Date date = event.getDate();
eeVo.setDateProcessedDataVectorComputation(date);
eeVo.setProcessedDataVectorComputationEventType(event.getEventType().getClass().getSimpleName());
}
}
if (differentialAnalysisEvents.containsKey(ee)) {
AuditEvent event = differentialAnalysisEvents.get(ee);
if (event != null) {
Date date = event.getDate();
eeVo.setDateDifferentialAnalysis(date);
}
}
if (pcaAnalysisEvents.containsKey(ee)) {
AuditEvent event = pcaAnalysisEvents.get(ee);
if (event != null) {
Date date = event.getDate();
eeVo.setDatePcaAnalysis(date);
eeVo.setPcaAnalysisEventType(event.getEventType().getClass().getSimpleName());
}
}
if (batchFetchEvents.containsKey(ee)) {
AuditEvent event = batchFetchEvents.get(ee);
if (event != null) {
Date date = event.getDate();
eeVo.setDateBatchFetch(date);
eeVo.setBatchFetchEventType(event.getEventType().getClass().getSimpleName());
}
}
if (lastArrayDesignUpdates.containsKey(id)) {
Date date = lastArrayDesignUpdates.get(id);
eeVo.setDateArrayDesignLastUpdated(date);
}
if (sampleRemovalEvents.containsKey(id)) {
Collection<AuditEvent> removalEvents = sampleRemovalEvents.get(id);
// we find we are getting lazy-load exceptions from this guy.
eeVo.auditEvents2SampleRemovedFlags(removalEvents);
}
}
if (timer.getTime() > 1000)
log.info("Retrieving audit events took " + timer.getTime() + "ms");
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentReportServiceImpl method getStats.
/**
* Compute statistics for EEs, that aren't immediately part of the value object.
*/
private void getStats(Collection<ExpressionExperimentDetailsValueObject> vos) {
log.debug("Getting stats for " + vos.size() + " value objects.");
int count = 0;
for (ExpressionExperimentDetailsValueObject object : vos) {
this.getStats(object);
if (++count % 10 == 0) {
log.debug("Processed " + count + " reports.");
}
}
log.debug("Done, processed " + count + " reports");
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentReportServiceImpl method retrieveSummaryObjects.
@Override
public Collection<ExpressionExperimentDetailsValueObject> retrieveSummaryObjects(Collection<Long> ids) {
Collection<ExpressionExperimentDetailsValueObject> eeValueObjects = new ArrayList<>();
Collection<Long> filteredIds = this.securityFilterExpressionExperimentIds(ids);
int incache = 0;
for (Long id : filteredIds) {
Element cachedElement = this.statsCache.get(id);
if (cachedElement != null) {
incache++;
Object el = cachedElement.getObjectValue();
assert el instanceof ExpressionExperimentDetailsValueObject;
eeValueObjects.add((ExpressionExperimentDetailsValueObject) el);
continue;
}
ExpressionExperimentDetailsValueObject valueObject = this.generateSummary(id);
eeValueObjects.add(valueObject);
}
if (ids.size() > 1) {
log.info(incache + "/" + ids.size() + " reports were found in the cache");
}
return eeValueObjects;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentReportServiceImpl method getAnnotationInformation.
/**
* Populate information about how many annotations there are, and how many factor values there are. Batch is not
* counted towards the number of factors
*/
@Override
public void getAnnotationInformation(Collection<ExpressionExperimentDetailsValueObject> vos) {
StopWatch timer = new StopWatch();
timer.start();
Collection<Long> ids = new HashSet<>();
for (ExpressionExperimentDetailsValueObject eeVo : vos) {
Long id = eeVo.getId();
ids.add(id);
}
Map<Long, Integer> annotationCounts = expressionExperimentService.getAnnotationCounts(ids);
Map<Long, Integer> factorCounts = expressionExperimentService.getPopulatedFactorCountsExcludeBatch(ids);
for (ExpressionExperimentDetailsValueObject eeVo : vos) {
Long id = eeVo.getId();
eeVo.setNumAnnotations(annotationCounts.get(id));
eeVo.setNumPopulatedFactors(factorCounts.get(id));
}
if (timer.getTime() > 1000) {
log.info("Fill annotation information: " + timer.getTime() + "ms");
}
}
Aggregations