Search in sources :

Example 1 with SequencerPartitionContainer

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);
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) SequencingContainerModel(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel) SequencerPartitionContainerImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl)

Example 2 with SequencerPartitionContainer

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;
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) SequencerPartitionContainerImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl)

Example 3 with SequencerPartitionContainer

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());
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) Test(org.junit.Test)

Example 4 with SequencerPartitionContainer

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);
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ContainerPage.Field) SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) SequencerPartitionContainerImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl) ContainerPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ContainerPage) Test(org.junit.Test)

Example 5 with SequencerPartitionContainer

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);
    }
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) RunPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition) User(com.eaglegenomics.simlims.core.User) ValidationException(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException) InstrumentModel(uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel) OxfordNanoporeRun(uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun) IlluminaRun(uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun) SolidRun(uk.ac.bbsrc.tgac.miso.core.data.SolidRun) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) LS454Run(uk.ac.bbsrc.tgac.miso.core.data.LS454Run) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)

Aggregations

SequencerPartitionContainer (uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer)33 SequencerPartitionContainerImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl)13 Test (org.junit.Test)10 SequencingContainerModel (uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel)8 Run (uk.ac.bbsrc.tgac.miso.core.data.Run)6 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)5 User (com.eaglegenomics.simlims.core.User)4 IOException (java.io.IOException)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 InstrumentModel (uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel)4 Partition (uk.ac.bbsrc.tgac.miso.core.data.Partition)4 RunPartition (uk.ac.bbsrc.tgac.miso.core.data.RunPartition)4 KitDescriptor (uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor)4 ArrayList (java.util.ArrayList)3 Collectors (java.util.stream.Collectors)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 PostMapping (org.springframework.web.bind.annotation.PostMapping)3 RunPosition (uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition)3 ValidationError (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)3 ValidationException (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException)3