Search in sources :

Example 1 with SampleSlide

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

the class AbstractBulkSampleIT method assertAllForSlide.

protected void assertAllForSlide(Map<String, String> slide, Long sampleId, boolean newlyCreated) {
    SampleSlide target = (SampleSlide) getSession().get(SampleSlideImpl.class, sampleId);
    assertPlainSampleAttributes(slide, target, newlyCreated);
    assertDetailedSampleAttributes(slide, target);
    assertSlideAttributes(slide, target);
    if (newlyCreated) {
        SampleTissue tissueParent = LimsUtils.getParent(SampleTissue.class, target);
        assertTissueAttributes(slide, tissueParent);
    }
}
Also used : SampleSlideImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl) SampleTissue(uk.ac.bbsrc.tgac.miso.core.data.SampleTissue) SampleSlide(uk.ac.bbsrc.tgac.miso.core.data.SampleSlide)

Example 2 with SampleSlide

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

the class DefaultSampleService method createGhostParent.

private DetailedSample createGhostParent(DetailedSample parent, DetailedSample child) throws IOException {
    parent.setProject(child.getProject());
    parent.setSubproject(child.getSubproject());
    parent.setSampleType(child.getSampleType());
    parent.setScientificName(child.getScientificName());
    parent.setVolume(BigDecimal.ZERO);
    parent.setVolumeUnits(VolumeUnit.MICROLITRES);
    parent.setSynthetic(true);
    if (child.getIdentityId() != null)
        parent.setIdentityId(child.getIdentityId());
    if (isTissuePieceSample(child) && isSampleSlide(parent)) {
        SampleSlide parentSlides = (SampleSlide) parent;
        Integer slides = parentSlides.getSlides() == null ? 0 : parentSlides.getSlides();
        slides += ((SampleTissuePiece) child).getSlidesConsumed();
        parentSlides.setSlides(slides);
        if (parentSlides.isSaved()) {
            update(parentSlides);
        }
    }
    create(parent);
    return parent;
}
Also used : SampleSlide(uk.ac.bbsrc.tgac.miso.core.data.SampleSlide)

Example 3 with SampleSlide

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

the class DefaultSampleService method updateParentSlides.

private void updateParentSlides(Sample child, Sample beforeChange, User changeUser) {
    if (child.getParent() == null || !isSampleSlide(child.getParent())) {
        return;
    }
    SampleSlide parent = (SampleSlide) deproxify(child.getParent());
    Integer slidesConsumed = null;
    if (isTissuePieceSample(child)) {
        slidesConsumed = ((SampleTissuePiece) child).getSlidesConsumed();
    } else if (isStockSample(child)) {
        slidesConsumed = ((SampleStock) child).getSlidesConsumed();
    }
    if (slidesConsumed == null) {
        return;
    }
    if (beforeChange == null) {
        updateParentSlides(parent, parent.getSlides() - slidesConsumed, changeUser);
    } else {
        Integer beforeSlidesConsumed = null;
        if (isTissuePieceSample(beforeChange)) {
            beforeSlidesConsumed = ((SampleTissuePiece) beforeChange).getSlidesConsumed();
        } else if (isStockSample(beforeChange)) {
            beforeSlidesConsumed = ((SampleStock) beforeChange).getSlidesConsumed();
        }
        if (!slidesConsumed.equals(beforeSlidesConsumed)) {
            updateParentSlides(parent, parent.getSlides() + beforeSlidesConsumed - slidesConsumed, changeUser);
        }
    }
}
Also used : SampleSlide(uk.ac.bbsrc.tgac.miso.core.data.SampleSlide) SampleStock(uk.ac.bbsrc.tgac.miso.core.data.SampleStock)

Example 4 with SampleSlide

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

the class Dtos method toSlideSample.

private static SampleSlide toSlideSample(@Nonnull SampleSlideDto from) {
    SampleSlide to = new SampleSlideImpl();
    setInteger(to::setInitialSlides, from.getInitialSlides(), true);
    setInteger(to::setSlides, from.getSlides(), true);
    setInteger(to::setThickness, from.getThickness(), true);
    setObject(to::setStain, Stain::new, from.getStainId());
    setBigDecimal(to::setPercentTumour, from.getPercentTumour());
    setBigDecimal(to::setPercentNecrosis, from.getPercentNecrosis());
    setBigDecimal(to::setMarkedArea, from.getMarkedArea());
    setBigDecimal(to::setMarkedAreaPercentTumour, from.getMarkedAreaPercentTumour());
    return to;
}
Also used : SampleSlideImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl) Stain(uk.ac.bbsrc.tgac.miso.core.data.Stain) SampleSlide(uk.ac.bbsrc.tgac.miso.core.data.SampleSlide) 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)

