Search in sources :

Example 1 with ExpressionExperimentDetailsValueObject

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());
}
Also used : ArrayList(java.util.ArrayList) ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Test(org.junit.Test) BaseSpringWebTest(ubic.gemma.web.util.BaseSpringWebTest)

Example 2 with ExpressionExperimentDetailsValueObject

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");
}
Also used : Auditable(ubic.gemma.model.common.Auditable) ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) StopWatch(org.apache.commons.lang3.time.StopWatch) AuditEvent(ubic.gemma.model.common.auditAndSecurity.AuditEvent)

Example 3 with ExpressionExperimentDetailsValueObject

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");
}
Also used : ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject)

Example 4 with ExpressionExperimentDetailsValueObject

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;
}
Also used : Element(net.sf.ehcache.Element) ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject) ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject) DifferentialExpressionAnalysisValueObject(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysisValueObject) ExpressionExperimentValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject)

Example 5 with ExpressionExperimentDetailsValueObject

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");
    }
}
Also used : ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject) StopWatch(org.apache.commons.lang3.time.StopWatch)

Aggregations

ExpressionExperimentDetailsValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject)11 ExpressionExperimentValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject)4 StopWatch (org.apache.commons.lang3.time.StopWatch)3 Test (org.junit.Test)3 BaseSpringWebTest (ubic.gemma.web.util.BaseSpringWebTest)3 Element (net.sf.ehcache.Element)2 ArrayDesignValueObject (ubic.gemma.model.expression.arrayDesign.ArrayDesignValueObject)2 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 StopWatch (org.springframework.util.StopWatch)1 Condition (ubic.gemma.core.tasks.visualization.DifferentialExpressionGenesConditionsValueObject.Condition)1 DifferentialExpressionAnalysisValueObject (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysisValueObject)1 Auditable (ubic.gemma.model.common.Auditable)1 AuditEvent (ubic.gemma.model.common.auditAndSecurity.AuditEvent)1 ExperimentalFactorValueObject (ubic.gemma.model.expression.experiment.ExperimentalFactorValueObject)1 FactorValueValueObject (ubic.gemma.model.expression.experiment.FactorValueValueObject)1 Gene (ubic.gemma.model.genome.Gene)1