Search in sources :

Example 1 with SampleTissuePiece

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

the class OicrSampleAliasGenerator method addSiblingTag.

private String addSiblingTag(String parentAlias, DetailedSample sample) throws IOException {
    SampleClass sc = sample.getSampleClass();
    if (sc == null) {
        throw new InvalidParameterException("Unexpected null SampleClass");
    }
    final String suffix;
    if (SampleTissueProcessing.CATEGORY_NAME.equals(sc.getSampleCategory()) && SampleTissuePiece.SUBCATEGORY_NAME.equals(sc.getSampleSubcategory())) {
        suffix = ((SampleTissuePiece) sample).getTissuePieceType().getAbbreviation();
    } else {
        suffix = sc.getSuffix();
    }
    if (suffix == null) {
        throw new InvalidParameterException("Unexpected null suffix");
    }
    String partialAlias = parentAlias + SEPARATOR + suffix;
    if (sample.getSiblingNumber() == null) {
        if (siblingNumberGenerator == null) {
            throw new IllegalStateException("No SiblingNumberGenerator configured");
        }
        sample.setSiblingNumber(siblingNumberGenerator.getNextSiblingNumber(SampleImpl.class, partialAlias));
    }
    String siblingNum = sample.getSiblingNumber().toString();
    // Sibling number is only padded for Tissue Processing
    if (isTissueProcessingSample(sample)) {
        while (siblingNum.length() < 2) siblingNum = "0" + siblingNum;
    }
    return partialAlias + siblingNum;
}
Also used : InvalidParameterException(java.security.InvalidParameterException) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) SampleTissuePiece(uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)

Example 2 with SampleTissuePiece

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

the class AbstractBulkSampleIT method assertAllForLcmTube.

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

Example 3 with SampleTissuePiece

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

the class Dtos method toTissuePieceSample.

private static SampleTissuePiece toTissuePieceSample(@Nonnull SampleTissuePieceDto from) {
    SampleTissuePiece to = new SampleTissuePieceImpl();
    TissuePieceType tissuePieceType = new TissuePieceType();
    tissuePieceType.setId(from.getTissuePieceTypeId());
    to.setTissuePieceType(tissuePieceType);
    to.setSlidesConsumed(from.getSlidesConsumed());
    setObject(to::setReferenceSlide, SampleSlideImpl::new, from.getReferenceSlideId());
    return to;
}
Also used : SampleSlideImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl) TissuePieceType(uk.ac.bbsrc.tgac.miso.core.data.type.TissuePieceType) 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) SampleTissuePiece(uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece) SampleTissuePieceImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissuePieceImpl)

Example 4 with SampleTissuePiece

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

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

the class OicrSampleAliasGeneratorTest method makeLcmTube.

private SampleTissuePiece makeLcmTube() {
    SampleTissuePiece lcmTube = new SampleTissuePieceImpl();
    SampleTissue tissue = makeMinimalTissue();
    tissue.setAlias("PROJ_0001_nn_n_nn_1-1");
    lcmTube.setParent(tissue);
    lcmTube.setSiblingNumber(2);
    SampleClass sc = new SampleClassImpl();
    sc.setSampleCategory(SampleTissueProcessing.CATEGORY_NAME);
    sc.setSuffix("LCM");
    lcmTube.setSampleClass(sc);
    return lcmTube;
}
Also used : SampleTissue(uk.ac.bbsrc.tgac.miso.core.data.SampleTissue) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) SampleClassImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl) SampleTissuePiece(uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece) SampleTissuePieceImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissuePieceImpl)

Aggregations

SampleTissuePiece (uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece)6 SampleTissue (uk.ac.bbsrc.tgac.miso.core.data.SampleTissue)4 SampleTissuePieceImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissuePieceImpl)4 SampleClass (uk.ac.bbsrc.tgac.miso.core.data.SampleClass)3 SampleClassImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl)2 TissuePieceType (uk.ac.bbsrc.tgac.miso.core.data.type.TissuePieceType)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 InvalidParameterException (java.security.InvalidParameterException)1 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 SampleSlide (uk.ac.bbsrc.tgac.miso.core.data.SampleSlide)1 SampleStock (uk.ac.bbsrc.tgac.miso.core.data.SampleStock)1 Stain (uk.ac.bbsrc.tgac.miso.core.data.Stain)1 SampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)1 SampleSlideImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl)1 TransferSample (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample)1 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)1