Search in sources :

Example 1 with SequencingContainerModel

use of uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel 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 SequencingContainerModel

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

the class ContainerPageIT method testCreateContainerDialog.

@Test
public void testCreateContainerDialog() {
    // goal: ensure clicking to create new MiSeq container goes to the page with the
    // correct container model
    ListTabbedPage listContainers = ListTabbedPage.getTabbedListPage(getDriver(), getBaseUrl(), ListTarget.CONTAINERS);
    String containerName = PlatformType.get("Illumina").getContainerName();
    InstrumentModel miseq = (InstrumentModel) getSession().get(InstrumentModel.class, 2L);
    SequencingContainerModel model = (SequencingContainerModel) getSession().get(SequencingContainerModel.class, 3L);
    String newUrl = listContainers.clickButtonAndGetUrl(ButtonText.ADD + " " + containerName, Lists.newArrayList(miseq.getAlias(), model.getAlias()));
    assertTrue(newUrl.matches(".*/miso/container/new/" + model.getId()));
}
Also used : SequencingContainerModel(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel) ListTabbedPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ListTabbedPage) InstrumentModel(uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel) Test(org.junit.Test)

Example 3 with SequencingContainerModel

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

the class DefaultRunService method updateContainerFromNotification.

private boolean updateContainerFromNotification(final Run target, User user, SequencingContainerModel containerModel, String containerSerialNumber, final GetLaneContents getLaneContents, String positionName) throws IOException {
    if (LimsUtils.isStringBlankOrNull(containerSerialNumber)) {
        return false;
    }
    final Collection<SequencerPartitionContainer> containers = containerService.listByBarcode(containerSerialNumber);
    int laneCount = containerModel.getPartitionCount();
    InstrumentPosition position = null;
    if (!isStringEmptyOrNull(positionName)) {
        position = target.getSequencer().getInstrumentModel().getPositions().stream().filter(pos -> positionName.equals(pos.getAlias())).findFirst().orElseThrow(() -> new IllegalArgumentException(String.format("Unknown position '%s' for platform '%s'", positionName, target.getSequencer().getInstrumentModel().getAlias())));
    }
    switch(containers.size()) {
        case 0:
            SequencerPartitionContainer newContainer = containerModel.getPlatformType().createContainer();
            newContainer.setModel(containerModel);
            newContainer.setCreator(user);
            newContainer.setIdentificationBarcode(containerSerialNumber);
            newContainer.setPartitionLimit(laneCount);
            newContainer.setPartitions(IntStream.range(0, laneCount).mapToObj(i -> new PartitionImpl(newContainer, i + 1)).collect(Collectors.toList()));
            updatePartitionContents(getLaneContents, newContainer);
            RunPosition newRunPos = new RunPosition();
            newRunPos.setRun(target);
            newRunPos.setContainer(newContainer);
            newRunPos.setPosition(position);
            target.getRunPositions().clear();
            target.getRunPositions().add(newRunPos);
            return true;
        case 1:
            SequencerPartitionContainer container = containers.iterator().next();
            boolean isMutated = false;
            if (container.getPartitions().size() != laneCount) {
                throw new IllegalArgumentException(String.format("The container %s has %d partitions, but %d were detected by the scanner.", containerSerialNumber, container.getPartitions().size(), laneCount));
            }
            // only update container model from fallback to non-fallback
            if (container.getModel().isFallback() && !containerModel.isFallback() && container.getModel().getId() != containerModel.getId()) {
                container.setModel(containerModel);
                isMutated = true;
            }
            if (target.getSequencerPartitionContainers().stream().noneMatch(c -> c.getId() == container.getId())) {
                target.addSequencerPartitionContainer(container, position);
                updatePartitionContents(getLaneContents, container);
                isMutated = true;
            }
            return isMutated;
        default:
            throw new IllegalArgumentException("Multiple containers with same identifier: " + containerSerialNumber);
    }
}
Also used : SequencingContainerModel(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel) PaginationFilter(uk.ac.bbsrc.tgac.miso.core.util.PaginationFilter) LoggerFactory(org.slf4j.LoggerFactory) KitDescriptorService(uk.ac.bbsrc.tgac.miso.core.service.KitDescriptorService) Autowired(org.springframework.beans.factory.annotation.Autowired) MisoNamingException(uk.ac.bbsrc.tgac.miso.core.exception.MisoNamingException) RunPartition(uk.ac.bbsrc.tgac.miso.core.data.RunPartition) KitType(uk.ac.bbsrc.tgac.miso.core.data.type.KitType) NotImplementedException(org.apache.commons.lang.NotImplementedException) SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) NamingScheme(uk.ac.bbsrc.tgac.miso.core.service.naming.NamingScheme) Note(com.eaglegenomics.simlims.core.Note) JsonNode(com.fasterxml.jackson.databind.JsonNode) RunPartitionAliquotService(uk.ac.bbsrc.tgac.miso.core.service.RunPartitionAliquotService) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) ValidationException(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException) ConstraintViolationException(org.hibernate.exception.ConstraintViolationException) Predicate(java.util.function.Predicate) DeletionStore(uk.ac.bbsrc.tgac.miso.core.store.DeletionStore) Partition(uk.ac.bbsrc.tgac.miso.core.data.Partition) Collectors(java.util.stream.Collectors) PartitionImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PartitionImpl) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) SequencingParametersService(uk.ac.bbsrc.tgac.miso.core.service.SequencingParametersService) InstrumentService(uk.ac.bbsrc.tgac.miso.core.service.InstrumentService) PoolService(uk.ac.bbsrc.tgac.miso.core.service.PoolService) ChangeLogService(uk.ac.bbsrc.tgac.miso.core.service.ChangeLogService) RunService(uk.ac.bbsrc.tgac.miso.core.service.RunService) OxfordNanoporeRun(uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun) InstrumentModel(uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel) Barcodable(uk.ac.bbsrc.tgac.miso.core.data.Barcodable) IntStream(java.util.stream.IntStream) User(com.eaglegenomics.simlims.core.User) java.util(java.util) AuthorizationManager(uk.ac.bbsrc.tgac.miso.core.security.AuthorizationManager) RunStore(uk.ac.bbsrc.tgac.miso.persistence.RunStore) SequencerPartitionContainerChangeLog(uk.ac.bbsrc.tgac.miso.core.data.impl.changelog.SequencerPartitionContainerChangeLog) HealthType(uk.ac.bbsrc.tgac.miso.core.data.type.HealthType) InstrumentDataManglingPolicy(uk.ac.bbsrc.tgac.miso.core.data.InstrumentDataManglingPolicy) SequencingContainerModelService(uk.ac.bbsrc.tgac.miso.core.service.SequencingContainerModelService) IlluminaRun(uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun) UserService(uk.ac.bbsrc.tgac.miso.core.service.UserService) SolidRun(uk.ac.bbsrc.tgac.miso.core.data.SolidRun) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) Service(org.springframework.stereotype.Service) GetLaneContents(uk.ac.bbsrc.tgac.miso.core.data.GetLaneContents) LimsUtils(uk.ac.bbsrc.tgac.miso.core.util.LimsUtils) RunChangeLog(uk.ac.bbsrc.tgac.miso.core.data.impl.changelog.RunChangeLog) ContainerService(uk.ac.bbsrc.tgac.miso.core.service.ContainerService) NamingSchemeHolder(uk.ac.bbsrc.tgac.miso.core.service.naming.NamingSchemeHolder) RunPartitionService(uk.ac.bbsrc.tgac.miso.core.service.RunPartitionService) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) Logger(org.slf4j.Logger) InstrumentPosition(uk.ac.bbsrc.tgac.miso.core.data.InstrumentPosition) LS454Run(uk.ac.bbsrc.tgac.miso.core.data.LS454Run) WhineyFunction(uk.ac.bbsrc.tgac.miso.core.util.WhineyFunction) ExceptionUtils(org.apache.commons.lang.exception.ExceptionUtils) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) SequencingParameters(uk.ac.bbsrc.tgac.miso.core.data.SequencingParameters) AuthorizationException(uk.ac.bbsrc.tgac.miso.core.security.AuthorizationException) Consumer(java.util.function.Consumer) RunPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition) FileAttachmentService(uk.ac.bbsrc.tgac.miso.core.service.FileAttachmentService) ValidationUtils(uk.ac.bbsrc.tgac.miso.service.impl.ValidationUtils) PaginatedDataSource(uk.ac.bbsrc.tgac.miso.core.util.PaginatedDataSource) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Transactional(org.springframework.transaction.annotation.Transactional) SopService(uk.ac.bbsrc.tgac.miso.core.service.SopService) SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) RunPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.RunPosition) PartitionImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PartitionImpl) InstrumentPosition(uk.ac.bbsrc.tgac.miso.core.data.InstrumentPosition)

