use of uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun in project miso-lims by miso-lims.
the class Dtos method getPlatformRunDto.
private static RunDto getPlatformRunDto(@Nonnull Run from) {
if (from instanceof IlluminaRun) {
IlluminaRunDto dto = new IlluminaRunDto();
IlluminaRun illuminaRun = (IlluminaRun) from;
setString(dto::setWorkflowType, maybeGetProperty(illuminaRun.getWorkflowType(), IlluminaWorkflowType::getRawValue));
dto.setNumCycles(illuminaRun.getNumCycles());
dto.setCalledCycles(illuminaRun.getCallCycle());
dto.setImagedCycles(illuminaRun.getImgCycle());
dto.setScoredCycles(illuminaRun.getScoreCycle());
dto.setPairedEnd(illuminaRun.getPairedEnd());
setString(dto::setBasesMask, illuminaRun.getRunBasesMask());
return dto;
} else if (from instanceof IonTorrentRun) {
return new IonTorrentRunDto();
} else if (from instanceof LS454Run) {
Ls454RunDto dto = new Ls454RunDto();
LS454Run ls454Run = (LS454Run) from;
dto.setCycles(ls454Run.getCycles());
dto.setPairedEnd(ls454Run.getPairedEnd());
return dto;
} else if (from instanceof SolidRun) {
SolidRunDto dto = new SolidRunDto();
SolidRun solidRun = (SolidRun) from;
dto.setPairedEnd(solidRun.getPairedEnd());
return dto;
} else if (from instanceof OxfordNanoporeRun) {
OxfordNanoporeRunDto dto = new OxfordNanoporeRunDto();
OxfordNanoporeRun ontRun = (OxfordNanoporeRun) from;
setString(dto::setMinKnowVersion, ontRun.getMinKnowVersion());
setString(dto::setProtocolVersion, ontRun.getProtocolVersion());
return dto;
} else if (from instanceof PacBioRun) {
return new PacBioRunDto();
} else {
throw new IllegalArgumentException("Unknown run type");
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun in project miso-lims by miso-lims.
the class DefaultRunService method processNotification.
@Override
public boolean processNotification(Run source, int laneCount, String containerModel, String containerSerialNumber, String sequencerName, Predicate<SequencingParameters> filterParameters, GetLaneContents getLaneContents, String positionName) throws IOException, MisoNamingException {
User user = userService.getByLoginName("notification");
final Run target;
Run runFromDb = runDao.getByAlias(source.getAlias());
boolean isNew;
if (runFromDb == null) {
target = source.getPlatformType().createRun();
target.setAlias(source.getAlias());
isNew = true;
} else {
target = runFromDb;
if (source.getPlatformType() != target.getPlatformType()) {
throw new IllegalStateException("Run scanner detected a run from " + source.getPlatformType().name() + " and there is a save run from " + target.getPlatformType().name());
}
isNew = false;
}
target.setLastModifier(user);
boolean isMutated = false;
isMutated |= updateMetricsFromNotification(source, target);
isMutated |= updateField(source.getFilePath(), target.getFilePath(), target::setFilePath);
isMutated |= updateField(source.getStartDate(), target.getStartDate(), target::setStartDate);
final Instrument sequencer = instrumentService.getByName(sequencerName);
if (sequencer == null) {
throw new IllegalArgumentException("No such sequencer: " + sequencerName);
}
target.setSequencer(sequencer);
SequencingContainerModel model = containerModelService.find(sequencer.getInstrumentModel(), containerModel, laneCount);
if (model == null) {
throw new IllegalArgumentException("Could not find container or fallback for parameters: model=" + containerModel + ", lanes=" + laneCount);
}
if (model.isFallback() && isNew) {
log.info("Could not find container model with model=" + containerModel + " and lanes=" + laneCount + " for run " + source.getAlias() + "; used fallback container model instead.");
}
isMutated |= updateContainerFromNotification(target, user, model, containerSerialNumber, getLaneContents, positionName);
isMutated |= updateHealthFromNotification(source, target, user);
isMutated |= updateSequencingKitFromNotification(target, source.getSequencingKit());
isMutated |= updateDataManglingPolicyFromNotification(target, source.getDataManglingPolicy(), user);
switch(source.getPlatformType()) {
case ILLUMINA:
isMutated |= updateIlluminaRunFromNotification((IlluminaRun) source, (IlluminaRun) target);
break;
case LS454:
isMutated |= updateField(((LS454Run) source).getCycles(), ((LS454Run) target).getCycles(), ((LS454Run) target)::setCycles);
isMutated |= updateField(source.getPairedEnd(), target.getPairedEnd(), target::setPairedEnd);
break;
case OXFORDNANOPORE:
isMutated |= updateField(((OxfordNanoporeRun) source).getMinKnowVersion(), ((OxfordNanoporeRun) target).getMinKnowVersion(), ((OxfordNanoporeRun) target)::setMinKnowVersion);
isMutated |= updateField(((OxfordNanoporeRun) source).getProtocolVersion(), ((OxfordNanoporeRun) target).getProtocolVersion(), ((OxfordNanoporeRun) target)::setProtocolVersion);
break;
case IONTORRENT:
case PACBIO:
case SOLID:
// Nothing to do
break;
default:
throw new NotImplementedException();
}
isMutated |= updateSequencingParameters(target, user, filterParameters, sequencer);
if (isNew) {
create(target);
} else if (isMutated) {
update(target);
}
return isNew;
}
use of uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun in project miso-lims by miso-lims.
the class Dtos method getPlatformRun.
private static Run getPlatformRun(RunDto from) {
if (from instanceof IlluminaRunDto) {
IlluminaRun run = new IlluminaRun();
IlluminaRunDto illuminaDto = (IlluminaRunDto) from;
setObject(run::setWorkflowType, illuminaDto.getWorkflowType(), wf -> IlluminaWorkflowType.get(wf));
run.setNumCycles(illuminaDto.getNumCycles());
run.setCallCycle(illuminaDto.getCalledCycles());
run.setImgCycle(illuminaDto.getImagedCycles());
run.setScoreCycle(illuminaDto.getScoredCycles());
run.setPairedEnd(illuminaDto.getPairedEnd());
setString(run::setRunBasesMask, illuminaDto.getBasesMask());
return run;
} else if (from instanceof IonTorrentRunDto) {
return new IonTorrentRun();
} else if (from instanceof Ls454RunDto) {
LS454Run run = new LS454Run();
Ls454RunDto ls454Dto = (Ls454RunDto) from;
run.setCycles(ls454Dto.getCycles());
run.setPairedEnd(ls454Dto.getPairedEnd());
return run;
} else if (from instanceof SolidRunDto) {
SolidRun run = new SolidRun();
SolidRunDto solidDto = (SolidRunDto) from;
run.setPairedEnd(solidDto.getPairedEnd());
return run;
} else if (from instanceof OxfordNanoporeRunDto) {
OxfordNanoporeRun run = new OxfordNanoporeRun();
OxfordNanoporeRunDto ontDto = (OxfordNanoporeRunDto) from;
setString(run::setMinKnowVersion, ontDto.getMinKnowVersion());
setString(run::setProtocolVersion, ontDto.getProtocolVersion());
return run;
} else if (from instanceof PacBioRunDto) {
return new PacBioRun();
} else {
throw new IllegalArgumentException("Unknown run type");
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun in project miso-lims by miso-lims.
the class Dtos method to.
public static Run to(@Nonnull NotificationDto from) {
final Run to = getMisoPlatformTypeFromRunscanner(from.getPlatformType()).createRun();
setCommonRunValues(from, to);
switch(to.getPlatformType()) {
case PACBIO:
break;
case OXFORDNANOPORE:
setOxfordNanoporeRunValues((OxfordNanoporeNotificationDto) from, (OxfordNanoporeRun) to);
break;
case ILLUMINA:
setIlluminaRunValues((IlluminaNotificationDto) from, (IlluminaRun) to);
break;
default:
throw new NotImplementedException();
}
return to;
}
Aggregations