Example 5 with SampleSlide

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

the class Dtos method getParent.

/**
 * Extracts parent details from the DTO, according to these possible cases:
 *
 * <ol>
 * <li>parent ID is provided. This implies that the parent exists, so no other parent information will be required</li>
 * <li>identity information and parentSampleClassId are provided. This implies that a tissue parent should be created, and that the
 * identity may or may not yet exist. If the sampleClassId is an aliquot, a stockClassId must be provided. ParentAliquotClassId may be
 * provided to indicate a second aliquot level in the hierarchy</li>
 * <li>identity information is provided, but no parentSampleClassId. You must be creating a tissue in this case.</li>
 * </ol>
 *
 * @param childDto
 *          the DTO to take parent details from
 * @return the parent details from the DTO, or null if there are none. A returned sample will also include its own parent if applicable.
 */
private static DetailedSample getParent(@Nonnull DetailedSampleDto childDto) {
    DetailedSample parent = null;
    if (childDto.getParentId() != null) {
        parent = new DetailedSampleImpl();
        parent.setId(childDto.getParentId());
    } else {
        if (childDto instanceof SampleIdentityDto && childDto.getClass() != SampleIdentityDto.class) {
            parent = toIdentitySample((SampleIdentityDto) childDto);
        }
        if (childDto instanceof SampleTissueDto && childDto.getClass() != SampleTissueDto.class) {
            if (childDto.getParentSampleClassId() == null) {
                throw new IllegalArgumentException("No tissue class specified.");
            }
            DetailedSample tissue = toTissueSample((SampleTissueDto) childDto);
            tissue.setSampleClass(new SampleClassImpl());
            tissue.getSampleClass().setId(childDto.getParentSampleClassId());
            tissue.setParent(parent);
            parent = tissue;
            if (childDto instanceof SampleTissuePieceDto) {
                SampleTissuePieceDto tissuePieceDto = (SampleTissuePieceDto) childDto;
                if (tissuePieceDto.getParentSlideClassId() != null) {
                    SampleSlide slide = new SampleSlideImpl();
                    slide.setSampleClass(new SampleClassImpl());
                    slide.getSampleClass().setId(tissuePieceDto.getParentSlideClassId());
                    slide.setSlides(0);
                    slide.setParent(parent);
                    parent = slide;
                }
            }
        }
        if (childDto instanceof SampleSingleCellRelative && childDto.getClass() != SampleSingleCellDto.class) {
            SampleStockDto stockDto = (SampleStockDto) childDto;
            DetailedSample tissueProcessing = toSingleCellSample((SampleSingleCellRelative) childDto);
            tissueProcessing.setSampleClass(new SampleClassImpl());
            tissueProcessing.getSampleClass().setId(stockDto.getTissueProcessingClassId());
            tissueProcessing.setParent(parent);
            parent = tissueProcessing;
        }
        if (childDto instanceof SampleStockDto && childDto.getClass() != SampleStockDto.class && childDto.getClass() != SampleStockSingleCellDto.class && childDto.getClass() != SampleStockRnaDto.class) {
            SampleAliquotDto aliquotDto = (SampleAliquotDto) childDto;
            DetailedSample stock = toStockSample((SampleStockDto) childDto);
            stock.setSampleClass(new SampleClassImpl());
            stock.getSampleClass().setId(aliquotDto.getStockClassId());
            stock.setParent(parent);
            parent = stock;
            if (aliquotDto.getParentAliquotClassId() != null) {
                DetailedSample parentAliquot = toAliquotSample(aliquotDto);
                parentAliquot.setSampleClass(new SampleClassImpl());
                parentAliquot.getSampleClass().setId(aliquotDto.getParentAliquotClassId());
                parentAliquot.setParent(parent);
                parent = parentAliquot;
            }
        }
    }
    return parent;
}
Also used : DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) SampleSlideImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl) SampleClassImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl) SampleSlide(uk.ac.bbsrc.tgac.miso.core.data.SampleSlide) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)

Aggregations

SampleSlide (uk.ac.bbsrc.tgac.miso.core.data.SampleSlide)10 SampleSlideImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl)5 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)4 SampleStock (uk.ac.bbsrc.tgac.miso.core.data.SampleStock)3 TransferSample (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample)3 Test (org.junit.Test)2 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)2 SampleTissue (uk.ac.bbsrc.tgac.miso.core.data.SampleTissue)2 Stain (uk.ac.bbsrc.tgac.miso.core.data.Stain)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 User (com.eaglegenomics.simlims.core.User)1 LinkedHashMap (java.util.LinkedHashMap)1 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)1 SampleAliquot (uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot)1 SampleIdentity (uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity)1 SampleTissuePiece (uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece)1 DetailedSampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)1 ProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl)1