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);
}
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());
}
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;
}
Aggregations