Example 4 with SequencingContainerModel

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

the class DefaultRunServiceTest method makeContainerModel.

private static SequencingContainerModel makeContainerModel() {
    SequencingContainerModel model = new SequencingContainerModel();
    model.setId(1L);
    model.setAlias("Container Model");
    model.setIdentificationBarcode(CONTAINER_MODEL_BARCODE);
    model.getInstrumentModels().add(makeInstrumentModel());
    model.setPartitionCount(1);
    model.setPlatformType(PlatformType.ILLUMINA);
    return model;
}
Also used : SequencingContainerModel(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel)

Example 5 with SequencingContainerModel

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

the class Dtos method to.

public static SequencerPartitionContainer to(@Nonnull ContainerDto from) {
    SequencerPartitionContainer to = null;
    if (from instanceof OxfordNanoporeContainerDto) {
        OxfordNanoporeContainerDto ontFrom = (OxfordNanoporeContainerDto) from;
        OxfordNanoporeContainer ontTo = new OxfordNanoporeContainer();
        setObject(ontTo::setPoreVersion, PoreVersion::new, ontFrom.getPoreVersionId());
        setDate(ontTo::setReceivedDate, ontFrom.getReceivedDate());
        setDate(ontTo::setReturnedDate, ontFrom.getReturnedDate());
        to = ontTo;
    } else {
        to = new SequencerPartitionContainerImpl();
    }
    setLong(to::setId, from.getId(), false);
    setString(to::setIdentificationBarcode, from.getIdentificationBarcode());
    setObject(to::setModel, SequencingContainerModel::new, maybeGetProperty(from.getModel(), SequencingContainerModelDto::getId));
    setString(to::setDescription, from.getDescription());
    setObject(to::setClusteringKit, KitDescriptor::new, from.getClusteringKitId());
    setString(to::setClusteringKitLot, from.getClusteringKitLot());
    setObject(to::setMultiplexingKit, KitDescriptor::new, from.getMultiplexingKitId());
    setString(to::setMultiplexingKitLot, from.getMultiplexingKitLot());
    return to;
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) SequencingContainerModel(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) OxfordNanoporeContainer(uk.ac.bbsrc.tgac.miso.core.data.impl.OxfordNanoporeContainer) SequencerPartitionContainerImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl) PoreVersion(uk.ac.bbsrc.tgac.miso.core.data.impl.PoreVersion) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)

Aggregations

SequencingContainerModel (uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel)33 Test (org.junit.Test)13 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)11 InstrumentModel (uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel)9 SequencerPartitionContainer (uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer)8 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)5 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)5 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)5 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)5 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)5 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)5 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)5 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)5 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)5 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)5 IOException (java.io.IOException)4 Collectors (java.util.stream.Collectors)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 SequencingParameters (uk.ac.bbsrc.tgac.miso.core.data.SequencingParameters)4 RunPurpose (uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose)4