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