Search in sources :

Example 1 with Stain

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

the class Dtos method to.

public static Stain to(@Nonnull StainDto from) {
    Stain to = new Stain();
    setLong(to::setId, from.getId(), false);
    setString(to::setName, from.getName());
    setObject(to::setCategory, StainCategory::new, from.getCategoryId());
    return to;
}
Also used : Stain(uk.ac.bbsrc.tgac.miso.core.data.Stain) StainCategory(uk.ac.bbsrc.tgac.miso.core.data.StainCategory) 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 2 with Stain

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

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

the class DefaultSampleService method loadChildEntities.

/**
 * Loads persisted objects into sample fields. Should be called before saving new samples. Loads all member objects <b>except</b>
 * <ul>
 * <li>parent sample for detailed samples</li>
 * <li>creator/lastModifier User objects</li>
 * </ul>
 *
 * @param sample the Sample to load entities into. Must contain at least the IDs of objects to load (e.g. to load the persisted Project
 *          into sample.project, sample.project.id must be set)
 * @throws IOException
 */
private void loadChildEntities(Sample sample) throws IOException {
    if (sample.getProject() != null) {
        sample.setProject(projectStore.get(sample.getProject().getId()));
    }
    loadChildEntity(sample::setScientificName, sample.getScientificName(), scientificNameService, "scientificNameId");
    loadChildEntity(sample::setSequencingControlType, sample.getSequencingControlType(), sequencingControlTypeService, "sequencingControlTypeId");
    loadChildEntity(sample::setSop, sample.getSop(), sopService, "sopId");
    loadChildEntity(sample::setDetailedQcStatus, sample.getDetailedQcStatus(), detailedQcStatusService, "detailedQcStatusId");
    loadChildEntity(sample::setRequisition, sample.getRequisition(), requisitionService, "requisitionId");
    if (isDetailedSample(sample)) {
        DetailedSample detailed = (DetailedSample) sample;
        if (detailed.getSampleClass() != null && detailed.getSampleClass().isSaved()) {
            detailed.setSampleClass(sampleClassService.get(detailed.getSampleClass().getId()));
        }
        if (detailed.getSubproject() != null && detailed.getSubproject().isSaved()) {
            detailed.setSubproject(subprojectService.get(detailed.getSubproject().getId()));
        }
        if (isTissueProcessingSample(detailed)) {
            if (detailed instanceof SampleSlide) {
                Stain originalStain = ((SampleSlide) detailed).getStain();
                Stain stain;
                if (originalStain == null) {
                    stain = null;
                } else {
                    stain = stainService.get(originalStain.getId());
                }
                ((SampleSlide) detailed).setStain(stain);
            } else if (detailed instanceof SampleTissuePiece) {
                SampleTissuePiece tissuePiece = (SampleTissuePiece) detailed;
                tissuePiece.setTissuePieceType(tissuePieceTypeDao.get(tissuePiece.getTissuePieceType().getId()));
                if (tissuePiece.getReferenceSlide() != null) {
                    Sample ref = deproxify(get(tissuePiece.getReferenceSlide().getId()));
                    tissuePiece.setReferenceSlide((SampleSlide) ref);
                }
            }
        }
        if (isAliquotSample(detailed)) {
            SampleAliquot sa = (SampleAliquot) detailed;
            if (sa.getSamplePurpose() != null && sa.getSamplePurpose().isSaved()) {
                sa.setSamplePurpose(samplePurposeDao.get(sa.getSamplePurpose().getId()));
            }
        }
        if (isStockSample(detailed)) {
            SampleStock stock = (SampleStock) detailed;
            if (stock.getReferenceSlide() != null) {
                Sample ref = deproxify(get(stock.getReferenceSlide().getId()));
                stock.setReferenceSlide((SampleSlide) ref);
            }
        }
        if (isTissueSample(detailed)) {
            SampleTissue st = (SampleTissue) detailed;
            if (st.getTissueMaterial() != null && st.getTissueMaterial().isSaved()) {
                st.setTissueMaterial(tissueMaterialDao.get(st.getTissueMaterial().getId()));
            }
            if (st.getTissueOrigin() != null && st.getTissueOrigin().isSaved()) {
                st.setTissueOrigin(tissueOriginDao.get(st.getTissueOrigin().getId()));
            }
            if (st.getTissueType() != null && st.getTissueType().isSaved()) {
                st.setTissueType(tissueTypeDao.get(st.getTissueType().getId()));
            }
            if (st.getLab() != null && st.getLab().isSaved()) {
                st.setLab(labService.get(st.getLab().getId()));
            }
        }
    }
}
Also used : SampleTissue(uk.ac.bbsrc.tgac.miso.core.data.SampleTissue) Stain(uk.ac.bbsrc.tgac.miso.core.data.Stain) SampleAliquot(uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) SampleSlide(uk.ac.bbsrc.tgac.miso.core.data.SampleSlide) SampleTissuePiece(uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece) SampleStock(uk.ac.bbsrc.tgac.miso.core.data.SampleStock)

Example 4 with Stain

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

the class HibernateStainDaoIT method testGet.

@Test
public void testGet() throws IOException {
    long id = 1L;
    Stain stain = sut.get(id);
    assertNotNull(stain);
    assertEquals(id, stain.getId());
}
Also used : Stain(uk.ac.bbsrc.tgac.miso.core.data.Stain) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 5 with Stain

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

the class HibernateStainDaoIT method testCreate.

@Test
public void testCreate() throws IOException {
    String name = "New Stain";
    Stain stain = new Stain();
    stain.setName(name);
    long savedId = sut.create(stain);
    clearSession();
    Stain saved = (Stain) getSessionFactory().getCurrentSession().get(Stain.class, savedId);
    assertEquals(name, saved.getName());
}
Also used : Stain(uk.ac.bbsrc.tgac.miso.core.data.Stain) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

Stain (uk.ac.bbsrc.tgac.miso.core.data.Stain)8 Test (org.junit.Test)5 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)5 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)2 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)2 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)2 SampleSlide (uk.ac.bbsrc.tgac.miso.core.data.SampleSlide)2 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)2 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)2 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)2 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)2 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)2 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)2 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)2 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)2 RunPositionDto (uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto)2 SolidRunDto (uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto)2 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)1 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)1 SampleAliquot (uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot)1