use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl 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;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl 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;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl 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;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl in project miso-lims by miso-lims.
the class LimsUtilsTest method testInstanceOfSampleTissueProcessing.
@Test
public void testInstanceOfSampleTissueProcessing() throws Exception {
SampleSlide slide = new SampleSlideImpl();
assertTrue("Slide is a type of Tissue Processing", LimsUtils.isTissueProcessingSample(slide));
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleSlideImpl in project miso-lims by miso-lims.
the class Dtos method toStockSample.
private static SampleStock toStockSample(@Nonnull SampleStockDto from) {
SampleStock to = null;
if (from instanceof SampleStockSingleCellRelative) {
SampleStockSingleCellRelative scFrom = (SampleStockSingleCellRelative) from;
SampleStockSingleCell sc = new SampleStockSingleCellImpl();
setBigDecimal(sc::setTargetCellRecovery, scFrom.getTargetCellRecovery());
setBigDecimal(sc::setCellViability, scFrom.getCellViability());
setBigDecimal(sc::setLoadingCellConcentration, scFrom.getLoadingCellConcentration());
to = sc;
} else if (from instanceof SampleStockRnaRelative) {
SampleStockRnaRelative rnaFrom = (SampleStockRnaRelative) from;
SampleStockRna rna = new SampleStockRnaImpl();
setBoolean(rna::setDnaseTreated, rnaFrom.getDnaseTreated(), true);
to = rna;
} else {
to = new SampleStockImpl();
}
if (from.getStrStatus() != null) {
to.setStrStatus(from.getStrStatus());
}
setInteger(to::setSlidesConsumed, from.getSlidesConsumed(), true);
setObject(to::setReferenceSlide, SampleSlideImpl::new, from.getReferenceSlideId());
return to;
}
Aggregations