private void loadPoolDilutions(Pool source, Pool target) throws IOException { loadPoolDilutions(source.getPoolDilutions(), target); }
private Stream<String> createRowsForPartition(Run run, User user, List<String> columns, Partition partition) { return partition.getPool().getPoolDilutions().stream()// .map(PoolDilution::getPoolableElementView) .map(dilution -> { final String[] output = new String[columns.size()]; makeColumns(run, partition, dilution, user.getLoginName(), output); return String.join(",", output); }); }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof Pool)) return false; Pool other = (Pool) obj; return new EqualsBuilder().appendSuper(super.equals(obj)).append(description, other.getDescription()) .append(poolDilutions, other.getPoolDilutions()) .append(concentration, other.getConcentration()) .append(identificationBarcode, other.getIdentificationBarcode()) .append(qcPassed, other.getQcPassed()) .isEquals(); }
@Override protected Stream<Pair<PoolableElementView, Partition>> items() { return submission.getExperiments().stream().flatMap(experiment -> experiment.getRunPartitions().stream()).flatMap( rp -> rp.getPartition().getPool().getPoolDilutions().stream() .map(pd -> new Pair<>(pd.getPoolableElementView(), rp.getPartition()))); }
private void loadPoolDilutions(Collection<PoolDilution> source, Pool target) throws IOException { Set<PoolDilution> targetDilutions = target.getPoolDilutions(); targetDilutions.removeIf(notInOther(source)); Set<PoolDilution> additions = source.stream() .filter(notInOther(targetDilutions)) .collect(Collectors.toSet()); for (PoolDilution sourcePd : additions) { PoolableElementView v = poolableElementViewService.get(sourcePd.getPoolableElementView().getDilutionId()); if (v == null) { throw new IllegalStateException("Pool contains an unsaved dilution"); } targetDilutions.add(new PoolDilution(target, v, sourcePd.getProportion())); } for (PoolDilution targetPd : targetDilutions) { PoolDilution sourcePd = source.stream() .filter(spd -> spd.getPoolableElementView().getDilutionId() == targetPd.getPoolableElementView().getDilutionId()) .findFirst().orElse(null); if (sourcePd != null) { targetPd.setProportion(sourcePd.getProportion()); } } }
@Override protected void populate(Element xml, Pair<PoolableElementView, Partition> entry) { Run r = entry.getValue().getSequencerPartitionContainer().getLastRun(); xml.setAttribute("alias", "L00" + entry.getValue().getPartitionNumber() + ":" + entry.getKey().getDilutionName() + ":" + r.getAlias()); xml.setAttribute("run_center", centreName); if (r.getHealth() == HealthType.Completed) { xml.setAttribute("run_date", DF_TIMESTAMP.format(r.getCompletionDate())); } xml.setAttribute("center_name", centreName); for (Experiment e : submission.getExperiments()) { Element experimentRef = xml.getOwnerDocument().createElementNS(null, "EXPERIMENT_REF"); experimentRef.setAttribute("refname", e.getAlias()); experimentRef.setAttribute("refcenter", centreName); xml.appendChild(experimentRef); } Element dataBlock = xml.getOwnerDocument().createElementNS(null, "DATA_BLOCK"); dataBlock.setAttribute("sector", Integer.toString(entry.getValue().getPartitionNumber())); if (entry.getValue().getPool().getPoolDilutions().size() > 1) { // multiplexed dataBlock.setAttribute("member_name", entry.getKey().getDilutionName()); } }
.filter(pool -> pool.getPoolDilutions().size() > 1).forEach(pool -> { pool.getPoolDilutions().stream().map(PoolDilution::getPoolableElementView).forEach(dilution -> { Element xmlMember = xml.getOwnerDocument().createElementNS(null, "MEMBER"); xmlMember.setAttribute("member_name", dilution.getDilutionName());
dto.setDilutionCount(from.getPoolDilutions().size()); from.getPoolDilutions().stream()// if (includeContents) { Set<DilutionDto> pooledElements = new HashSet<>(); for (PoolDilution pd : from.getPoolDilutions()) { DilutionDto ldi = asDto(pd.getPoolableElementView()); ldi.setProportion(pd.getProportion());
pool.setName(generateTemporaryName()); loadSecurityProfile(pool); loadPoolDilutions(pool.getPoolDilutions(), pool); pool.setChangeDetails(authorizationManager.getCurrentUser()); boxService.throwIfBoxPositionIsFilled(pool); managed.setCreationDate(pool.getCreationDate()); Set<String> originalItems = extractDilutionNames(managed.getPoolDilutions()); loadPoolDilutions(pool, managed); Set<String> updatedItems = extractDilutionNames(managed.getPoolDilutions());