Search in sources :

Example 11 with Library

use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.

the class Dtos method to.

public static Transfer to(@Nonnull TransferDto from) {
    Transfer to = new Transfer();
    setLong(to::setId, from.getId(), false);
    setString(to::setTransferRequestName, from.getTransferRequestName());
    setDateTime(to::setTransferTime, from.getTransferTime());
    setObject(to::setSenderLab, LabImpl::new, from.getSenderLabId());
    setObject(to::setSenderGroup, Group::new, from.getSenderGroupId());
    setString(to::setRecipient, from.getRecipient());
    setObject(to::setRecipientGroup, Group::new, from.getRecipientGroupId());
    addTransferItems(to::getSampleTransfers, from.getItems(), EntityType.SAMPLE, TransferSample::new, SampleImpl::new, SampleBoxPosition::new, Sample::setBoxPosition);
    addTransferItems(to::getLibraryTransfers, from.getItems(), EntityType.LIBRARY, TransferLibrary::new, LibraryImpl::new, LibraryBoxPosition::new, Library::setBoxPosition);
    addTransferItems(to::getLibraryAliquotTransfers, from.getItems(), EntityType.LIBRARY_ALIQUOT, TransferLibraryAliquot::new, LibraryAliquot::new, LibraryAliquotBoxPosition::new, LibraryAliquot::setBoxPosition);
    addTransferItems(to::getPoolTransfers, from.getItems(), EntityType.POOL, TransferPool::new, PoolImpl::new, PoolBoxPosition::new, Pool::setBoxPosition);
    return to;
}
Also used : Group(com.eaglegenomics.simlims.core.Group) TransferPool(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferPool) 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) LibraryAliquotBoxPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.boxposition.LibraryAliquotBoxPosition) LibraryBoxPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.boxposition.LibraryBoxPosition) LabImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LabImpl) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) TransferLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot) WorksetLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot) OrderLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.OrderLibraryAliquot) DetailedLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryAliquot) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) PoolImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PoolImpl) TransferLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot) SampleBoxPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.boxposition.SampleBoxPosition) TransferLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary) PoolBoxPosition(uk.ac.bbsrc.tgac.miso.core.data.impl.boxposition.PoolBoxPosition) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl) Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer) TransferPool(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferPool) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) InstrumentStatusPositionRunPool(uk.ac.bbsrc.tgac.miso.core.data.impl.view.instrumentstatus.InstrumentStatusPositionRunPool) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto) 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) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)

Example 12 with Library

use of uk.ac.bbsrc.tgac.miso.core.data.Library 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 13 with Library

use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.

the class Dtos method to.

public static QC to(@Nonnull QcDto dto) {
    QC to;
    switch(dto.getQcTarget()) {
        case "Library":
            LibraryQC newLibraryQc = new LibraryQC();
            Library ownerLibrary = new LibraryImpl();
            ownerLibrary.setId(dto.getEntityId());
            newLibraryQc.setLibrary(ownerLibrary);
            to = newLibraryQc;
            break;
        case "Sample":
            SampleQC newSampleQc = new SampleQC();
            Sample ownerSample = new SampleImpl();
            ownerSample.setId(dto.getEntityId());
            newSampleQc.setSample(ownerSample);
            to = newSampleQc;
            break;
        case "Pool":
            PoolQC newPoolQc = new PoolQC();
            Pool ownerPool = new PoolImpl();
            ownerPool.setId(dto.getEntityId());
            newPoolQc.setPool(ownerPool);
            to = newPoolQc;
            break;
        case "Container":
            ContainerQC newContainerQc = new ContainerQC();
            SequencerPartitionContainer ownerContainer = new SequencerPartitionContainerImpl();
            ownerContainer.setId(dto.getEntityId());
            newContainerQc.setContainer(ownerContainer);
            to = newContainerQc;
            break;
        case "Requisition":
            RequisitionQC newRequisitionQc = new RequisitionQC();
            Requisition ownerRequisition = new Requisition();
            ownerRequisition.setId(dto.getEntityId());
            newRequisitionQc.setRequisition(ownerRequisition);
            to = newRequisitionQc;
            break;
        default:
            throw new IllegalArgumentException("No such QC target: " + dto.getQcTarget());
    }
    if (dto.getId() != null) {
        to.setId(dto.getId());
    }
    to.setDate(parseDate(dto.getDate()));
    setBigDecimal(to::setResults, dto.getResults());
    setObject(to::setType, QcType::new, dto.getQcTypeId());
    to.setDescription(dto.getDescription());
    setObject(to::setInstrument, InstrumentImpl::new, dto.getInstrumentId());
    setObject(to::setKit, KitDescriptor::new, dto.getKitDescriptorId());
    setString(to::setKitLot, dto.getKitLot());
    addQcControlRuns(dto.getControls(), to, QcTarget.valueOf(dto.getQcTarget()));
    return to;
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) 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) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) RequisitionQC(uk.ac.bbsrc.tgac.miso.core.data.qc.RequisitionQC) LibraryQC(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC) PoolImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PoolImpl) LibraryQC(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC) PoolQC(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC) QC(uk.ac.bbsrc.tgac.miso.core.data.qc.QC) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) ContainerQC(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC) RequisitionQC(uk.ac.bbsrc.tgac.miso.core.data.qc.RequisitionQC) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl) SequencerPartitionContainerImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl) TransferPool(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferPool) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) InstrumentStatusPositionRunPool(uk.ac.bbsrc.tgac.miso.core.data.impl.view.instrumentstatus.InstrumentStatusPositionRunPool) ContainerQC(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC) 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) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto) PoolQC(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC) Requisition(uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl) QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType)

Example 14 with Library

use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.

the class V2LibraryAliasGeneratorTest method testGenerateForShortIdentityNumber.

@Test
public void testGenerateForShortIdentityNumber() throws Exception {
    Library lib = constructHierarchy("123", "05");
    mockFirstAvailableSiblingNumber(8);
    assertEquals("TEST_123_05_LB08", sut.generate(lib));
}
Also used : DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) Test(org.junit.Test)

Example 15 with Library

use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.

the class V2LibraryAliasGeneratorTest method testGenerateForLongIdentityNumber.

@Test
public void testGenerateForLongIdentityNumber() throws Exception {
    Library lib = constructHierarchy("012345", "06");
    mockFirstAvailableSiblingNumber(12);
    assertEquals("TEST_012345_06_LB12", sut.generate(lib));
}
Also used : DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) Test(org.junit.Test)

Aggregations

Library (uk.ac.bbsrc.tgac.miso.core.data.Library)56 Test (org.junit.Test)23 LibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl)20 DetailedLibrary (uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary)14 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)13 TransferLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary)13 LibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot)11 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)10 Pool (uk.ac.bbsrc.tgac.miso.core.data.Pool)8 ArrayList (java.util.ArrayList)7 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)7 IOException (java.io.IOException)6 PostMapping (org.springframework.web.bind.annotation.PostMapping)6 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)6 Collection (java.util.Collection)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 WorksetLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary)5 Date (java.util.Date)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)4