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;
}
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);
}
}
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;
}
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()));
}
}
}
}
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;
}
Aggregations