Search in sources :

Example 1 with SampleTissueProcessing

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

the class AbstractBulkSampleIT method assertAllForTissueProcessing.

protected void assertAllForTissueProcessing(Map<String, String> tproc, Long sampleId, boolean newlyCreated) {
    SampleTissueProcessing target = (SampleTissueProcessing) getSession().get(SampleTissueProcessingImpl.class, sampleId);
    assertPlainSampleAttributes(tproc, target, newlyCreated);
    assertDetailedSampleAttributes(tproc, target);
    if (newlyCreated) {
        SampleTissue tissueParent = LimsUtils.getParent(SampleTissue.class, target);
        assertTissueAttributes(tproc, tissueParent);
    }
}
Also used : SampleTissueProcessingImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissueProcessingImpl) SampleTissue(uk.ac.bbsrc.tgac.miso.core.data.SampleTissue) SampleTissueProcessing(uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing)

Example 2 with SampleTissueProcessing

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

the class Dtos method asDetailedSampleDto.

private static DetailedSampleDto asDetailedSampleDto(@Nonnull DetailedSample from) {
    DetailedSampleDto dto = null;
    if (isIdentitySample(from)) {
        dto = asIdentitySampleDto((SampleIdentity) from);
    } else if (isTissueSample(from)) {
        dto = asTissueSampleDto((SampleTissue) from);
    } else if (isTissueProcessingSample(from)) {
        dto = asTissueProcessingSampleDto((SampleTissueProcessing) from);
    } else if (isAliquotSample(from)) {
        dto = asAliquotSampleDto((SampleAliquot) from);
    } else if (isStockSample(from)) {
        dto = asStockSampleDto((SampleStock) from);
    } else {
        throw new IllegalArgumentException();
    }
    dto.setSampleClassId(from.getSampleClass().getId());
    dto.setSampleClassAlias(from.getSampleClass().getAlias());
    dto.setSampleCategory(from.getSampleClass().getSampleCategory());
    dto.setSampleSubcategory(from.getSampleClass().getSampleSubcategory());
    if (from.getSubproject() != null) {
        dto.setSubprojectId(from.getSubproject().getId());
        dto.setSubprojectAlias(from.getSubproject().getAlias());
        dto.setSubprojectPriority(from.getSubproject().getPriority());
    }
    if (from.getParent() != null) {
        DetailedSample parent = from.getParent();
        dto.setParentId(parent.getId());
        setString(dto::setParentName, parent.getName());
        dto.setParentAlias(parent.getAlias());
        dto.setParentSampleClassId(parent.getSampleClass().getId());
        if (parent.getBox() != null) {
            dto.setParentBoxPosition(parent.getBoxPosition());
            dto.setParentBoxPositionLabel(BoxUtils.makeBoxPositionLabel(parent.getBox().getAlias(), parent.getBoxPosition()));
        }
    }
    GroupIdentifiable effective = from.getEffectiveGroupIdEntity();
    if (effective != null) {
        dto.setEffectiveGroupId(effective.getGroupId());
        dto.setEffectiveGroupIdSample(effective.getAlias());
    }
    if (from.getGroupId() != null) {
        dto.setGroupId(from.getGroupId());
    }
    if (from.getGroupDescription() != null) {
        dto.setGroupDescription(from.getGroupDescription());
    }
    if (from.isSynthetic() != null) {
        dto.setSynthetic(from.isSynthetic());
    }
    setDateString(dto::setCreationDate, from.getCreationDate());
    dto.setNonStandardAlias(from.hasNonStandardAlias());
    setString(dto::setVolumeUsed, from.getVolumeUsed());
    setString(dto::setNgUsed, from.getNgUsed());
    if (from.getIdentityAttributes() != null) {
        ParentIdentityAttributes identity = from.getIdentityAttributes();
        setString(dto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
        setString(dto::setEffectiveExternalNames, identity.getExternalName());
    }
    if (from.getTissueAttributes() != null) {
        ParentTissueAttributes tissue = from.getTissueAttributes();
        setString(dto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
        setString(dto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
        setString(dto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
        setString(dto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
    }
    setEffectiveQcFailure(from, dto);
    if (from.getRequisition() == null) {
        Requisition requisition = getParentRequisition(from);
        setId(dto::setEffectiveRequisitionId, requisition);
        setString(dto::setEffectiveRequisitionAlias, maybeGetProperty(requisition, Requisition::getAlias));
    }
    return dto;
}
Also used : SampleTissueProcessing(uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing) ParentTissueAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes) SampleIdentity(uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity) ParentIdentityAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) GroupIdentifiable(uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable) Requisition(uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition) SampleStock(uk.ac.bbsrc.tgac.miso.core.data.SampleStock)

Example 3 with SampleTissueProcessing

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

the class BulkSampleCreateIT method testCreateOneCurlsWithProject.

@Test
public void testCreateOneCurlsWithProject() throws Exception {
    // Goal: ensure one Curls associated with a predefined project can be saved
    BulkSamplePage page = getCreatePage(1, projectId, SampleTissueProcessing.CATEGORY_NAME);
    HandsOnTable table = page.getTable();
    Map<String, String> curls = new LinkedHashMap<>();
    curls.put(SamColumns.DESCRIPTION, "Description");
    curls.put(SamColumns.RECEIVE_DATE, "2017-07-17");
    curls.put(SamColumns.RECEIVED_FROM, "University Health Network - BioBank");
    curls.put(SamColumns.RECEIVED_BY, "TestGroupOne");
    curls.put(SamColumns.RECEIPT_CONFIRMED, "True");
    curls.put(SamColumns.RECEIPT_QC_PASSED, "True");
    curls.put(SamColumns.RECEIPT_QC_NOTE, "");
    // increment
    curls.put(SamColumns.ID_BARCODE, "106");
    curls.put(SamColumns.SAMPLE_CLASS, "Tissue Piece");
    curls.put(SamColumns.SAMPLE_TYPE, "GENOMIC");
    curls.put(SamColumns.SCIENTIFIC_NAME, "Homo sapiens");
    curls.put(SamColumns.GROUP_ID, "1");
    curls.put(SamColumns.GROUP_DESCRIPTION, "Test one");
    curls.put(SamColumns.TISSUE_ORIGIN, "Bn (Brain)");
    curls.put(SamColumns.TISSUE_TYPE, "P (Primary tumour)");
    curls.put(SamColumns.PASSAGE_NUMBER, "");
    curls.put(SamColumns.TIMES_RECEIVED, "1");
    curls.put(SamColumns.TUBE_NUMBER, "1");
    curls.put(SamColumns.SECONDARY_ID, "tube id 1");
    curls.put(SamColumns.TISSUE_MATERIAL, "FFPE");
    curls.put(SamColumns.REGION, "Medulla oblongata");
    curls.put(SamColumns.QC_STATUS, "Ready");
    curls.put(SamColumns.PIECE_TYPE, "Curls");
    curls.put(SamColumns.SLIDES_CONSUMED, "2");
    curls.forEach((k, v) -> table.enterText(k, 0, v));
    // need to enter this here, after project is entered otherwise identity lookup fails
    // increment
    curls.put(SamColumns.EXTERNAL_NAME, "ext6");
    table.enterText(SamColumns.EXTERNAL_NAME, 0, curls.get(SamColumns.EXTERNAL_NAME));
    assertIdentityLookupWasSuccessful(table, 0);
    assertTrue(page.save(false));
    HandsOnTable savedTable = page.getTable();
    Long newId = getIdForRow(savedTable, 0);
    // verify attributes against what got saved to the database
    Project predefined = (Project) getSession().get(ProjectImpl.class, projectId);
    SampleTissueProcessing created = (SampleTissueProcessing) getSession().get(SampleTissueProcessingImpl.class, newId);
    assertEquals("confirm project", predefined.getShortName(), created.getProject().getShortName());
// everything else should be the same as in testCreateOneCurlsNoProject
}
Also used : SampleTissueProcessingImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissueProcessingImpl) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) SampleTissueProcessing(uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing) HandsOnTable(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) BulkSamplePage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkSamplePage) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

SampleTissueProcessing (uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing)3 SampleTissueProcessingImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissueProcessingImpl)2 LinkedHashMap (java.util.LinkedHashMap)1 Test (org.junit.Test)1 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)1 GroupIdentifiable (uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable)1 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)1 SampleIdentity (uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity)1 SampleStock (uk.ac.bbsrc.tgac.miso.core.data.SampleStock)1 SampleTissue (uk.ac.bbsrc.tgac.miso.core.data.SampleTissue)1 ProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl)1 Requisition (uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition)1 ParentIdentityAttributes (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes)1 ParentTissueAttributes (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes)1 BulkSamplePage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkSamplePage)1 HandsOnTable (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable)1