Search in sources :

Example 1 with RunPartitionAliquot

use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.

the class HibernateRunPartitionAliquotDaoIT method testCreate.

@Test
public void testCreate() throws Exception {
    Run run = (Run) currentSession().get(Run.class, 1L);
    Partition partition = (Partition) currentSession().get(PartitionImpl.class, 2L);
    LibraryAliquot aliquot = (LibraryAliquot) currentSession().get(LibraryAliquot.class, 3L);
    RunPartitionAliquotId id = new RunPartitionAliquotId(run, partition, aliquot);
    assertNull(currentSession().get(RunPartitionAliquot.class, id));
    RunPartitionAliquot rpa = new RunPartitionAliquot(run, partition, aliquot);
    User user = (User) currentSession().get(UserImpl.class, 1L);
    rpa.setLastModifier(user);
    RunLibraryQcStatus qc = (RunLibraryQcStatus) currentSession().get(RunLibraryQcStatus.class, 1L);
    rpa.setQcStatus(qc);
    rpa.setQcUser(user);
    rpa.setQcDate(new Date());
    sut.create(rpa);
    clearSession();
    RunPartitionAliquot saved = (RunPartitionAliquot) currentSession().get(RunPartitionAliquot.class, id);
    assertNotNull(saved);
    assertEquals(1L, saved.getRun().getId());
    assertEquals(2L, saved.getPartition().getId());
    assertEquals(3L, saved.getAliquot().getId());
}
Also used : Partition(uk.ac.bbsrc.tgac.miso.core.data.Partition) RunPartitionAliquotId(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot.RunPartitionAliquotId) User(com.eaglegenomics.simlims.core.User) RunPartitionAliquot(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot) UserImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl) PartitionImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PartitionImpl) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) RunLibraryQcStatus(uk.ac.bbsrc.tgac.miso.core.data.RunLibraryQcStatus) Date(java.util.Date) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 2 with RunPartitionAliquot

use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.

the class Dtos method to.

public static RunPartitionAliquot to(@Nonnull RunPartitionAliquotDto from) {
    RunPartitionAliquot to = new RunPartitionAliquot();
    PlatformType platform = PlatformType.valueOf(from.getPlatformType());
    setObject(to::setRun, platform::createRun, from.getRunId());
    setObject(to::setPartition, PartitionImpl::new, from.getPartitionId());
    setObject(to::setAliquot, LibraryAliquot::new, from.getAliquotId());
    setObject(to::setPurpose, RunPurpose::new, from.getRunPurposeId());
    setObject(to::setQcStatus, RunLibraryQcStatus::new, from.getQcStatusId());
    setString(to::setQcNote, from.getQcNote());
    setBoolean(to::setDataReview, from.getDataReview(), true);
    return to;
}
Also used : RunPurpose(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose) RunPartitionAliquot(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot) PartitionImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PartitionImpl) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto) TransferLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot) WorksetLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot) OrderLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.OrderLibraryAliquot) DetailedLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryAliquot) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) PlatformType(uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType) RunLibraryQcStatus(uk.ac.bbsrc.tgac.miso.core.data.RunLibraryQcStatus)

Example 3 with RunPartitionAliquot

use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.

the class RunRestController method getSpreadsheet.

@PostMapping(value = "/spreadsheet")
@ResponseBody
public HttpEntity<byte[]> getSpreadsheet(@RequestBody SpreadsheetRequest request, HttpServletResponse response, UriComponentsBuilder uriBuilder) throws IOException {
    // Note: not retrieving persisted run-libraries, so QC data will be missing
    List<Run> runs = runService.listByIdList(request.getIds());
    List<RunPartitionAliquot> runLibraries = new ArrayList<>();
    for (Run run : runs) {
        for (RunPosition runPosition : run.getRunPositions()) {
            for (Partition partition : runPosition.getContainer().getPartitions()) {
                if (partition.getPool() != null) {
                    for (PoolElement element : partition.getPool().getPoolContents()) {
                        LibraryAliquot aliquot = libraryAliquotService.get(element.getAliquot().getId());
                        runLibraries.add(new RunPartitionAliquot(run, partition, aliquot));
                    }
                }
            }
        }
    }
    return MisoWebUtils.generateSpreadsheet(request, runLibraries.stream(), detailedSample, RunLibrarySpreadsheets::valueOf, response);
}
Also used : RunPartition(uk.ac.bbsrc.tgac.miso.core.data.RunPartition) Partition(uk.ac.bbsrc.tgac.miso.core.data.Partition) RunLibrarySpreadsheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.RunLibrarySpreadsheets) RunPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition) PoolElement(uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement) RunPartitionAliquot(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot) ArrayList(java.util.ArrayList) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with RunPartitionAliquot

