Search in sources :

Example 1 with SampleClass

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;
}
Also used : SampleAliquot(uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) SampleClassImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl) SampleAliquotImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleAliquotImpl)

Example 2 with SampleClass

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;
}
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) TissueOrigin(uk.ac.bbsrc.tgac.miso.core.data.TissueOrigin) TissueType(uk.ac.bbsrc.tgac.miso.core.data.TissueType) TissueOriginImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.TissueOriginImpl) SampleTissueImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissueImpl) TissueTypeImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.TissueTypeImpl)

Example 3 with SampleClass

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;
}
Also used : SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) SampleClassImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl) SampleStockImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleStockImpl) SampleStock(uk.ac.bbsrc.tgac.miso.core.data.SampleStock)

Example 4 with SampleClass

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;
}
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 5 with SampleClass

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);
}
Also used : SampleValidRelationship(uk.ac.bbsrc.tgac.miso.core.data.SampleValidRelationship) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass)

Aggregations

SampleClass (uk.ac.bbsrc.tgac.miso.core.data.SampleClass)41 SampleClassImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl)27 SampleStock (uk.ac.bbsrc.tgac.miso.core.data.SampleStock)10 SampleTissue (uk.ac.bbsrc.tgac.miso.core.data.SampleTissue)10 Test (org.junit.Test)8 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)8 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)8 SampleStockImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleStockImpl)8 SampleAliquot (uk.ac.bbsrc.tgac.miso.core.data.SampleAliquot)6 SampleIdentity (uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity)5 SampleValidRelationship (uk.ac.bbsrc.tgac.miso.core.data.SampleValidRelationship)5 SampleTissueImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleTissueImpl)4 User (com.eaglegenomics.simlims.core.User)3 HashSet (java.util.HashSet)3 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)3 SampleTissuePiece (uk.ac.bbsrc.tgac.miso.core.data.SampleTissuePiece)3 SampleAliquotImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleAliquotImpl)3 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