use of uk.ac.bbsrc.tgac.miso.core.data.SampleClass in project miso-lims by miso-lims.
the class OicrSampleAliasGeneratorTest method makeAliquotFromAliquot.
private SampleAliquot makeAliquotFromAliquot() throws Exception {
SampleAliquot aliquot = new SampleAliquotImpl();
SampleAliquot parent = makeAliquotFromStock();
parent.setAlias("PROJ_1234567_nn_n_nn_1-1_R_12");
SampleClass parentSc = new SampleClassImpl();
parentSc.setSampleCategory(SampleAliquot.CATEGORY_NAME);
aliquot.setParent(parent);
SampleClass sc = new SampleClassImpl();
sc.setSampleCategory(SampleAliquot.CATEGORY_NAME);
sc.setSuffix("MR_");
aliquot.setSampleClass(sc);
aliquot.setSiblingNumber(2);
return aliquot;
}
use of uk.ac.bbsrc.tgac.miso.core.data.SampleClass in project miso-lims by miso-lims.
the class OicrSampleAliasGeneratorTest method makeTissueFromTissue.
private SampleTissue makeTissueFromTissue() throws Exception {
SampleTissue parent = (SampleTissue) makeFullTissue();
parent.setAlias("PROJ_0001_Bn_P_nn_1-1");
parent.setParent(makeIdentity());
SampleTissue child = new SampleTissueImpl();
SampleClass sc = new SampleClassImpl();
sc.setSampleCategory(SampleTissue.CATEGORY_NAME);
child.setSampleClass(sc);
child.setParent(parent);
child.setTimesReceived(1);
child.setTubeNumber(1);
TissueOrigin to = new TissueOriginImpl();
to.setAlias("Bn");
child.setTissueOrigin(to);
TissueType tt = new TissueTypeImpl();
tt.setAlias("O");
child.setTissueType(tt);
return child;
}
use of uk.ac.bbsrc.tgac.miso.core.data.SampleClass in project miso-lims by miso-lims.
the class OicrSampleAliasGeneratorTest method makeStockFromStock.
private Sample makeStockFromStock() throws Exception {
SampleStock stock = new SampleStockImpl();
SampleStock parentStock = makeStockFromTissue();
parentStock.setAlias("PROJ_0001_nn_n_nn_1-1_D_S4");
stock.setParent(parentStock);
SampleClass sc = new SampleClassImpl();
sc.setSampleCategory(SampleStock.CATEGORY_NAME);
sc.setSuffix("D_S");
stock.setSampleClass(sc);
stock.setSiblingNumber(6);
return stock;
}
use of uk.ac.bbsrc.tgac.miso.core.data.SampleClass 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.SampleClass in project miso-lims by miso-lims.
the class DefaultSampleClassService method getRequiredTissueProcessingClass.
@Override
public SampleClass getRequiredTissueProcessingClass(Long childClassId) throws IOException {
SampleClass stockClass = getNotNullClass(childClassId);
Set<SampleValidRelationship> relationships = sampleValidRelationshipService.getAll();
if (relationships.stream().anyMatch(relationship -> !relationship.isArchived() && relationship.getChild().getId() == childClassId && relationship.getParent().getSampleCategory().equals(SampleTissue.CATEGORY_NAME))) {
return null;
}
List<SampleClass> parentClasses = relationships.stream().filter(relationship -> !relationship.isArchived() && relationship.getChild().getId() == childClassId && relationship.getParent().getSampleCategory().equals(SampleTissueProcessing.CATEGORY_NAME)).map(SampleValidRelationship::getParent).collect(Collectors.toList());
return singleResult(parentClasses, stockClass, SampleTissueProcessing.CATEGORY_NAME);
}
Aggregations