Search in sources :

Example 1 with ListLibraryAliquotView

use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.

the class PoolImplTest method addElement.

private void addElement(PoolImpl pool, Index index1, Index index2) {
    ListLibraryAliquotView ldi = new ListLibraryAliquotView();
    ldi.setParentLibrary(new ParentLibrary());
    ldi.getParentLibrary().setIndex1(index1);
    ldi.getParentLibrary().setIndex2(index2);
    PoolElement element = new PoolElement(pool, ldi);
    pool.getPoolContents().add(element);
}
Also used : ParentLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentLibrary) ListLibraryAliquotView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView) PoolElement(uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement)

Example 2 with ListLibraryAliquotView

use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.

the class Dtos method to.

public static Pool to(@Nonnull PoolDto dto) {
    PoolImpl to = new PoolImpl();
    setLong(to::setId, dto.getId(), false);
    to.setAlias(dto.getAlias());
    setBigDecimal(to::setConcentration, dto.getConcentration());
    to.setConcentrationUnits(dto.getConcentrationUnits());
    setInteger(to::setDnaSize, dto.getDnaSize(), true);
    to.setCreationDate(parseDate(dto.getCreationDate()));
    to.setDescription(dto.getDescription());
    to.setIdentificationBarcode(dto.getIdentificationBarcode());
    to.setDiscarded(dto.isDiscarded());
    setBigDecimal(to::setVolume, dto.getVolume());
    to.setVolumeUnits(dto.getVolumeUnits());
    setObject(to::setPlatformType, dto.getPlatformType(), pt -> PlatformType.valueOf(pt));
    if (dto.getPooledElements() != null) {
        to.setPoolElements(dto.getPooledElements().stream().map(aliquot -> {
            ListLibraryAliquotView view = new ListLibraryAliquotView();
            view.setId(aliquot.getId());
            view.setName(aliquot.getName());
            setBigDecimal(view::setVolumeUsed, aliquot.getVolumeUsed());
            PoolElement link = new PoolElement(to, view);
            if (aliquot.getProportion() != null) {
                link.setProportion(aliquot.getProportion());
            }
            return link;
        }).collect(Collectors.toSet()));
    }
    to.setQcPassed(dto.getQcPassed());
    to.setBoxPosition((PoolBoxPosition) makeBoxablePosition(dto, to));
    if (dto.isMergeChild())
        to.makeMergeChild();
    return to;
}
Also used : ListLibraryAliquotView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView) PoolElement(uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement) 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) PoolImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PoolImpl)

Example 3 with ListLibraryAliquotView

use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.

the class HibernatePoolDaoIT method testAddAliquot.

@Test
public void testAddAliquot() throws IOException {
    Pool pool = dao.get(1L);
    int originalSize = pool.getPoolContents().size();
    ListLibraryAliquotView ldi = (ListLibraryAliquotView) sessionFactory.getCurrentSession().get(ListLibraryAliquotView.class, 14L);
    PoolElement element = new PoolElement(pool, ldi);
    pool.getPoolContents().add(element);
    dao.save(pool);
    sessionFactory.getCurrentSession().flush();
    sessionFactory.getCurrentSession().clear();
    Pool saved = dao.get(1L);
    int savedSize = saved.getPoolContents().size();
    assertEquals("LDI14 should present in saved collection", originalSize + 1, savedSize);
}
Also used : ListLibraryAliquotView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView) PoolElement(uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 4 with ListLibraryAliquotView

use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.

the class DefaultPoolService method loadPoolElements.

private void loadPoolElements(Pool source, Pool target) throws IOException {
    Set<ListLibraryAliquotView> removals = target.getPoolContents().stream().filter(notInOther(source.getPoolContents())).map(PoolElement::getAliquot).collect(Collectors.toSet());
    for (ListLibraryAliquotView aliquot : removals) {
        runPartitionAliquotService.deleteForPoolAliquot(target, aliquot.getId());
    }
    loadPoolElements(source.getPoolContents(), target);
}
Also used : ListLibraryAliquotView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView)

Example 5 with ListLibraryAliquotView

use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.

the class DefaultPoolService method loadPoolElements.

private void loadPoolElements(Collection<PoolElement> source, Pool target) throws IOException {
    Set<PoolElement> targetAliquots = target.getPoolContents();
    targetAliquots.removeIf(notInOther(source));
    Set<PoolElement> additions = source.stream().filter(notInOther(targetAliquots)).collect(Collectors.toSet());
    for (PoolElement sourcePd : additions) {
        ListLibraryAliquotView v = listLibraryAliquotViewService.get(sourcePd.getAliquot().getId());
        if (v == null) {
            throw new IllegalStateException("Pool contains an unsaved library aliquot");
        }
        targetAliquots.add(new PoolElement(target, v, sourcePd.getProportion()));
    }
    for (PoolElement targetPd : targetAliquots) {
        PoolElement sourcePd = source.stream().filter(spd -> spd.getAliquot().getId() == targetPd.getAliquot().getId()).findFirst().orElse(null);
        if (sourcePd != null) {
            targetPd.setProportion(sourcePd.getProportion());
        }
    }
}
Also used : ListLibraryAliquotView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView) PoolElement(uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement)

Aggregations

ListLibraryAliquotView (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView)8 PoolElement (uk.ac.bbsrc.tgac.miso.core.data.impl.view.PoolElement)5 Test (org.junit.Test)2 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)2 Pool (uk.ac.bbsrc.tgac.miso.core.data.Pool)2 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)1 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)1 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 Date (java.util.Date)1 Criteria (org.hibernate.Criteria)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1 Transactional (org.springframework.transaction.annotation.Transactional)1 EntityType (uk.ac.bbsrc.tgac.miso.core.data.Boxable.EntityType)1 DetailedQcStatus (uk.ac.bbsrc.tgac.miso.core.data.DetailedQcStatus)1 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)1 Partition (uk.ac.bbsrc.tgac.miso.core.data.Partition)1