Search in sources :

Example 6 with SampleQC

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

the class SamplesReceivedWorkflow method execute.

@Override
public void execute(WorkflowExecutor workflowExecutor) throws IOException {
    if (!isComplete())
        throw new IllegalStateException("Workflow is not complete");
    Sample sample = stockStep.getSample();
    SampleQC qc = new SampleQC();
    Box aliquotBox = aliquotBoxStep.getBox();
    Box stockBox = stockBoxStep.getBox();
    qc.setSample(sample);
    qc.setType(workflowExecutor.getQcTypeList().stream().filter(type -> type.getQcTarget() == QcTarget.Sample).findFirst().orElse(null));
    qc.setResults(qcStep.getQCValue());
    Collection<SampleQC> qcs = sample.getQCs();
    qcs.add(qc);
    sample.setQCs(qcs);
    BoxPosition stockBp = new BoxPosition(stockBox, stockBoxPositionStep.getPosition(), sample.getEntityType(), sample.getId());
    stockBox.getBoxPositions().put(stockBoxPositionStep.getPosition(), stockBp);
    for (int i = 0; i < aliquotStep.getAliquotQuantity(); i++) {
        SampleAliquot aliquot = workflowExecutor.createAliquotFromParent(sample);
        aliquot.setVolume(((VolumeStep) aliquotHandlingSteps.get(3 * i + 1)).getVolume());
        aliquot.setConcentration(((ConcentrationStep) aliquotHandlingSteps.get(3 * i + 2)).getConcentration());
        workflowExecutor.save(aliquot);
        String aliquotPos = ((AliquotBoxPositionStep) aliquotHandlingSteps.get(3 * i)).getPosition();
        BoxPosition aliquotBp = new BoxPosition(aliquotBox, aliquotPos, aliquot.getEntityType(), aliquot.getId());
        aliquotBox.getBoxPositions().put(aliquotPos, aliquotBp);
    }
    workflowExecutor.save(aliquotBox);
    workflowExecutor.save(qc);
    workflowExecutor.save(sample);
    workflowExecutor.save(stockBox);
}
Also used : SampleAliquot(uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot) AbstractWorkflow(uk.ac.bbsrc.tgac.miso.core.data.workflow.AbstractWorkflow) InputType(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep.InputType) WorkflowStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.WorkflowStep) Collection(java.util.Collection) Set(java.util.Set) ProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) Sets(com.google.common.collect.Sets) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) BoxPosition(uk.ac.bbsrc.tgac.miso.core.data.BoxPosition) BoxUtils(uk.ac.bbsrc.tgac.miso.core.util.BoxUtils) BigDecimal(java.math.BigDecimal) List(java.util.List) Stream(java.util.stream.Stream) WorkflowExecutor(uk.ac.bbsrc.tgac.miso.core.data.workflow.WorkflowExecutor) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) QcTarget(uk.ac.bbsrc.tgac.miso.core.data.qc.QcTarget) WorkflowStepPrompt(uk.ac.bbsrc.tgac.miso.core.data.workflow.WorkflowStepPrompt) Collections(java.util.Collections) SampleAliquot(uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) BoxPosition(uk.ac.bbsrc.tgac.miso.core.data.BoxPosition)

Example 7 with SampleQC

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

the class BulkSampleQCIT method testAutoUpdateConcentration.

@Test
public void testAutoUpdateConcentration() throws Exception {
    // Goal: ensure that volume and volume units are updated by the QC
    BulkQCPage page = getAddPage(Arrays.asList(2201L), 1);
    HandsOnTable table = page.getTable();
    Map<String, String> attrs = Maps.newLinkedHashMap();
    attrs.put(QcColumns.DATE, "2018-07-10");
    attrs.put(QcColumns.TYPE, "update concentration qc");
    attrs.put(QcColumns.RESULT, "24.78");
    fillRow(table, 0, attrs);
    assertFalse(table.isWritable(QcColumns.SAMPLE_ALIAS, 0));
    assertFalse(table.isWritable(QcColumns.UNITS, 0));
    assertColumnValues(table, 0, attrs, "pre-save");
    assertTrue(page.save(false));
    SampleQC saved = getLatestQc();
    assertQCAttributes(attrs, saved);
    assertEquals(String.format("Expected concentration to be updated to %s, instead got %f", "24.78", saved.getSample().getConcentration()), 0, saved.getSample().getConcentration().compareTo(new BigDecimal("24.78")));
    assertEquals(String.format("Expected concentration units to be updated to %s, instead got %s", ConcentrationUnit.NANOMOLAR.getUnits(), saved.getSample().getConcentrationUnits().getUnits()), ConcentrationUnit.NANOMOLAR, saved.getSample().getConcentrationUnits());
}
Also used : HandsOnTable(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) BulkQCPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkQCPage) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 8 with SampleQC

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

the class HibernateSampleQcDaoIT method makeQc.

@Override
protected SampleQC makeQc(Sample entity) {
    SampleQC qc = new SampleQC();
    qc.setSample(entity);
    return qc;
}
Also used : SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC)

Aggregations

SampleQC (uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC)8 Test (org.junit.Test)4 BulkQCPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BulkQCPage)4 HandsOnTable (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.element.HandsOnTable)4 BigDecimal (java.math.BigDecimal)3 ArrayList (java.util.ArrayList)2 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)2 ContainerQC (uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC)2 LibraryQC (uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC)2 PoolQC (uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC)2 QC (uk.ac.bbsrc.tgac.miso.core.data.qc.QC)2 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)1 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)1 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)1 Sets (com.google.common.collect.Sets)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1