use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.

the class EditRunController method getRunAliquots.

private List<RunPartitionAliquotDto> getRunAliquots(Run run) throws IOException {
    List<RunPartitionAliquot> runPartitionAliquots = runPartitionAliquotService.listByRunId(run.getId());
    List<RunPartitionAliquotDto> dtos = new ArrayList<>();
    for (int i = 0; i < runPartitionAliquots.size(); i++) {
        RunPartitionAliquotDto dto = Dtos.asDto(runPartitionAliquots.get(i));
        // Add id for DataTables
        dto.setId(Long.valueOf(i));
        dtos.add(dto);
    }
    return dtos;
}
Also used : RunPartitionAliquot(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot) ArrayList(java.util.ArrayList) RunPartitionAliquotDto(uk.ac.bbsrc.tgac.miso.dto.RunPartitionAliquotDto)

Example 5 with RunPartitionAliquot

use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.

the class HibernateRunPartitionAliquotDaoIT method testSaveCreate.

@Test
public void testSaveCreate() throws Exception {
    Run run = (Run) currentSession().get(Run.class, 1L);
    Partition partition = (Partition) currentSession().get(PartitionImpl.class, 2L);
    LibraryAliquot aliquot = (LibraryAliquot) currentSession().get(LibraryAliquot.class, 3L);
    RunPartitionAliquotId id = new RunPartitionAliquotId(run, partition, aliquot);
    assertNull(currentSession().get(RunPartitionAliquot.class, id));
    RunPartitionAliquot rpa = new RunPartitionAliquot(run, partition, aliquot);
    User user = (User) currentSession().get(UserImpl.class, 1L);
    rpa.setLastModifier(user);
    RunLibraryQcStatus qc = (RunLibraryQcStatus) currentSession().get(RunLibraryQcStatus.class, 1L);
    rpa.setQcStatus(qc);
    rpa.setQcUser(user);
    rpa.setQcDate(new Date());
    sut.save(rpa);
    clearSession();
    RunPartitionAliquot saved = (RunPartitionAliquot) currentSession().get(RunPartitionAliquot.class, id);
    assertNotNull(saved);
    assertEquals(1L, saved.getRun().getId());
    assertEquals(2L, saved.getPartition().getId());
    assertEquals(3L, saved.getAliquot().getId());
}
Also used : Partition(uk.ac.bbsrc.tgac.miso.core.data.Partition) RunPartitionAliquotId(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot.RunPartitionAliquotId) User(com.eaglegenomics.simlims.core.User) RunPartitionAliquot(uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot) UserImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl) PartitionImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PartitionImpl) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) RunLibraryQcStatus(uk.ac.bbsrc.tgac.miso.core.data.RunLibraryQcStatus) Date(java.util.Date) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

RunPartitionAliquot (uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot)15 LibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot)10 Test (org.junit.Test)9 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)9 Partition (uk.ac.bbsrc.tgac.miso.core.data.Partition)9 Run (uk.ac.bbsrc.tgac.miso.core.data.Run)9 PartitionImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.PartitionImpl)8 RunPartitionAliquotId (uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot.RunPartitionAliquotId)6 RunLibraryQcStatus (uk.ac.bbsrc.tgac.miso.core.data.RunLibraryQcStatus)5 User (com.eaglegenomics.simlims.core.User)4 Date (java.util.Date)4 RunPurpose (uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose)4 ArrayList (java.util.ArrayList)3 IOException (java.io.IOException)2 Pool (uk.ac.bbsrc.tgac.miso.core.data.Pool)2 RunPartition (uk.ac.bbsrc.tgac.miso.core.data.RunPartition)2 RunPosition (uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition)2 UserImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl)2 ValidationException (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException)2 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)1