private boolean updateSequencingParameters(final Run target, User user, Predicate<SequencingParameters> filterParameters, final Instrument sequencer) throws IOException { // If the sequencing parameters haven't been updated by a human, see if we can find exactly one that matches. if (!target.didSomeoneElseChangeColumn("parameters", user)) { List<SequencingParameters> possibleParameters = sequencingParametersService.getForInstrumentModel(sequencer.getInstrumentModel().getId()).stream() .filter(parameters -> !parameters.getName().startsWith("Custom")).filter(filterParameters).collect(Collectors.toList()); if (possibleParameters.size() == 1) { if (target.getSequencingParameters() == null || possibleParameters.get(0).getId() != target.getSequencingParameters().getId()) { target.setSequencingParameters(possibleParameters.get(0)); return true; } } } return false; }
/** * Loads persisted objects into run fields. Should be called before saving or updating. Loads all fields except for: * <ul> * <li>creator/lastModifier User objects</li> * </ul> * * @param run the Run to load entities into. Must contain at least the IDs of the objects to load. * @throws IOException */ private void loadChildEntities(Run run) throws IOException { if (run.getSequencingParameters() != null) { run.setSequencingParameters(sequencingParametersService.get(run.getSequencingParameters().getId())); } run.setSequencer(instrumentService.get(run.getSequencer().getId())); }
dto.setEndDate(formatDate(from.getCompletionDate())); if (from.getSequencingParameters() != null) { dto.setParameters(asDto(from.getSequencingParameters())); } else { SequencingParametersDto parametersDto = new SequencingParametersDto();
private void applyChanges(Run target, Run source) throws IOException { validateChanges(target, source); target.setAlias(source.getAlias()); target.setAccession(source.getAccession()); target.setDescription(source.getDescription()); target.setFilePath(source.getFilePath()); target.setHealth(source.getHealth()); target.setStartDate(source.getStartDate()); target.setCompletionDate(source.getCompletionDate()); target.setMetrics(source.getMetrics()); makeContainerChangesChangeLog(target, target.getSequencerPartitionContainers(), source.getSequencerPartitionContainers()); applyContainerChanges(target, source); target.setSequencingParameters(source.getSequencingParameters()); target.setSequencer(source.getSequencer()); if (isIlluminaRun(target)) { applyIlluminaChanges((IlluminaRun) target, (IlluminaRun) source); } else if (isLS454Run(target)) { applyLS454Changes((LS454Run) target, (LS454Run) source); } else if (isSolidRun(target)) { applySolidChanges((SolidRun) target, (SolidRun) source); } else if (isOxfordNanoporeRun(target)) { applyOxfordNanoporeChanges((OxfordNanoporeRun) target, (OxfordNanoporeRun) source); } }