use of uk.ac.bbsrc.tgac.miso.core.data.Pair in project miso-lims by miso-lims.
the class RunRestController method getPotentialExperiments.
@GetMapping("/{runId}/potentialExperiments")
@ResponseBody
public List<StudiesForExperiment> getPotentialExperiments(@PathVariable long runId) throws IOException {
Run run = getRun(runId);
RunDto runDto = Dtos.asDto(run);
InstrumentModelDto instrumentModelDto = Dtos.asDto(run.getSequencer().getInstrumentModel());
Map<Library, List<Partition>> libraryGroups = getLibraryGroups(run);
return libraryGroups.entrySet().stream().map(group -> new Pair<>(group.getKey(), group.getValue().stream().map(partition -> Dtos.asDto(partition, indexChecker)).map(partitionDto -> new RunPartitionDto(runDto, partitionDto)).collect(Collectors.toList()))).map(group -> {
StudiesForExperiment result = new StudiesForExperiment();
result.experiment = new ExperimentDto();
result.experiment.setLibrary(Dtos.asDto(group.getKey(), false));
result.experiment.setInstrumentModel(instrumentModelDto);
result.experiment.setPartitions(group.getValue());
result.studies = group.getKey().getSample().getProject().getStudies().stream().map(Dtos::asDto).collect(Collectors.toList());
return result;
}).collect(Collectors.toList());
}
Aggregations