use of uk.ac.bbsrc.tgac.miso.core.data.Index in project miso-lims by miso-lims.
the class PoolImplTest method makeIndex.
private Index makeIndex(String sequence, int position) {
Index index = new Index();
index.setSequence(sequence);
index.setPosition(position);
return index;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Index in project miso-lims by miso-lims.
the class DefaultLibraryTemplateService method loadIndices.
private void loadIndices(Map<String, Index> indices) throws IOException {
Map<String, Index> loaded = new HashMap<>();
for (String boxPosition : indices.keySet()) {
Index index = indices.get(boxPosition);
Index managedIndex = indexService.get(index.getId());
if (managedIndex == null) {
throw new ValidationException(new ValidationError("No index found with ID: " + index.getId()));
}
loaded.put(boxPosition, managedIndex);
}
indices.putAll(loaded);
}
use of uk.ac.bbsrc.tgac.miso.core.data.Index in project miso-lims by miso-lims.
the class Dtos method asDto.
public static LibraryAliquotDto asDto(@Nonnull ListLibraryAliquotView from) {
LibraryAliquotDto dto = null;
if (from.getParentAttributes() != null) {
// indicates detailed sample
DetailedLibraryAliquotDto detailedDto = new DetailedLibraryAliquotDto();
setId(detailedDto::setLibraryDesignCodeId, from.getDesignCode());
if (from.getSubprojectId() != null) {
detailedDto.setSubprojectAlias(from.getSubprojectAlias());
detailedDto.setSubprojectPriority(from.getSubprojectPriority());
}
if (from.getIdentityAttributes() != null) {
ParentIdentityAttributes identity = from.getIdentityAttributes();
setString(detailedDto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
setString(detailedDto::setEffectiveExternalNames, identity.getExternalName());
}
if (from.getTissueAttributes() != null) {
ParentTissueAttributes tissue = from.getTissueAttributes();
setString(detailedDto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
setString(detailedDto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
setString(detailedDto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
setString(detailedDto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
}
dto = detailedDto;
} else {
dto = new LibraryAliquotDto();
}
dto.setId(from.getId());
dto.setName(from.getName());
setString(dto::setAlias, from.getAlias());
setString(dto::setCreatorName, maybeGetProperty(from.getCreator(), User::getFullName));
setString(dto::setConcentration, from.getConcentration());
dto.setConcentrationUnits(from.getConcentrationUnits());
dto.setLastModified(formatDateTime(from.getLastModified()));
dto.setCreationDate(formatDate(from.getCreated()));
dto.setIdentificationBarcode(from.getAliquotBarcode());
dto.setLocationLabel(BoxUtils.makeLocationLabel(from));
dto.setIndexIds(Stream.of(from.getParentLibrary().getIndex1(), from.getParentLibrary().getIndex2()).filter(Objects::nonNull).map(Index::getId).collect(Collectors.toList()));
dto.setIndexLabels(Stream.of(from.getParentLibrary().getIndex1(), from.getParentLibrary().getIndex2()).filter(Objects::nonNull).map(Index::getLabel).collect(Collectors.toList()));
dto.setTargetedSequencingId(from.getTargetedSequencingId());
setInteger(dto::setDnaSize, from.getDnaSize(), true);
setString(dto::setVolume, from.getAliquotVolume());
dto.setVolumeUnits(from.getAliquotVolumeUnits());
setString(dto::setNgUsed, from.getNgUsed());
setString(dto::setVolumeUsed, from.getVolumeUsed());
dto.setLibraryId(from.getLibraryId());
dto.setLibraryName(from.getLibraryName());
dto.setLibraryAlias(from.getLibraryAlias());
dto.setLibraryLowQuality(from.isLibraryLowQuality());
dto.setLibraryPlatformType(from.getPlatformType().getKey());
dto.setSampleId(from.getSampleId());
dto.setSampleName(from.getSampleName());
dto.setSampleAlias(from.getSampleAlias());
setString(dto::setSequencingControlTypeAlias, maybeGetProperty(from.getSampleSequencingControlType(), SequencingControlType::getAlias));
setId(dto::setDetailedQcStatusId, from.getDetailedQcStatus());
setString(dto::setDetailedQcStatusNote, from.getDetailedQcStatusNote());
setString(dto::setQcUserName, maybeGetProperty(from.getQcUser(), User::getFullName));
setDateString(dto::setQcDate, from.getQcDate());
List<Long> parentAliquotIds = new ArrayList<>();
for (ParentAliquot parent = from.getParentAliquot(); parent != null; parent = parent.getParentAliquot()) {
parentAliquotIds.add(parent.getId());
}
dto.setParentAliquotIds(parentAliquotIds);
setEffectiveQcFailure(from, dto);
return dto;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Index in project miso-lims by miso-lims.
the class Dtos method asDto.
public static LibraryAliquotDto asDto(@Nonnull LibraryAliquot from, boolean includeBoxPositions) {
LibraryAliquotDto dto = null;
Library library = from.getLibrary();
Sample sample = library == null ? null : library.getSample();
if (isDetailedLibraryAliquot(from)) {
DetailedLibraryAliquotDto detailedDto = asDetailedDto((DetailedLibraryAliquot) from);
DetailedSample detailed = (DetailedSample) sample;
if (detailed.getSubproject() != null) {
detailedDto.setSubprojectAlias(detailed.getSubproject().getAlias());
detailedDto.setSubprojectPriority(detailed.getSubproject().getPriority());
}
if (detailed.getIdentityAttributes() != null) {
ParentIdentityAttributes identity = detailed.getIdentityAttributes();
setString(detailedDto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
setString(detailedDto::setEffectiveExternalNames, identity.getExternalName());
}
if (detailed.getTissueAttributes() != null) {
ParentTissueAttributes tissue = detailed.getTissueAttributes();
setString(detailedDto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
setString(detailedDto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
setString(detailedDto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
setString(detailedDto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
}
dto = detailedDto;
} else {
dto = new LibraryAliquotDto();
}
if (library != null) {
setLong(dto::setLibraryId, library.getId(), true);
setString(dto::setLibraryName, library.getName());
setString(dto::setLibraryAlias, library.getAlias());
setBoolean(dto::setLibraryLowQuality, library.isLowQuality(), false);
setString(dto::setLibraryPlatformType, library.getPlatformType().getKey());
if (library.getIndex1() != null) {
List<Index> indices = Stream.of(library.getIndex1(), library.getIndex2()).filter(Objects::nonNull).collect(Collectors.toList());
dto.setIndexIds(indices.stream().sorted(Comparator.comparingInt(Index::getPosition)).map(Index::getId).collect(Collectors.toList()));
dto.setIndexLabels(indices.stream().sorted(Comparator.comparingInt(Index::getPosition)).map(Index::getLabel).collect(Collectors.toList()));
}
if (sample != null) {
setLong(dto::setSampleId, sample.getId(), true);
setString(dto::setSampleName, sample.getName());
setString(dto::setSampleAlias, sample.getAlias());
}
}
if (from.getParentAliquot() != null) {
setLong(dto::setParentAliquotId, from.getParentAliquot().getId(), true);
setString(dto::setParentAliquotAlias, from.getParentAliquot().getAlias());
}
setString(dto::setParentName, maybeGetProperty(from.getParent(), HierarchyEntity::getName));
setString(dto::setParentVolume, maybeGetProperty(from.getParent(), HierarchyEntity::getVolume));
dto.setId(from.getId());
dto.setName(from.getName());
setString(dto::setAlias, from.getAlias());
setString(dto::setDescription, from.getDescription());
dto.setCreatorName(from.getCreator().getFullName());
setString(dto::setConcentration, from.getConcentration());
dto.setConcentrationUnits(from.getConcentrationUnits());
setString(dto::setVolume, from.getVolume());
dto.setVolumeUnits(from.getVolumeUnits());
setString(dto::setNgUsed, from.getNgUsed());
setString(dto::setVolumeUsed, from.getVolumeUsed());
setInteger(dto::setDnaSize, from.getDnaSize(), true);
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());
}
if (from.getBox() != null) {
dto.setBox(asDto(from.getBox(), includeBoxPositions));
dto.setBoxPosition(from.getBoxPosition());
}
dto.setDiscarded(from.isDiscarded());
setDateTimeString(dto::setLastModified, from.getLastModified());
setId(dto::setDetailedQcStatusId, from.getDetailedQcStatus());
setString(dto::setDetailedQcStatusNote, from.getDetailedQcStatusNote());
setString(dto::setQcUserName, maybeGetProperty(from.getQcUser(), User::getFullName));
setDateString(dto::setQcDate, from.getQcDate());
setEffectiveQcFailure(from, dto);
setId(dto::setKitDescriptorId, from.getKitDescriptor());
setString(dto::setKitLot, from.getKitLot());
Requisition requisition = from.getLibrary().getSample().getRequisition();
if (requisition == null) {
requisition = getParentRequisition(from.getLibrary().getSample());
}
setId(dto::setRequisitionId, requisition);
setString(dto::setRequisitionAlias, maybeGetProperty(requisition, Requisition::getAlias));
return dto;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Index in project miso-lims by miso-lims.
the class IndexCheckerTest method makeIndex.
public Index makeIndex(String fakeSequence, String realSequences) {
Index index = new Index();
IndexFamily family = new IndexFamily();
family.setFake(realSequences != null);
index.setFamily(family);
index.setName(fakeSequence + " name");
index.setSequence(fakeSequence);
index.setRealSequences(realSequences);
return index;
}
Aggregations