Search in sources :

Example 21 with DetailedLibrary

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

the class OicrLibraryAliquotAliasGeneratorTest method testGenerateOxfordNanoporeAlias.

@Test
public void testGenerateOxfordNanoporeAlias() throws Exception {
    DetailedSample sample = new DetailedSampleImpl();
    sample.setAlias("LALA_1234567_Ly_R_nn_1-1_D_1");
    DetailedLibrary library = new DetailedLibraryImpl();
    library.setSample(sample);
    library.setPlatformType(PlatformType.OXFORDNANOPORE);
    LibraryType libraryType = new LibraryType();
    libraryType.setAbbreviation("RPD");
    library.setLibraryType(libraryType);
    DetailedLibraryAliquot aliquot = new DetailedLibraryAliquot();
    aliquot.setLibrary(library);
    aliquot.setDnaSize(300);
    LibraryDesignCode code = new LibraryDesignCode();
    code.setCode("WG");
    aliquot.setLibraryDesignCode(code);
    Mockito.when(siblingNumberGenerator.getNextSiblingNumber(Mockito.any(), Mockito.any())).thenReturn(5);
    assertEquals("LALA_1234567_Ly_R_RPD_WG_5", sut.generate(aliquot));
}
Also used : LibraryDesignCode(uk.ac.bbsrc.tgac.miso.core.data.LibraryDesignCode) LibraryType(uk.ac.bbsrc.tgac.miso.core.data.type.LibraryType) DetailedLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryAliquot) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl) DetailedLibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) Test(org.junit.Test)

Example 22 with DetailedLibrary

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

the class EditLibraryController method setupForm.

@GetMapping(value = "/{libraryId}")
public ModelAndView setupForm(@PathVariable Long libraryId, ModelMap model) throws IOException {
    Library library = libraryService.get(libraryId);
    if (library == null)
        throw new NotFoundException("No library found for ID " + libraryId.toString());
    model.put("title", "Library " + library.getId());
    model.put("library", library);
    addAdjacentLibraries(library, model);
    Collection<Pool> pools = poolService.listByLibraryId(library.getId());
    model.put("libraryPools", pools.stream().map(p -> Dtos.asDto(p, false, false, indexChecker)).collect(Collectors.toList()));
    model.put("libraryRuns", pools.stream().flatMap(WhineyFunction.flatRethrow(p -> runService.listByPoolId(p.getId()))).map(Dtos::asDto).collect(Collectors.toList()));
    model.put("libraryAliquots", library.getLibraryAliquots().stream().map(ldi -> Dtos.asDto(ldi, false)).collect(Collectors.toList()));
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode config = mapper.createObjectNode();
    config.putPOJO("library", Dtos.asDto(library, false));
    model.put("libraryAliquotsConfig", mapper.writeValueAsString(config));
    model.put("experiments", experimentService.listAllByLibraryId(library.getId()).stream().map(exp -> Dtos.asDto(exp)).collect(Collectors.toList()));
    model.put("libraryDto", mapper.writeValueAsString(Dtos.asDto(library, false)));
    if (LimsUtils.isDetailedLibrary(library)) {
        DetailedLibrary detailed = (DetailedLibrary) library;
        SampleIdentity identity = getParent(SampleIdentity.class, (DetailedSample) detailed.getSample());
        model.put("effectiveExternalNames", identity.getExternalName());
    }
    model.put("libraryTransfers", library.getTransferViews().stream().map(Dtos::asDto).collect(Collectors.toList()));
    ObjectNode formConfig = mapper.createObjectNode();
    formConfig.put("detailedSample", isDetailedSampleEnabled());
    addJsonArray(mapper, formConfig, "workstations", workstationService.list(), Dtos::asDto);
    addJsonArray(mapper, formConfig, "thermalCyclers", instrumentService.listByType(InstrumentType.THERMAL_CYCLER), Dtos::asDto);
    addJsonArray(mapper, formConfig, "sops", sopService.listByCategory(SopCategory.LIBRARY), Dtos::asDto);
    model.put("formConfig", mapper.writeValueAsString(formConfig));
    return new ModelAndView("/WEB-INF/pages/editLibrary.jsp", model);
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SampleIdentity(uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity) ModelAndView(org.springframework.web.servlet.ModelAndView) NotFoundException(org.springframework.security.acls.model.NotFoundException) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 23 with DetailedLibrary

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

the class BulkLibraryIT method testAddToBox.

@Test
public void testAddToBox() {
    Long libId = 100005L;
    DetailedLibrary before = (DetailedLibrary) getSession().get(LibraryImpl.class, libId);
    assertNull(before.getBox());
    assertNull(before.getBoxPosition());
    BulkLibraryPage page = BulkLibraryPage.getForEdit(getDriver(), getBaseUrl(), Sets.newHashSet(libId));
    HandsOnTable table = page.getTable();
    table.enterText(LibColumns.BOX_SEARCH, 0, "BOX100001");
    table.waitForSearch(LibColumns.BOX_ALIAS, 0);
    assertEquals("Bulk Boxables Test", table.getText(LibColumns.BOX_ALIAS, 0));
    assertTrue(isStringEmptyOrNull(table.getText(LibColumns.BOX_POSITION, 0)));
    assertTrue(table.getInvalidCells(0).contains(LibColumns.BOX_POSITION));
    table.enterText(LibColumns.BOX_POSITION, 0, "A01");
    assertFalse(table.getInvalidCells(0).contains(LibColumns.BOX_POSITION));
    assertTrue(page.save(false));
    DetailedLibrary after = (DetailedLibrary) getSession().get(LibraryImpl.class, libId);
    assertNotNull(after.getBox());
    assertEquals("BOX100001", after.getBox().getName());
    assertEquals("A01", after.getBoxPosition());
}
Also used : HandsOnTable(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) BulkLibraryPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkLibraryPage) Test(org.junit.Test)

