Search in sources :

Example 6 with IndexFamily

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

the class HibernateIndexFamilyDaoIT method testGetUsage.

@Test
public void testGetUsage() throws IOException {
    IndexFamily fam = (IndexFamily) getSessionFactory().getCurrentSession().get(IndexFamily.class, 1L);
    assertEquals("TruSeq Single Index", fam.getName());
    assertEquals(14L, sut.getUsage(fam));
}
Also used : IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 7 with IndexFamily

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

the class ConstantsController method rebuildConstants.

private void rebuildConstants() {
    try {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode node = mapper.createObjectNode();
        node.put("docsVersion", getDocsVersion());
        node.put("isDetailedSample", detailedSample);
        node.put("automaticBarcodes", autoGenerateIdBarcodes);
        node.put("boxScannerEnabled", boxScannerEnabled);
        node.put("newOptionSopUrl", newOptionSopUrl);
        final Collection<SampleValidRelationship> relationships = sampleValidRelationshipService.getAll();
        addJsonArray(mapper, node, "libraryDesigns", libraryDesignService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "libraryTypes", libraryTypeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "librarySelections", librarySelectionService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "libraryStrategies", libraryStrategyService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "libraryDesignCodes", libraryDesignCodeService.list(), Dtos::asDto);
        Set<Long> activePlatforms = sequencerService.list().stream().filter(Instrument::isActive).map(sequencer -> sequencer.getInstrumentModel().getId()).collect(Collectors.toSet());
        addJsonArray(mapper, node, "instrumentModels", instrumentModelService.list(), platform -> {
            InstrumentModelDto dto = Dtos.asDto(platform);
            dto.setActive(activePlatforms.contains(platform.getId()));
            return dto;
        });
        addJsonArray(mapper, node, "kitDescriptors", kitService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "sampleClasses", sampleClassService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "sampleValidRelationships", relationships, Dtos::asDto);
        addJsonArray(mapper, node, "detailedQcStatuses", detailedQcStatusService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "subprojects", subprojectService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "labs", labService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "tissueOrigins", tissueOriginService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "tissueTypes", tissueTypeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "tissueMaterials", tissueMaterialService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "tissuePieceTypes", tissuePieceTypeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "stains", stainService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "targetedSequencings", targetedSequencingService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "samplePurposes", samplePurposeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "sequencingParameters", sequencingParametersService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "printerBackends", Arrays.asList(Backend.values()), Dtos::asDto);
        addJsonArray(mapper, node, "printerDrivers", Arrays.asList(Driver.values()), Dtos::asDto);
        addJsonArray(mapper, node, "boxSizes", boxSizeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "boxUses", boxUseService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "studyTypes", studyTypeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "sampleCategories", SampleClass.CATEGORIES, Function.identity());
        createMap(mapper, node, "sampleSubcategories", SampleClass.SUBCATEGORIES);
        addJsonArray(mapper, node, "submissionAction", Arrays.asList(SubmissionActionType.values()), SubmissionActionType::name);
        addJsonArray(mapper, node, "containerModels", containerModelService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "poreVersions", containerService.listPoreVersions(), Dtos::asDto);
        addJsonArray(mapper, node, "spikeIns", librarySpikeInService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "attachmentCategories", attachmentCategoryService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "runPurposes", runPurposeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "sequencingControlTypes", sequencingControlTypeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "scientificNames", scientificNameService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "pipelines", pipelineService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "runLibraryQcStatuses", runLibraryQcStatusService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "worksetCategories", worksetCategoryService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "worksetStages", worksetStageService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "metrics", metricService.list(), MetricDto::from);
        addJsonArray(mapper, node, "metricSubcategories", metricSubcategoryService.list(), MetricSubcategoryDto::from);
        addJsonArray(mapper, node, "assays", assayService.list(), AssayDto::from);
        addJsonArray(mapper, node, "assayTests", assayTestService.list(), AssayTestDto::from);
        addJsonArray(mapper, node, "sampleSheetFormats", Arrays.asList(SampleSheet.values()), SampleSheet::name);
        Collection<IndexFamily> indexFamilies = indexFamilyService.list();
        addJsonArray(mapper, node, "indexFamilies", indexFamilies, Dtos::asDto);
        addJsonArray(mapper, node, "qcTypes", qcService.listQcTypes(), Dtos::asDto);
        addJsonArray(mapper, node, "qcTargets", Arrays.asList(QcTarget.values()), Dtos::asDto);
        addJsonArray(mapper, node, "concentrationUnits", Arrays.asList(ConcentrationUnit.values()), Dtos::asDto);
        addJsonArray(mapper, node, "volumeUnits", Arrays.asList(VolumeUnit.values()), Dtos::asDto);
        addJsonArray(mapper, node, "partitionQcTypes", partitionQcTypeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "referenceGenomes", referenceGenomeService.list(), Dtos::asDto);
        addJsonArray(mapper, node, "spreadsheetFormats", Arrays.asList(SpreadSheetFormat.values()), Dtos::asDto);
        addJsonArray(mapper, node, "sampleSpreadsheets", Arrays.asList(SampleSpreadSheets.values()), Dtos::asDto);
        addJsonArray(mapper, node, "librarySpreadsheets", Arrays.asList(LibrarySpreadSheets.values()), Dtos::asDto);
        addJsonArray(mapper, node, "libraryAliquotSpreadsheets", Arrays.asList(LibraryAliquotSpreadSheets.values()), Dtos::asDto);
        addJsonArray(mapper, node, "poolSpreadsheets", Arrays.asList(PoolSpreadSheets.values()), Dtos::asDto);
        addJsonArray(mapper, node, "partitionSpreadsheets", Arrays.asList(PartitionSpreadsheets.values()), Dtos::asDto);
        addJsonArray(mapper, node, "runLibrarySpreadsheets", Arrays.asList(RunLibrarySpreadsheets.values()), Dtos::asDto);
        addJsonArray(mapper, node, "workflows", Arrays.asList(WorkflowName.values()), Dtos::asDto);
        addJsonArray(mapper, node, "printableFields", Arrays.asList(PrintableField.values()), PrintableField::name);
        ArrayNode platformTypes = node.putArray("platformTypes");
        Collection<PlatformType> activePlatformTypes = instrumentModelService.listActivePlatformTypes();
        for (PlatformType platformType : PlatformType.values()) {
            ObjectNode dto = platformTypes.addObject();
            dto.put("name", platformType.name());
            dto.put("key", platformType.getKey());
            dto.put("containerName", platformType.getContainerName());
            dto.put("active", activePlatformTypes.contains(platformType));
            dto.put("partitionName", platformType.getPartitionName());
            dto.put("pluralPartitionName", platformType.getPluralPartitionName());
        }
        ArrayNode sampleTypes = node.putArray("sampleTypes");
        for (SampleType sampleType : sampleTypeService.list()) {
            if (!sampleType.isArchived()) {
                sampleTypes.add(sampleType.getName());
            }
        }
        ArrayNode donorSexes = node.putArray("donorSexes");
        for (String label : DonorSex.getLabels()) {
            donorSexes.add(label);
        }
        ArrayNode consentLevels = node.putArray("consentLevels");
        for (ConsentLevel level : ConsentLevel.values()) {
            consentLevels.add(level.getLabel());
        }
        ArrayNode strStatuses = node.putArray("strStatuses");
        for (String label : StrStatus.getLabels()) {
            strStatuses.add(label);
        }
        ArrayNode dilutionFactors = node.putArray("dilutionFactors");
        for (String label : DilutionFactor.getLabels()) {
            dilutionFactors.add(label);
        }
        ArrayNode illuminaChemistry = node.putArray("illuminaChemistry");
        for (IlluminaChemistry chemistry : IlluminaChemistry.values()) {
            illuminaChemistry.add(chemistry.name());
        }
        addIlluminaExperimentTypes(node);
        addHealthTypes(node);
        addIlluminaWorkflowTypes(node);
        addInstrumentTypes(node);
        addDataManglingPolicies(node);
        addMetricCategories(node);
        addThresholdTypes(node);
        ObjectNode warningsNode = mapper.createObjectNode();
        warningsNode.put("consentRevoked", "CONSENT REVOKED");
        warningsNode.put("duplicateIndices", indexChecker.getErrorMismatchesMessage());
        warningsNode.put("nearDuplicateIndices", indexChecker.getWarningMismatchesMessage());
        warningsNode.put("lowQualityLibraries", "Low Quality Libraries");
        warningsNode.put("missingIndex", "MISSING INDEX");
        warningsNode.put("negativeVolume", "Negative Volume");
        node.set("warningMessages", warningsNode);
        node.put("errorEditDistance", indexChecker.getErrorMismatches());
        node.put("warningEditDistance", indexChecker.getWarningMismatches());
        node.put("genomeFolder", genomeFolder);
        // Save the regenerated file in cache.
        constantsJs = "Constants = " + mapper.writeValueAsString(node) + ";";
        constantsTimestamp.set(System.currentTimeMillis() / 1000.0);
    } catch (IOException e) {
        throw new RestException(e);
    }
}
Also used : UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) Arrays(java.util.Arrays) LibraryAliquotSpreadSheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.LibraryAliquotSpreadSheets) ScheduledFuture(java.util.concurrent.ScheduledFuture) PoolSpreadSheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.PoolSpreadSheets) SampleSpreadSheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.SampleSpreadSheets) IlluminaWorkflowType(uk.ac.bbsrc.tgac.miso.core.data.type.IlluminaWorkflowType) Autowired(org.springframework.beans.factory.annotation.Autowired) SampleSheet(uk.ac.bbsrc.tgac.miso.core.util.SampleSheet) CacheControl(org.springframework.http.CacheControl) InstrumentType(uk.ac.bbsrc.tgac.miso.core.data.type.InstrumentType) Backend(uk.ac.bbsrc.tgac.miso.core.service.printing.Backend) MisoWebUtils.addJsonArray(uk.ac.bbsrc.tgac.miso.webapp.util.MisoWebUtils.addJsonArray) ThresholdType(uk.ac.bbsrc.tgac.miso.core.data.type.ThresholdType) Gauge(io.prometheus.client.Gauge) Map(java.util.Map) RestException(uk.ac.bbsrc.tgac.miso.webapp.controller.rest.RestException) uk.ac.bbsrc.tgac.miso.dto(uk.ac.bbsrc.tgac.miso.dto) SubmissionActionType(uk.ac.bbsrc.tgac.miso.core.data.type.SubmissionActionType) Collection(java.util.Collection) Resource(javax.annotation.Resource) Set(java.util.Set) Collectors(java.util.stream.Collectors) IndexChecker(uk.ac.bbsrc.tgac.miso.core.util.IndexChecker) Executors(java.util.concurrent.Executors) RunLibrarySpreadsheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.RunLibrarySpreadsheets) ConsentLevel(uk.ac.bbsrc.tgac.miso.core.data.type.ConsentLevel) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) List(java.util.List) StrStatus(uk.ac.bbsrc.tgac.miso.core.data.type.StrStatus) DilutionFactor(uk.ac.bbsrc.tgac.miso.core.data.type.DilutionFactor) LibrarySpreadSheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.LibrarySpreadSheets) Driver(uk.ac.bbsrc.tgac.miso.core.service.printing.Driver) IlluminaChemistry(uk.ac.bbsrc.tgac.miso.core.data.IlluminaChemistry) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) PartitionSpreadsheets(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.PartitionSpreadsheets) MetricCategory(uk.ac.bbsrc.tgac.miso.core.data.type.MetricCategory) SampleValidRelationship(uk.ac.bbsrc.tgac.miso.core.data.SampleValidRelationship) DonorSex(uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity.DonorSex) HealthType(uk.ac.bbsrc.tgac.miso.core.data.type.HealthType) Scheduled(org.springframework.scheduling.annotation.Scheduled) Controller(org.springframework.stereotype.Controller) InstrumentDataManglingPolicy(uk.ac.bbsrc.tgac.miso.core.data.InstrumentDataManglingPolicy) Function(java.util.function.Function) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Value(org.springframework.beans.factory.annotation.Value) Version(uk.ac.bbsrc.tgac.miso.Version) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) GetMapping(org.springframework.web.bind.annotation.GetMapping) VolumeUnit(uk.ac.bbsrc.tgac.miso.core.data.VolumeUnit) IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) ConcentrationUnit(uk.ac.bbsrc.tgac.miso.core.data.ConcentrationUnit) HttpServletResponse(javax.servlet.http.HttpServletResponse) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) uk.ac.bbsrc.tgac.miso.core.service(uk.ac.bbsrc.tgac.miso.core.service) TimeUnit(java.util.concurrent.TimeUnit) SampleType(uk.ac.bbsrc.tgac.miso.core.data.SampleType) WorkflowName(uk.ac.bbsrc.tgac.miso.core.data.workflow.Workflow.WorkflowName) SpreadSheetFormat(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.SpreadSheetFormat) PrintableField(uk.ac.bbsrc.tgac.miso.core.service.printing.PrintableField) QcTarget(uk.ac.bbsrc.tgac.miso.core.data.qc.QcTarget) PlatformType(uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType) ServletContext(javax.servlet.ServletContext) ResponseEntity(org.springframework.http.ResponseEntity) IlluminaExperiment(uk.ac.bbsrc.tgac.miso.core.util.IlluminaExperiment) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) IlluminaChemistry(uk.ac.bbsrc.tgac.miso.core.data.IlluminaChemistry) SubmissionActionType(uk.ac.bbsrc.tgac.miso.core.data.type.SubmissionActionType) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConsentLevel(uk.ac.bbsrc.tgac.miso.core.data.type.ConsentLevel) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SampleSheet(uk.ac.bbsrc.tgac.miso.core.util.SampleSheet) RestException(uk.ac.bbsrc.tgac.miso.webapp.controller.rest.RestException) PrintableField(uk.ac.bbsrc.tgac.miso.core.service.printing.PrintableField) IOException(java.io.IOException) SampleValidRelationship(uk.ac.bbsrc.tgac.miso.core.data.SampleValidRelationship) IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) PlatformType(uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType) SampleType(uk.ac.bbsrc.tgac.miso.core.data.SampleType)

