public static TargetedSequencingDto asDto(@Nonnull TargetedSequencing from) { TargetedSequencingDto dto = new TargetedSequencingDto(); dto.setId(from.getId()); dto.setAlias(from.getAlias()); dto.setArchived(from.isArchived()); dto.setKitDescriptorIds(from.getKitDescriptors().stream().map(KitDescriptor::getId).collect(Collectors.toList())); return dto; }
public static TargetedSequencing to(@Nonnull TargetedSequencingDto dto) { TargetedSequencing to = new TargetedSequencing(); to.setId(dto.getId()); to.setAlias(dto.getAlias()); return to; }
public void clearTargetedSequencing() { for (TargetedSequencing ts : this.targetedSequencing) { ts.getKitDescriptors().remove(this); } this.targetedSequencing.clear(); }
private void throwTargetedSequencingIncompatible(TargetedSequencing ts, KitDescriptor kd) { String tsName = ts.getAlias(); String kitName = kd.getName(); throw new IllegalArgumentException(String.format("Selected targeted sequencing is not available for kit on parent library.\n" + "If you think this is an error, please contact your MISO administrator " + "to make targeted sequencing \"%s\" available for kit \"%s\".", tsName, kitName)); }
public static LibraryDilution to(@Nonnull DilutionDto from) { LibraryDilution to = new LibraryDilution(); if (from.getId() != null) to.setId(from.getId()); if (!isStringEmptyOrNull(from.getName())) { to.setName(from.getName()); } to.setIdentificationBarcode(from.getIdentificationBarcode()); to.setConcentration(from.getConcentration() == null ? null : Double.valueOf(from.getConcentration())); to.setConcentrationUnits(from.getConcentrationUnits()); to.setNgUsed(from.getNgUsed() == null ? null : Double.valueOf(from.getNgUsed())); to.setVolume(from.getVolume() == null ? null : Double.valueOf(from.getVolume())); to.setVolumeUnits(from.getVolumeUnits()); to.setVolumeUsed(from.getVolumeUsed() == null ? null : Double.valueOf(from.getVolumeUsed())); to.setLibrary(to(from.getLibrary())); to.setCreationDate(parseDate(from.getCreationDate())); if (from.getTargetedSequencingId() != null) { to.setTargetedSequencing(new TargetedSequencing()); to.getTargetedSequencing().setId(from.getTargetedSequencingId()); } to.setBoxPosition((DilutionBoxPosition) makeBoxablePosition(from, to)); to.setDiscarded(from.isDiscarded()); return to; }
if (them.getTargetedSequencing() != null) return false; } else if (!targetedSequencing.equals(them.getTargetedSequencing())) { return false;
@Override public List<LibraryDilution> getDilutionsForKdTsRelationship(KitDescriptor kd, TargetedSequencing ts) { Criteria criteria = currentSession().createCriteria(LibraryDilution.class); criteria.createAlias("library.kitDescriptor", "kitDescriptor"); criteria.add(Restrictions.eq("kitDescriptor.id", kd.getId())); criteria.add(Restrictions.eq("targetedSequencing.id", ts.getId())); @SuppressWarnings("unchecked") List<LibraryDilution> records = criteria.list(); return records; }
public void removeTargetedSequencing(TargetedSequencing targetedSequencing) { this.targetedSequencing.remove(targetedSequencing); targetedSequencing.getKitDescriptors().remove(this); }
private void validateChange(KitDescriptor managed, KitDescriptor changes) { List<ValidationError> errors = new ArrayList<>(); Collection<TargetedSequencing> removed = CollectionUtils.subtract(managed.getTargetedSequencing(), changes.getTargetedSequencing()); for (TargetedSequencing ts : removed) { List<LibraryDilution> affectedDilutions = kitStore.getDilutionsForKdTsRelationship(managed, ts); if (!affectedDilutions.isEmpty()) { errors.add(new ValidationError( String.format("Cannot unlink targeted sequencing '%s' from kit '%s' as %d dilutions already use this link.", ts.getAlias(), managed.getName(), affectedDilutions.size()))); } } if (!errors.isEmpty()) { throw new ValidationException(errors); } }
private void loadChildEntities(KitDescriptor kitDescriptor) throws IOException { Set<TargetedSequencing> maybeManaged = Sets.newHashSet(kitDescriptor.getTargetedSequencing()); kitDescriptor.clearTargetedSequencing(); for (TargetedSequencing ts : maybeManaged) { if (ts != null && ts.getId() != TargetedSequencing.UNSAVED_ID) { kitDescriptor.addTargetedSequencing(targetedSequencingService.get(ts.getId())); } } }
public void addTargetedSequencing(TargetedSequencing targetedSequencing) { this.targetedSequencing.add(targetedSequencing); targetedSequencing.getKitDescriptors().add(this); }
private static DilutionDto asDto(@Nonnull LibraryDilution from, @Nonnull LibraryDto libraryDto, boolean includeBoxPositions) { DilutionDto dto = new DilutionDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setDilutionUserName(from.getCreator().getFullName()); dto.setConcentration(from.getConcentration() == null ? null : from.getConcentration().toString()); dto.setConcentrationUnits(from.getConcentrationUnits()); dto.setVolume(from.getVolume() == null ? null : from.getVolume().toString()); dto.setVolumeUnits(from.getVolumeUnits()); dto.setNgUsed(from.getNgUsed() == null ? null : from.getNgUsed().toString()); dto.setVolumeUsed(from.getVolumeUsed() == null ? null : from.getVolumeUsed().toString()); if (from.getCreationDate() != null) { dto.setCreationDate(formatDate(from.getCreationDate())); } dto.setIdentificationBarcode(from.getIdentificationBarcode()); dto.setLocationLabel(BoxUtils.makeLocationLabel(from)); if (from.getTargetedSequencing() != null) { dto.setTargetedSequencingId(from.getTargetedSequencing().getId()); } dto.setLibrary(libraryDto); if (from.getBox() != null) { dto.setBox(asDto(from.getBox(), includeBoxPositions)); dto.setBoxPosition(from.getBoxPosition()); } dto.setDiscarded(from.isDiscarded()); return dto; }
/** * Loads persisted objects into LibraryDilution fields. Should be called before saving LibraryDilutions. Loads all member objects * <b>except</b> * <ul> * <li>creator/lastModifier User objects</li> * </ul> * * @param libraryDilution the LibraryDilution to load entities into. Must contain at least the IDs of objects to load (e.g. to load the * persisted Library * into dilution.library, dilution.library.id must be set) * @throws IOException */ private void loadChildEntities(LibraryDilution dilution) throws IOException { if (dilution.getLibrary() != null) { dilution.setLibrary(libraryService.get(dilution.getLibrary().getId())); } if (dilution.getTargetedSequencing() != null) { dilution.setTargetedSequencing(targetedSequencingService.get(dilution.getTargetedSequencing().getId())); } if (dilution.getSecurityProfile() != null && dilution.getSecurityProfile().getProfileId() != SecurityProfile.UNSAVED_ID) { dilution.setSecurityProfile(securityProfileStore.get(dilution.getSecurityProfile().getProfileId())); } }
original.setReferenceGenome(referenceGenomeDao.getReferenceGenome(project.getReferenceGenome().getId())); if (project.getDefaultTargetedSequencing() != null) { original.setDefaultTargetedSequencing(targetedSequencingStore.get(project.getDefaultTargetedSequencing().getId())); } else { original.setDefaultTargetedSequencing(null);