Example 24 with DetailedLibrary

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

the class BulkLibraryIT method testEditValueRemovals.

@Test
public void testEditValueRemovals() {
    BulkLibraryPage page = BulkLibraryPage.getForEdit(getDriver(), getBaseUrl(), Sets.newHashSet(100002L));
    HandsOnTable table = page.getTable();
    // test initial values
    Map<String, String> attrs = Maps.newLinkedHashMap();
    attrs.put(LibColumns.NAME, "LIB100002");
    attrs.put(LibColumns.ALIAS, "LIBT_0001_Ly_P_PE_252_WG");
    attrs.put(LibColumns.ID_BARCODE, "libbar100002");
    attrs.put(LibColumns.DESCRIPTION, "libdesc100002");
    attrs.put(LibColumns.DESIGN, "WG");
    attrs.put(LibColumns.CODE, "WG (Whole Genome)");
    attrs.put(LibColumns.PLATFORM, "Illumina");
    attrs.put(LibColumns.LIBRARY_TYPE, "Paired End");
    attrs.put(LibColumns.SELECTION, "PCR");
    attrs.put(LibColumns.STRATEGY, "WGS");
    attrs.put(LibColumns.INDEX_FAMILY, "Dual Index 6bp");
    attrs.put(LibColumns.INDEX_1, "A02 (CCCAAA)");
    attrs.put(LibColumns.INDEX_2, "B02 (CCCGGG)");
    attrs.put(LibColumns.KIT_DESCRIPTOR, "Test Kit");
    attrs.put(LibColumns.QC_STATUS, "Failed: QC");
    attrs.put(LibColumns.SIZE, "252");
    attrs.put(LibColumns.VOLUME, "4.0");
    attrs.put(LibColumns.CONCENTRATION, "6.3");
    attrs.put(LibColumns.SPIKE_IN, "Spike-In One");
    attrs.put(LibColumns.SPIKE_IN_DILUTION, "1:10");
    attrs.put(LibColumns.SPIKE_IN_VOL, "12.34");
    assertColumnValues(table, 0, attrs, "loaded");
    // make changes
    Map<String, String> changes = Maps.newLinkedHashMap();
    changes.put(LibColumns.ID_BARCODE, "");
    changes.put(LibColumns.DESCRIPTION, "");
    changes.put(LibColumns.DESIGN, "");
    changes.put(LibColumns.CODE, "CH (ChIP-Seq)");
    changes.put(LibColumns.SELECTION, "cDNA");
    changes.put(LibColumns.STRATEGY, "CLONE");
    changes.put(LibColumns.INDEX_FAMILY, NO_INDEX_FAMILY);
    changes.put(LibColumns.QC_STATUS, "Ready");
    changes.put(LibColumns.SIZE, "241");
    changes.put(LibColumns.VOLUME, "1.88");
    changes.put(LibColumns.CONCENTRATION, "12.34");
    changes.put(LibColumns.SPIKE_IN, "");
    fillRow(table, 0, changes);
    // set based on other changes
    changes.put(LibColumns.INDEX_1, "");
    changes.put(LibColumns.INDEX_2, "");
    changes.put(LibColumns.SPIKE_IN_DILUTION, "");
    changes.put(LibColumns.SPIKE_IN_VOL, "");
    // unchanged
    attrs.forEach((key, val) -> {
        if (!changes.containsKey(key)) {
            changes.put(key, val);
        }
    });
    assertColumnValues(table, 0, changes, "changes pre-save");
    assertTrue(page.save(false));
    DetailedLibrary lib = (DetailedLibrary) getSession().get(LibraryImpl.class, 100002L);
    assertDetailedLibraryAttributes(changes, lib);
}
Also used : HandsOnTable(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) BulkLibraryPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkLibraryPage) Test(org.junit.Test)

