use of uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer in project miso-lims by miso-lims.
the class LoadSequencerWorkflow method execute.
@Override
public void execute(WorkflowExecutor workflowExecutor) throws IOException {
if (!isComplete())
throw new IllegalStateException("Workflow is not complete");
SequencerPartitionContainer spc;
if (containerStep.isExistingContainer()) {
spc = containerStep.getContainer();
} else {
spc = new SequencerPartitionContainerImpl();
SequencingContainerModel model = containerModelStep.getModel();
spc.setModel(model);
spc.setIdentificationBarcode(containerStep.getBarcode());
spc.setPartitionLimit(model.getPartitionCount());
}
for (int i = 0; i < partitionSteps.size(); ++i) {
spc.getPartitionAt(i + 1).setPool(partitionSteps.get(i).getPool());
}
workflowExecutor.save(spc);
}
use of uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer in project miso-lims by miso-lims.
the class LoadSequencerWorkflowTest method makeContainerStep.
private SequencerPartitionContainerProgressStep makeContainerStep(String serialNumber, String modelAlias, int partitionCount, PlatformType platformType) {
SequencerPartitionContainer container = new SequencerPartitionContainerImpl();
container.setIdentificationBarcode(serialNumber);
container.setModel(makeModel(modelAlias, partitionCount, platformType));
container.setPartitionLimit(partitionCount);
SequencerPartitionContainerProgressStep step = new SequencerPartitionContainerProgressStep();
step.setInput(container);
return step;
}
use of uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer in project miso-lims by miso-lims.
the class LoadSequencerWorkflowTest method testChangePools.
@Test
public void testChangePools() throws IOException {
final String pool1 = "alternate pool 1";
final String pool2 = "alternate pool 2";
enterNewFlowCell();
sut.processInput(2, makePoolStep(pool1, "IPO3"));
assertState(true, null);
sut.processInput(3, makePoolStep(pool2, "IPO4"));
assertState(true, null);
SequencerPartitionContainer container = executeWorkflow();
assertEquals(pool1, container.getPartitions().get(0).getPool().getAlias());
assertEquals(pool2, container.getPartitions().get(1).getPool().getAlias());
}
use of uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer in project miso-lims by miso-lims.
the class ContainerPageIT method testChangeValues.
@Test
public void testChangeValues() throws Exception {
// goal: change all changeable values
ContainerPage page1 = ContainerPage.getForEdit(getDriver(), getBaseUrl(), 6001L);
// initial values
Map<ContainerPage.Field, String> fields = Maps.newLinkedHashMap();
fields.put(Field.ID, "6001");
fields.put(Field.SERIAL_NUMBER, "CHANGEABLE");
fields.put(Field.MODEL, "Generic 4-Lane Illumina Flow Cell");
fields.put(Field.CLUSTERING_KIT, "None");
fields.put(Field.MULTIPLEXING_KIT, "None");
assertFieldValues("initial values", fields, page1);
Map<ContainerPage.Field, String> changes = Maps.newLinkedHashMap();
changes.put(Field.SERIAL_NUMBER, "CHANGED");
changes.put(Field.CLUSTERING_KIT, "Test Kit Three");
changes.put(Field.MULTIPLEXING_KIT, "Test Kit Four");
page1.setFields(changes);
fields.putAll(changes);
assertFieldValues("changes pre-save", fields, page1);
ContainerPage page2 = page1.save();
assertFieldValues("post-save", fields, page2);
SequencerPartitionContainer savedContainer = (SequencerPartitionContainer) getSession().get(SequencerPartitionContainerImpl.class, 6001L);
assertContainerAttributes(fields, savedContainer);
}
use of uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer in project miso-lims by miso-lims.
the class DefaultRunService method validateChanges.
private void validateChanges(Run before, Run changed) throws IOException {
ValidationUtils.updateQcDetails(changed, before, Run::getQcPassed, Run::getQcUser, Run::setQcUser, authorizationManager, Run::getQcDate, Run::setQcDate);
if (isChanged(Run::getQcPassed, changed, before)) {
changed.setDataReview(null);
}
ValidationUtils.updateQcDetails(changed, before, Run::getDataReview, Run::getDataReviewer, Run::setDataReviewer, authorizationManager, Run::getDataReviewDate, Run::setDataReviewDate);
List<ValidationError> errors = new ArrayList<>();
if (!changed.getHealth().isDone()) {
changed.setCompletionDate(null);
} else if (changed.getCompletionDate() == null) {
errors.add(new ValidationError("completionDate", "Completion date must be provided for finished run"));
}
if (before != null) {
if (before.getCompletionDate() != null && changed.getCompletionDate() != null && !changed.getCompletionDate().equals(before.getCompletionDate()) && !authorizationManager.isAdminUser()) {
errors.add(new ValidationError("completionDate", "Only admin may change completion date"));
}
if (before.getStartDate() != null && changed.getStartDate() != null && !changed.getStartDate().equals(before.getStartDate()) && !authorizationManager.isAdminUser()) {
errors.add(new ValidationError("completionDate", "Only admin may change start date"));
}
}
if (isSetAndChanged(Run::getAlias, changed, before) && getRunByAlias(changed.getAlias()) != null) {
errors.add(new ValidationError("alias", "A different run with this alias already exists. Run alias must be unique."));
}
InstrumentModel platform = changed.getSequencer().getInstrumentModel();
for (RunPosition position : changed.getRunPositions()) {
if (position.getPosition() != null && !platform.getPositions().contains(position.getPosition())) {
errors.add(new ValidationError(String.format("Platform %s does not have a position %s", platform.getAlias(), position.getPosition())));
}
}
if (changed.getSequencingKit() != null && changed.getSequencingKit().getKitType() != KitType.SEQUENCING) {
errors.add(new ValidationError("sequencingKitId", "Must be a sequencing kit"));
}
if (changed.getSequencingKitLot() != null && changed.getSequencingKit() == null) {
errors.add(new ValidationError("sequencingKitLot", "Sequencing kit not specified"));
}
if (isSetAndChanged(Run::getDataReview, changed, before) && changed.getQcPassed() == null) {
errors.add(new ValidationError("dataReview", "Cannot set data review before QC status"));
}
ValidationUtils.validateQcUser(changed.getQcPassed(), changed.getQcUser(), errors);
ValidationUtils.validateQcUser(changed.getDataReview(), changed.getDataReviewer(), errors, "data review", "Data reviewer");
User user = authorizationManager.getCurrentUser();
if (((before == null && changed.getDataReview() != null) || (before != null && isChanged(Run::getDataReview, changed, before))) && !user.isRunReviewer() && !user.isAdmin()) {
errors.add(new ValidationError("dataReview", "You are not authorized to make this change"));
}
if (changed.getSequencerPartitionContainers() != null) {
if (changed.getSequencerPartitionContainers().size() > changed.getSequencer().getInstrumentModel().getNumContainers()) {
errors.add(new ValidationError(String.format("Cannot have more than %d containers", changed.getSequencer().getInstrumentModel().getNumContainers())));
}
for (SequencerPartitionContainer container : changed.getSequencerPartitionContainers()) {
if (changed.getSequencer().getInstrumentModel().getContainerModels().stream().noneMatch(model -> model.getId() == container.getModel().getId())) {
errors.add(new ValidationError(String.format("Container '%s' is not valid for instrument '%s'", container.getIdentificationBarcode(), changed.getSequencer().getInstrumentModel().getAlias())));
}
}
}
if (!errors.isEmpty()) {
throw new ValidationException(errors);
}
}
Aggregations