Search in sources :

Example 1 with Pair

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());
}
Also used : RunPurposeService(uk.ac.bbsrc.tgac.miso.core.service.RunPurposeService) PathVariable(org.springframework.web.bind.annotation.PathVariable) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) RequestParam(org.springframework.web.bind.annotation.RequestParam) SampleTissueProcessing(uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing) PaginationFilter(uk.ac.bbsrc.tgac.miso.core.util.PaginationFilter) DataTablesResponseDto(uk.ac.bbsrc.tgac.miso.dto.DataTablesResponseDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SampleSheet(uk.ac.bbsrc.tgac.miso.core.util.SampleSheet) RunPartition(uk.ac.bbsrc.tgac.miso.core.data.RunPartition) Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) RunPartitionDto(uk.ac.bbsrc.tgac.miso.dto.ExperimentDto.RunPartitionDto) PutMapping(org.springframework.web.bind.annotation.PutMapping) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) Map(java.util.Map) SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) PartitionQCType(uk.ac.bbsrc.tgac.miso.core.data.PartitionQCType) RunPartitionAliquotService(uk.ac.bbsrc.tgac.miso.core.service.RunPartitionAliquotService) ValidationException(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException) PostMapping(org.springframework.web.bind.annotation.PostMapping) SampleService(uk.ac.bbsrc.tgac.miso.core.service.SampleService) PoolDto(uk.ac.bbsrc.tgac.miso.dto.PoolDto) AdvancedSearchParser(uk.ac.bbsrc.tgac.miso.webapp.controller.component.AdvancedSearchParser) HttpHeaders(org.springframework.http.HttpHeaders) ListLibraryAliquotView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView) Collection(java.util.Collection) MediaType(org.springframework.http.MediaType) ExperimentDto(uk.ac.bbsrc.tgac.miso.dto.ExperimentDto) Partition(uk.ac.bbsrc.tgac.miso.core.data.Partition) Collectors(java.util.stream.Collectors) IndexChecker(uk.ac.bbsrc.tgac.miso.core.util.IndexChecker) RunLibrarySpreadsheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.RunLibrarySpreadsheets) Objects(java.util.Objects) LibraryDto(uk.ac.bbsrc.tgac.miso.dto.LibraryDto) List(java.util.List) HttpEntity(org.springframework.http.HttpEntity) MisoWebUtils(uk.ac.bbsrc.tgac.miso.webapp.util.MisoWebUtils) Stream(java.util.stream.Stream) SampleStock(uk.ac.bbsrc.tgac.miso.core.data.SampleStock) RunService(uk.ac.bbsrc.tgac.miso.core.service.RunService) Pair(uk.ac.bbsrc.tgac.miso.core.data.Pair) LibraryAliquotDto(uk.ac.bbsrc.tgac.miso.dto.LibraryAliquotDto) InstrumentModelDto(uk.ac.bbsrc.tgac.miso.dto.InstrumentModelDto) InstrumentModel(uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel) SampleIdentity(uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity) StudyDto(uk.ac.bbsrc.tgac.miso.dto.StudyDto) User(com.eaglegenomics.simlims.core.User) RunPurpose(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose) AuthorizationManager(uk.ac.bbsrc.tgac.miso.core.security.AuthorizationManager) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) Controller(org.springframework.stereotype.Controller) LibraryAliquotService(uk.ac.bbsrc.tgac.miso.core.service.LibraryAliquotService) ArrayList(java.util.ArrayList) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) HttpServletRequest(javax.servlet.http.HttpServletRequest) SampleDto(uk.ac.bbsrc.tgac.miso.dto.SampleDto) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) RunPartitionAliquot(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot) RunPartitionAliquotDto(uk.ac.bbsrc.tgac.miso.dto.RunPartitionAliquotDto) LimsUtils(uk.ac.bbsrc.tgac.miso.core.util.LimsUtils) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) ContainerService(uk.ac.bbsrc.tgac.miso.core.service.ContainerService) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) PoolElement(uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement) RunPartitionService(uk.ac.bbsrc.tgac.miso.core.service.RunPartitionService) Status(javax.ws.rs.core.Response.Status) SampleAliquot(uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot) SampleTissue(uk.ac.bbsrc.tgac.miso.core.data.SampleTissue) LibraryService(uk.ac.bbsrc.tgac.miso.core.service.LibraryService) WhineyFunction(uk.ac.bbsrc.tgac.miso.core.util.WhineyFunction) HttpServletResponse(javax.servlet.http.HttpServletResponse) SpreadsheetRequest(uk.ac.bbsrc.tgac.miso.dto.SpreadsheetRequest) IOException(java.io.IOException) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) WhineyConsumer(uk.ac.bbsrc.tgac.miso.core.util.WhineyConsumer) ContainerDto(uk.ac.bbsrc.tgac.miso.dto.ContainerDto) Consumer(java.util.function.Consumer) HttpStatus(org.springframework.http.HttpStatus) RunPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition) ExperimentService(uk.ac.bbsrc.tgac.miso.core.service.ExperimentService) PartitionQcTypeService(uk.ac.bbsrc.tgac.miso.core.service.PartitionQcTypeService) PlatformType(uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType) PaginatedDataSource(uk.ac.bbsrc.tgac.miso.core.util.PaginatedDataSource) PartitionDto(uk.ac.bbsrc.tgac.miso.dto.PartitionDto) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) ExperimentDto(uk.ac.bbsrc.tgac.miso.dto.ExperimentDto) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) List(java.util.List) ArrayList(java.util.ArrayList) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) RunPartitionDto(uk.ac.bbsrc.tgac.miso.dto.ExperimentDto.RunPartitionDto) InstrumentModelDto(uk.ac.bbsrc.tgac.miso.dto.InstrumentModelDto) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

User (com.eaglegenomics.simlims.core.User)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 Status (javax.ws.rs.core.Response.Status)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Value (org.springframework.beans.factory.annotation.Value)1 HttpEntity (org.springframework.http.HttpEntity)1 HttpHeaders (org.springframework.http.HttpHeaders)1 HttpStatus (org.springframework.http.HttpStatus)1 MediaType (org.springframework.http.MediaType)1 Controller (org.springframework.stereotype.Controller)1