// wait till all tasks are finished
for (Future<ProcessBunchOfReadsTask.Result> result : results) {
ProcessBunchOfReadsTask.Result taskResult = result.get();
Collection<SingleReadData> dataset = taskResult.getReadAlignmentData();
for (SingleReadData rd : dataset) {
BamGenomeWindow w = openWindows.get(rd.getWindowStart());
w.addReadAlignmentData(rd);
}
bamStats.addReadStatsData( taskResult.getReadStatsCollector() );
if (selectedRegionsAvailable && computeOutsideStats) {
Collection<SingleReadData> outsideData = taskResult.getOutOfRegionReadsData();
for (SingleReadData rd : outsideData) {
BamGenomeWindow w = openOutsideWindows.get( rd.getWindowStart() );
w.addReadAlignmentData(rd);
}
outsideBamStats.addReadStatsData( taskResult.getOutRegionReadStatsCollector() );
}
}