use of ubic.gemma.persistence.service.analysis.expression.diff.MissingResult in project Gemma by PavlidisLab.
the class DifferentialExpressionSearchTaskImpl method getDetailsForContrasts.
/**
* Retrieve the details (contrasts) for results which meet the criterion. (PVALUE_CONTRAST_SELECT_THRESHOLD).
* Requires a database hit.
*
* @param diffExResults results
* @return map
*/
private Map<Long, ContrastsValueObject> getDetailsForContrasts(Collection<DiffExprGeneSearchResult> diffExResults) {
StopWatch timer = new StopWatch();
timer.start();
List<Long> resultsWithContrasts = new ArrayList<>();
for (DiffExprGeneSearchResult r : diffExResults) {
if (r.getResultId() == null) {
// it is a dummy result. It means there is no result for this gene in this resultset.
continue;
}
// Here I am trying to avoid fetching them when there is no hope that the results will be interesting.
if (r instanceof MissingResult || r instanceof NonRetainedResult || r.getCorrectedPvalue() > DifferentialExpressionSearchTaskImpl.PVALUE_CONTRAST_SELECT_THRESHOLD) {
// Then it won't have contrasts; no need to fetch.
continue;
}
resultsWithContrasts.add(r.getResultId());
}
Map<Long, ContrastsValueObject> detailedResults = new HashMap<>();
if (!resultsWithContrasts.isEmpty()) {
// uses a left join so it will have all the results.
detailedResults = differentialExpressionResultService.loadContrastDetailsForResults(resultsWithContrasts);
}
timer.stop();
if (timer.getTotalTimeMillis() > 1) {
DifferentialExpressionSearchTaskImpl.log.info("Fetch contrasts for " + resultsWithContrasts.size() + " results: " + timer.getTotalTimeMillis() + "ms");
}
return detailedResults;
}
Aggregations