Example 8 with IndexFamily

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

the class Dtos method to.

public static LibraryTemplate to(@Nonnull LibraryTemplateDto from) {
    LibraryTemplate to = null;
    if (from instanceof DetailedLibraryTemplateDto) {
        to = toDetailedLibraryTemplate((DetailedLibraryTemplateDto) from);
    } else {
        to = new LibraryTemplate();
    }
    if (from.getId() != null)
        to.setId(from.getId());
    to.setAlias(from.getAlias());
    setObject(to::setPlatformType, from.getPlatformType(), PlatformType::valueOf);
    setBigDecimal(to::setDefaultVolume, from.getDefaultVolume());
    setObject(to::setVolumeUnits, from.getVolumeUnits(), VolumeUnit::valueOf);
    if (from.getProjectIds() != null) {
        List<Project> projects = new ArrayList<>();
        from.getProjectIds().stream().forEach(id -> {
            Project project = new ProjectImpl();
            project.setId(id);
            projects.add(project);
        });
        to.getProjects().addAll(projects);
    }
    if (from.getLibraryTypeId() != null) {
        LibraryType libraryType = new LibraryType();
        libraryType.setId(from.getLibraryTypeId());
        to.setLibraryType(libraryType);
    }
    setObject(to::setLibrarySelectionType, LibrarySelectionType::new, from.getSelectionId());
    if (from.getStrategyId() != null) {
        LibraryStrategyType libraryStrategyType = new LibraryStrategyType();
        libraryStrategyType.setId(from.getStrategyId());
        to.setLibraryStrategyType(libraryStrategyType);
    }
    if (from.getKitDescriptorId() != null) {
        KitDescriptor kitDescriptor = new KitDescriptor();
        kitDescriptor.setId(from.getKitDescriptorId());
        to.setKitDescriptor(kitDescriptor);
    }
    if (from.getIndexFamilyId() != null) {
        IndexFamily indexFamily = new IndexFamily();
        indexFamily.setId(from.getIndexFamilyId());
        to.setIndexFamily(indexFamily);
    }
    if (from.getIndexOneIds() != null) {
        to.getIndexOnes().putAll(from.getIndexOneIds().entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> {
            Index index = new Index();
            index.setId(entry.getValue());
            return index;
        })));
    }
    if (from.getIndexTwoIds() != null) {
        to.getIndexTwos().putAll(from.getIndexTwoIds().entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> {
            Index index = new Index();
            index.setId(entry.getValue());
            return index;
        })));
    }
    return to;
}
Also used : LibraryStrategyType(uk.ac.bbsrc.tgac.miso.core.data.type.LibraryStrategyType) SampleNumberPerProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleNumberPerProjectImpl) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) LibrarySelectionType(uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType) LibraryType(uk.ac.bbsrc.tgac.miso.core.data.type.LibraryType) ArrayList(java.util.ArrayList) Index(uk.ac.bbsrc.tgac.miso.core.data.Index) SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) VolumeUnit(uk.ac.bbsrc.tgac.miso.core.data.VolumeUnit) 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) LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate) DetailedLibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate) PlatformType(uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType)

