Search in sources :

Example 1 with Index

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;
}
Also used : Index(uk.ac.bbsrc.tgac.miso.core.data.Index)

Example 2 with 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);
}
Also used : ValidationException(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException) HashMap(java.util.HashMap) Index(uk.ac.bbsrc.tgac.miso.core.data.Index) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)

Example 3 with Index

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;
}
Also used : ParentTissueAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes) ParentIdentityAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes) ArrayList(java.util.ArrayList) Index(uk.ac.bbsrc.tgac.miso.core.data.Index) ParentAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentAliquot)

Example 4 with Index

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;
}
Also used : ParentTissueAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes) ParentSample(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentSample) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) WorksetSample(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample) GrandparentSample(uk.ac.bbsrc.tgac.miso.core.data.impl.view.GrandparentSample) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) ParentIdentityAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Index(uk.ac.bbsrc.tgac.miso.core.data.Index) TransferLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary) ParentLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentLibrary) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) WorksetLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) Requisition(uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition)

Example 5 with Index

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;
}
Also used : IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) Index(uk.ac.bbsrc.tgac.miso.core.data.Index)

Aggregations

Index (uk.ac.bbsrc.tgac.miso.core.data.Index)17 IndexFamily (uk.ac.bbsrc.tgac.miso.core.data.IndexFamily)7 Test (org.junit.Test)5 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)5 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)4 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)4 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)4 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)4 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)4 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)4 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)4 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)4 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)4 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)4 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)4 RunPositionDto (uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto)4 SolidRunDto (uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto)4 ArrayList (java.util.ArrayList)2 DetailedLibrary (uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary)2 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)2