Example 25 with DetailedLibrary

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

the class BulkLibraryIT method testUndiscardIntoBox.

@Test
public void testUndiscardIntoBox() {
    Long libId = 100008L;
    DetailedLibrary before = (DetailedLibrary) getSession().get(LibraryImpl.class, libId);
    assertNull(before.getBox());
    assertNull(before.getBoxPosition());
    assertTrue(before.isDiscarded());
    BulkLibraryPage page = BulkLibraryPage.getForEdit(getDriver(), getBaseUrl(), Sets.newHashSet(libId));
    HandsOnTable table = page.getTable();
    table.enterText(LibColumns.DISCARDED, 0, "False");
    table.enterText(LibColumns.BOX_SEARCH, 0, "BOX100001");
    table.waitForSearch(LibColumns.BOX_ALIAS, 0);
    assertEquals("Bulk Boxables Test", table.getText(LibColumns.BOX_ALIAS, 0));
    table.enterText(LibColumns.BOX_POSITION, 0, "B01");
    assertEquals("B01", table.getText(LibColumns.BOX_POSITION, 0));
    assertTrue(page.save(false));
    DetailedLibrary after = (DetailedLibrary) getSession().get(LibraryImpl.class, libId);
    assertNotNull(after.getBox());
    assertEquals("BOX100001", after.getBox().getName());
    assertEquals("B01", after.getBoxPosition());
    assertFalse(after.isDiscarded());
}
Also used : HandsOnTable(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) BulkLibraryPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkLibraryPage) Test(org.junit.Test)

Aggregations

DetailedLibrary (uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary)30 Test (org.junit.Test)22 LibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl)16 BulkLibraryPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkLibraryPage)12 HandsOnTable (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable)12 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)8 DetailedLibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl)8 DetailedSampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)6 LibraryDesignCode (uk.ac.bbsrc.tgac.miso.core.data.LibraryDesignCode)5 LibraryType (uk.ac.bbsrc.tgac.miso.core.data.type.LibraryType)4 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)3 DetailedLibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryAliquot)3 LibraryPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.LibraryPage)3 Field (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.LibraryPage.Field)3 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 LibraryDesign (uk.ac.bbsrc.tgac.miso.core.data.LibraryDesign)2 SampleIdentity (uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity)2 TransferLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary)2 ValidationError (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)2