Example 9 with IndexFamily

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

the class Dtos method to.

public static Index to(@Nonnull IndexDto from) {
    Index to = new Index();
    setObject(to::setFamily, IndexFamily::new, maybeGetProperty(from.getFamily(), IndexFamilyDto::getId));
    setLong(to::setId, from.getId(), false);
    setString(to::setName, from.getName());
    setString(to::setSequence, from.getSequence());
    setInteger(to::setPosition, from.getPosition(), false);
    to.setRealSequences(from.getRealSequences());
    return to;
}
Also used : IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) Index(uk.ac.bbsrc.tgac.miso.core.data.Index) 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)

Example 10 with IndexFamily

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

the class Dtos method asDto.

public static LibraryDto asDto(@Nonnull Library from, boolean includeBoxPositions) {
    LibraryDto dto = null;
    if (isDetailedLibrary(from)) {
        dto = asDetailedLibraryDto((DetailedLibrary) from);
    } else {
        dto = new LibraryDto();
    }
    dto.setAlias(from.getAlias());
    dto.setName(from.getName());
    dto.setParentSampleId(from.getSample().getId());
    setString(dto::setParentSampleName, maybeGetProperty(from.getSample(), Sample::getName));
    dto.setParentSampleAlias(from.getSample().getAlias());
    dto.setProjectId(from.getSample().getProject().getId());
    if (from.getSample() instanceof DetailedSample) {
        dto.setParentSampleClassId(((DetailedSample) from.getSample()).getSampleClass().getId());
    }
    dto.setCreationDate(formatDate(from.getCreationDate()));
    dto.setDescription(from.getDescription());
    dto.setId(from.getId());
    setString(dto::setConcentration, from.getConcentration());
    dto.setConcentrationUnits(from.getConcentrationUnits());
    if (from.getLibrarySelectionType() != null) {
        dto.setLibrarySelectionTypeId(from.getLibrarySelectionType().getId());
    }
    if (from.getLibraryStrategyType() != null) {
        dto.setLibraryStrategyTypeId(from.getLibraryStrategyType().getId());
    }
    if (from.getLibraryType() != null) {
        dto.setLibraryTypeId(from.getLibraryType().getId());
        dto.setLibraryTypeAlias(from.getLibraryType().getDescription());
    }
    setId(dto::setDetailedQcStatusId, from.getDetailedQcStatus());
    setString(dto::setDetailedQcStatusNote, from.getDetailedQcStatusNote());
    setString(dto::setQcUserName, maybeGetProperty(from.getQcUser(), User::getFullName));
    setDateString(dto::setQcDate, from.getQcDate());
    dto.setLowQuality(from.isLowQuality());
    dto.setPaired(from.getPaired());
    if (from.getPlatformType() != null) {
        dto.setPlatformType(from.getPlatformType().getKey());
    }
    dto.setLastModified(formatDateTime(from.getLastModified()));
    if (from.getKitDescriptor() != null) {
        dto.setKitDescriptorId(from.getKitDescriptor().getId());
    }
    setString(dto::setKitLot, from.getKitLot());
    if (from.getIndex1() != null) {
        IndexFamily family = from.getIndex1().getFamily();
        dto.setIndexFamilyId(family.getId());
        dto.setIndexFamilyName(family.getName());
        dto.setIndex1Id(from.getIndex1().getId());
        dto.setIndex1Label(from.getIndex1().getLabel());
        if (from.getIndex2() != null) {
            dto.setIndex2Id(from.getIndex2().getId());
            dto.setIndex2Label(from.getIndex2().getLabel());
        }
    }
    setString(dto::setInitialVolume, from.getInitialVolume());
    setString(dto::setVolume, from.getVolume());
    dto.setVolumeUnits(from.getVolumeUnits());
    setString(dto::setVolumeUsed, from.getVolumeUsed());
    setString(dto::setNgUsed, from.getNgUsed());
    dto.setDnaSize(from.getDnaSize());
    dto.setIdentificationBarcode(from.getIdentificationBarcode());
    if (from.getQCs() != null && !from.getQCs().isEmpty()) {
        dto.setQcs(asQcDtos(from.getQCs()));
    }
    dto.setLocationBarcode(from.getLocationBarcode());
    dto.setLocationLabel(BoxUtils.makeLocationLabel(from));
    if (from.getBox() != null) {
        dto.setBox(asDto(from.getBox(), includeBoxPositions));
        dto.setBoxPosition(from.getBoxPosition());
    }
    dto.setDiscarded(from.isDiscarded());
    if (from.getSample().getBox() != null) {
        dto.setSampleBoxPosition(from.getSample().getBoxPosition());
        dto.setSampleBoxPositionLabel(BoxUtils.makeBoxPositionLabel(from.getSample().getBox().getAlias(), from.getSample().getBoxPosition()));
    }
    setId(dto::setSpikeInId, from.getSpikeIn());
    setString(dto::setSpikeInVolume, from.getSpikeInVolume());
    setString(dto::setSpikeInDilutionFactor, maybeGetProperty(from.getSpikeInDilutionFactor(), DilutionFactor::getLabel));
    setBoolean(dto::setUmis, from.getUmis(), false);
    setId(dto::setWorkstationId, from.getWorkstation());
    setId(dto::setThermalCyclerId, from.getThermalCycler());
    setId(dto::setSopId, from.getSop());
    setString(dto::setBatchId, from.getBatchId());
    setEffectiveQcFailure(from, dto);
    Requisition requisition = from.getSample().getRequisition();
    if (requisition == null) {
        requisition = getParentRequisition(from.getSample());
    }
    setId(dto::setRequisitionId, requisition);
    setString(dto::setRequisitionAlias, maybeGetProperty(requisition, Requisition::getAlias));
    return dto;
}
Also used : IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) Requisition(uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition)

Aggregations

IndexFamily (uk.ac.bbsrc.tgac.miso.core.data.IndexFamily)16 Test (org.junit.Test)7 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)7 Index (uk.ac.bbsrc.tgac.miso.core.data.Index)7 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)3 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)3 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)3 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)3 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)3 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)3 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)3 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)3 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)3 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)3 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)3 RunPositionDto (uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto)3 SolidRunDto (uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 VolumeUnit (uk.ac.bbsrc.tgac.miso.core.data.VolumeUnit)2 PlatformType (uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType)2