示例#1
0
        public SuperToolTip ToolTipFor(TransporterExpressionParameterDTO containerDTO)
        {
            var transportDirection = containerDTO.TransportDirection.Id;

            if (transportDirection == TransportDirectionId.None)
            {
                return(null);
            }

            var path = new List <string>();

            if (!string.IsNullOrEmpty(containerDTO.ContainerName))
            {
                path.Add(containerDTO.ContainerName);
            }

            if (!string.IsNullOrEmpty(containerDTO.CompartmentName))
            {
                path.Add(containerDTO.CompartmentName);
            }

            var containerDisplay = path.ToString(" - ");
            var info             = _representationInfoRepository.InfoFor(RepresentationObjectType.TRANSPORT_DIRECTION, transportDirection.ToString());

            return(CreateToolTip(info.Description, containerDisplay, ApplicationIcons.IconByName(info.IconName)));
        }
示例#2
0
        private ExpressionContainerDTO expressionContainerFor(IParameter relativeExpression, IParameter relativeExpressioNorm)
        {
            var expressionContainerDTO = new ExpressionContainerDTO();
            var moleculeName           = relativeExpression.ParentContainer.Name;
            var simulation             = _executionContext.Get <Simulation>(relativeExpression.Origin.SimulationId);
            var molecule      = simulation.Individual?.MoleculeByName <IndividualMolecule>(moleculeName);
            var isTransporter = moleculeIsTransporter(molecule);

            expressionContainerDTO.RelativeExpressionParameter     = _containerParameterMapper.MapFrom(relativeExpression, expressionContainerDTO, x => x.RelativeExpression, x => x.RelativeExpressionParameter);
            expressionContainerDTO.RelativeExpressionNormParameter = _containerParameterMapper.MapFrom(relativeExpressioNorm, expressionContainerDTO, x => x.RelativeExpressionNorm, x => x.RelativeExpressionNormParameter);

            IGroup group;

            if (parameterIsGlobalExpression(relativeExpression))
            {
                if (isTransporter)
                {
                    return(null);
                }

                group = _groupRepository.GroupByName(CoreConstants.Groups.VASCULAR_SYSTEM);
                expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, containerNameForGlobalExpression(relativeExpression.Name)).ToPathElement();
                expressionContainerDTO.Sequence         = relativeExpression.Sequence;
            }
            else if (expressionShouldBeTreatedAsGlobal(relativeExpression, isTransporter))
            {
                return(null);
            }
            else if (relativeExpression.HasAncestorNamed(CoreConstants.Organ.Lumen))
            {
                group = _groupRepository.GroupByName(CoreConstants.Groups.GI_LUMEN);
                expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(relativeExpression.ParentContainer.ParentContainer).ToPathElement();
            }
            else if (relativeExpression.HasAncestorNamed(CoreConstants.Compartment.Mucosa))
            {
                group = _groupRepository.GroupByName(CoreConstants.Groups.GI_MUCOSA);
                //Mucosa rel exp are for instance in Mucosa/Duodnum/interstitial
                expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(relativeExpression.ParentContainer.ParentContainer.ParentContainer).ToPathElement();
            }

            else
            {
                var expressionContainer = expressionContainerFor(relativeExpression);
                group = _groupRepository.GroupByName(isGiTractOrgan(expressionContainer) ? CoreConstants.Groups.GI_NON_MUCOSA_TISSUE : CoreConstants.Groups.ORGANS_AND_TISSUES);
                expressionContainerDTO.ContainerPathDTO = _representationInfoRepository.InfoFor(expressionContainer).ToPathElement();
            }

            expressionContainerDTO.GroupingPathDTO = _representationInfoRepository.InfoFor(RepresentationObjectType.GROUP, group.Name).ToPathElement();

            //May have been set previously
            if (expressionContainerDTO.Sequence == 0)
            {
                expressionContainerDTO.Sequence = group.Sequence;
            }

            expressionContainerDTO.MoleculeName  = moleculeName;
            expressionContainerDTO.ParameterPath = _fullPathDisplayResolver.FullPathFor(relativeExpression);
            return(expressionContainerDTO);
        }
 protected override PathElement CreatePathElement(IContainer container)
 {
    var pathElementDTO = base.CreatePathElement(container);
    var representationInfo = _representationInfoRepository.InfoFor(container);
    representationInfo.UpdatePathElement(pathElementDTO);
    return pathElementDTO;
 }
示例#4
0
        private void updateDisplayInfo(Gender gender)
        {
            var representationInfo = _representationInfoRepository.InfoFor(gender);

            gender.Description = representationInfo.Description;
            gender.DisplayName = representationInfo.DisplayName;
        }
示例#5
0
        private void updateDisplayInfo(SpeciesPopulation speciesPopulation)
        {
            var representationInfo = _representationInfoRepository.InfoFor(speciesPopulation);

            speciesPopulation.Description = representationInfo.Description;
            speciesPopulation.DisplayName = representationInfo.DisplayName;
        }
        public override void Report(Formulation formulation, MarkdownTracker tracker, int indentationLevel)
        {
            base.Report(formulation, tracker, indentationLevel);
            var formulationInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, formulation.FormulationType);

            tracker.AddValue(PKSimConstants.UI.Type, formulationInfo.DisplayName);
            ReportParametersIn(formulation, tracker, indentationLevel);
        }
        private CompoundParameterSelectionDTO parameterSelectionFrom(ParameterAlternativeGroup compoundParameterGroup, ParameterAlternative parameterAlternative)
        {
            var compoundParameterSelectionDTO = new CompoundParameterSelectionDTO(compoundParameterGroup);

            compoundParameterSelectionDTO.ParameterName       = _representationInfoRepository.InfoFor(compoundParameterGroup).DisplayName;
            compoundParameterSelectionDTO.SelectedAlternative = parameterAlternative;
            return(compoundParameterSelectionDTO);
        }
        public void UpdateProperties(ExpressionContainerDTO expressionDTO, MoleculeExpressionContainer expressionContainer)
        {
            var group         = _groupRepository.GroupByName(expressionContainer.GroupName);
            var groupInfo     = _representationInfoRepository.InfoFor(RepresentationObjectType.GROUP, expressionContainer.GroupName);
            var containerInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, expressionContainer.ContainerName);

            expressionDTO.GroupingPathDTO             = groupInfo.ToPathElement();
            expressionDTO.ContainerPathDTO            = containerInfo.ToPathElement();
            expressionDTO.Sequence                    = group.Sequence;
            expressionDTO.RelativeExpressionParameter =
                _parameterMapper.MapFrom(expressionContainer.RelativeExpressionParameter, expressionDTO,
                                         x => x.RelativeExpression, x => x.RelativeExpressionParameter);

            expressionDTO.RelativeExpressionNormParameter =
                _parameterMapper.MapFrom(expressionContainer.RelativeExpressionNormParameter, expressionDTO,
                                         x => x.RelativeExpressionNorm, x => x.RelativeExpressionNormParameter);
        }
 public IEnumerable <FormulationTypeDTO> AllFormulationTypes()
 {
     return(from formulation in _formulationRepository.AllFor(ApplicationRoute)
            where formulation.Name != CoreConstants.Formulation.EmptyFormulation
            let formulationInfo = _representationInfoRepository.InfoFor(formulation)
                                  select new FormulationTypeDTO {
         Id = formulation.FormulationType, DisplayName = formulationInfo.DisplayName
     });
 }
        public override void EditCompound(Compound compound)
        {
            _parameter = compound.Parameter(CoreConstants.Parameter.IS_SMALL_MOLECULE);
            var info            = _representationInfoRepository.InfoFor(_parameter);
            var isSmallMolecule = new IsSmallMoleculeDTO {
                Value = _parameter.Value == 1, Description = info.Description, Display = info.DisplayName
            };

            _view.BindTo(isSmallMolecule);
        }
示例#11
0
        public SuperToolTip ToolTipFor(CategoryCategoryItemDTO categoryCategoryItemDTO)
        {
            var repInfo = _representationInfoRepository.InfoFor(categoryCategoryItemDTO.CategoryItem);
            var toolTip = CreateToolTip(categoryCategoryItemDTO.Description, categoryCategoryItemDTO.DisplayName);

            toolTip.Items.AddSeparator();
            toolTip.WithTitle(repInfo.DisplayName);
            toolTip.WithText(repInfo.Description);
            return(toolTip);
        }
示例#12
0
        public void EditEvent(PKSimEvent pkSimEvent)
        {
            var template = _eventGroupRepository.FindByName(pkSimEvent.TemplateName);

            _eventDTO = new EventDTO {
                Description = _representationInfoRepository.InfoFor(template).Description, Template = template
            };

            _eventParametersPresenter.EditParameters(pkSimEvent.AllParameters(p => !p.IsNamed(Constants.Parameters.START_TIME)));
            _view.BindTo(_eventDTO);
        }
        private TProcess createProcessBaseOn <TProcess>(FlatProcess flatProcess) where TProcess : CompoundProcess
        {
            var newProcess = _entityBaseFactory.Create <TProcess>();
            var repInfo    = _representationInfoRepository.InfoFor(RepresentationObjectType.PROCESS, flatProcess.Name);

            newProcess.Name         = flatProcess.Name;
            newProcess.InternalName = flatProcess.Name;
            newProcess.Description  = repInfo.Description;
            newProcess.Icon         = repInfo.IconName;
            setDefaultSpeciesForProcess(newProcess as ISpeciesDependentCompoundProcess);
            return(newProcess);
        }
示例#14
0
        public CategoryCalculationMethodDTO MapFrom(CalculationMethod calculationMethod)
        {
            var repInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.CATEGORY, calculationMethod.Category);

            return(new CategoryCalculationMethodDTO
            {
                DisplayName = repInfo.DisplayName,
                Description = repInfo.Description,
                Category = calculationMethod.Category,
                CalculationMethod = calculationMethod
            });
        }
示例#15
0
        public CategoryParameterValueVersionDTO MapFrom(ParameterValueVersion parameterValueVersion)
        {
            var repInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.CATEGORY, parameterValueVersion.Category);

            return(new CategoryParameterValueVersionDTO
            {
                DisplayName = repInfo.DisplayName,
                Description = repInfo.Description,
                Category = parameterValueVersion.Category,
                ParameterValueVersion = parameterValueVersion
            });
        }
示例#16
0
        public FormulationDTO MapFrom(Formulation formulation)
        {
            var formulationInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, formulation.FormulationType);

            return(new FormulationDTO(formulation.AllParameters().ToList())
            {
                Description = formulationInfo.Description,
                Type = new FormulationTypeDTO {
                    Id = formulation.FormulationType, DisplayName = formulationInfo.DisplayName
                },
            });
        }
示例#17
0
        public void Visit(IObjectBase objToVisit)
        {
            if (!_representationInfoRepository.ContainsInfoFor(objToVisit))
            {
                return;
            }

            var repInfo = _representationInfoRepository.InfoFor(objToVisit);

            objToVisit.Icon = repInfo.IconName;

            if (string.IsNullOrEmpty(objToVisit.Description))
            {
                objToVisit.Description = repInfo.Description;
            }
        }
示例#18
0
        private void updateParameterDTOFromParameter(ParameterDTO parameterDTO, IParameter parameter)
        {
            var parameterPath      = _entityPathResolver.ObjectPathFor(parameter);
            var representationInfo = _representationInfoRepository.InfoFor(parameter);

            parameterDTO.DisplayName  = representationInfo.DisplayName;
            parameterDTO.Description  = representationInfo.Description;
            parameterDTO.AllUnits     = allUnitsFor(parameter);
            parameterDTO.FormulaType  = _formulaTypeMapper.MapFrom(parameter.Formula);
            parameterDTO.IsFavorite   = _favoriteRepository.Contains(parameterPath);
            parameterDTO.Sequence     = parameter.Sequence;
            parameterDTO.PathElements = _parameterDisplayPathMapper.MapFrom(parameter);

            //now create special list of values for parameter for our discrete parameters
            updateListOfValues(parameterDTO, parameter);
        }
        public DataTable MapFrom(GlobalPKAnalysis globalPKAnalysis, bool addMetaData = false)
        {
            var dataTable = new DataTable(PKSimConstants.UI.GlobalPKAnalyses);

            dataTable.AddColumn(PKSimConstants.PKAnalysis.ParameterDisplayName);
            dataTable.AddColumn(PKSimConstants.PKAnalysis.Compound);
            dataTable.AddColumn <double>(PKSimConstants.PKAnalysis.Value);
            dataTable.AddColumn(PKSimConstants.PKAnalysis.Unit);

            if (addMetaData)
            {
                dataTable.AddColumn(PKSimConstants.PKAnalysis.ParameterName);
                dataTable.AddColumn(PKSimConstants.PKAnalysis.Description);
                dataTable.AddColumn(PKSimConstants.PKAnalysis.Warning);
            }

            foreach (var parameterName in globalPKAnalysis.AllPKParameterNames)
            {
                foreach (var compoundName in globalPKAnalysis.CompoundNames)
                {
                    var parameter = globalPKAnalysis.PKParameter(compoundName, parameterName);
                    if (parameter == null)
                    {
                        continue;
                    }

                    var info = _representationInfoRepository.InfoFor(parameter);
                    var row  = dataTable.NewRow();

                    row[PKSimConstants.PKAnalysis.ParameterDisplayName] = info.DisplayName;
                    row[PKSimConstants.PKAnalysis.Compound]             = compoundName;
                    row[PKSimConstants.PKAnalysis.Value] = parameter.ValueInDisplayUnit;
                    row[PKSimConstants.PKAnalysis.Unit]  = parameter.DisplayUnit;

                    if (addMetaData)
                    {
                        row[PKSimConstants.PKAnalysis.ParameterName] = parameter.Name;
                        row[PKSimConstants.PKAnalysis.Warning]       = parameter.Validate().Message;
                        row[PKSimConstants.PKAnalysis.Description]   = info.Description;
                    }

                    dataTable.Rows.Add(row);
                }
            }

            return(dataTable);
        }
        private void addInfoToCategory(MetaDataCategory metaDataCategory, IObjectBase objectBase)
        {
            var info = _representationInfoRepository.InfoFor(objectBase);

            if (info == null)
            {
                metaDataCategory.ListOfValues.Add(objectBase.Name, objectBase.Name);
                return;
            }
            //only add with display name as information will be used in data repository as is
            metaDataCategory.ListOfValues.Add(info.DisplayName, info.DisplayName);
            var icon = ApplicationIcons.IconByName(info.IconName);

            if (icon != ApplicationIcons.EmptyIcon)
            {
                metaDataCategory.ListOfImages.Add(info.DisplayName, icon);
            }
        }
示例#21
0
        public void EditParameters(IEnumerable <IParameter> parameters)
        {
            base.Edit(parameters);
            AllParametersDTO.Clear();
            foreach (var parameter in _visibleParameters)
            {
                var parameterDTO = _mapper.MapFrom(parameter).DowncastTo <ParameterDTO>();

                var groupInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.GROUP, parameter.GroupName);
                parameterDTO.PathElements[0] = groupInfo.ToPathElement();
                AllParametersDTO.Add(parameterDTO);
            }

            var allGrouping = AllParametersDTO.Select(x => x.PathElements[0].DisplayName).Distinct();

            _view.GroupingVisible = (allGrouping.Count() > 1);
            _view.BindTo(AllParametersDTO);
        }
示例#22
0
        protected override void Context()
        {
            _parameterGroupTask           = A.Fake <IParameterGroupTask>();
            _representationInfoRepository = A.Fake <IRepresentationInfoRepository>();
            _treeNodeCreator         = A.Fake <IParameterGroupNodeCreator>();
            _fullPathDisplayResolver = A.Fake <IFullPathDisplayResolver>();
            _toolTipPartCreator      = A.Fake <IToolTipPartCreator>();
            _treeNodeFactory         = new TreeNodeFactoryForSpecs();

            A.CallTo(() => _representationInfoRepository.InfoFor(A <IObjectBase> ._))
            .ReturnsLazily(x => new RepresentationInfo {
                DisplayName = x.GetArgument <IObjectBase>(0).Name
            });

            A.CallTo(() => _representationInfoRepository.DisplayNameFor(A <IObjectBase> ._))
            .ReturnsLazily(x => x.GetArgument <IObjectBase>(0).Name);

            _pathElementsMapper = new PKSimPathToPathElementsMapper(_representationInfoRepository, new EntityPathResolverForSpecs());

            sut = new PopulationGroupNodeCreator(_treeNodeCreator, _parameterGroupTask, _treeNodeFactory, _fullPathDisplayResolver, _toolTipPartCreator, _pathElementsMapper);

            _para1         = new PKSimParameter().WithId("P1").WithName("P1");
            _para2         = new PKSimParameter().WithId("P2").WithName("P2");
            _allParameters = new List <IParameter> {
                _para1, _para2
            };
            _rootGroup = new Group {
                Name = "group1"
            };
            _subGroup = new Group {
                Name = "subGroup"
            };
            _subGroupNode = new GroupNode(_subGroup);
            _rootNode     = new GroupNode(_rootGroup);
            _rootNode.AddChild(_subGroupNode);
            A.CallTo(() => _treeNodeCreator.MapForPopulationFrom(_rootGroup, _allParameters)).Returns(_rootNode);
            A.CallTo(() => _parameterGroupTask.ParametersIn(_subGroup, _allParameters)).Returns(_allParameters);
            A.CallTo(() => _parameterGroupTask.ParametersIn(_rootGroup, _allParameters)).Returns(new List <IParameter>());
            _liver  = new Container().WithName("Liver").WithId("Liver");
            _kidney = new Container().WithName("Kidney").WithId("Kidney");
        }
        private ITreeNode createNodeForContainer(IContainer container)
        {
            var representationInfo = _representationInfoRepository.InfoFor(container);
            var node = _treeNodeFactory.CreateFor(container, representationInfo);

            var moleculeAmount = container as IMoleculeAmount;

            if (moleculeAmount != null)
            {
                node.Icon = ApplicationIcons.IconByName(moleculeAmount.QuantityType.ToString());
            }

            var reaction = container as IReaction;

            if (reaction != null)
            {
                node.Icon = ApplicationIcons.Reaction;
            }

            return(node);
        }
        protected override void Context()
        {
            _representationInfoRepository = A.Fake <IRepresentationInfoRepository>();
            sut = new GlobalPKAnalysisToDataTableMapper(_representationInfoRepository);

            _globalPKAnalysis = new GlobalPKAnalysis();
            _compound1        = new Container().WithName("Drug");
            _compound2        = new Container().WithName("Inhibitor");
            _globalPKAnalysis.Add(_compound1);
            _globalPKAnalysis.Add(_compound2);

            _compound1.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P1"));
            _compound1.Add(DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("P2"));
            _compound2.Add(DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("P1"));
            _compound2.Add(DomainHelperForSpecs.ConstantParameterWithValue(4).WithName("P3"));

            A.CallTo(() => _representationInfoRepository.InfoFor(A <IParameter> ._))
            .ReturnsLazily(x => new RepresentationInfo {
                DisplayName = "Display for " + x.GetArgument <IParameter>(0).Name
            });
        }
        public IPKSimProcess MapFrom(FlatProcess flatProcess)
        {
            var activeProcess = createProcessFrom(flatProcess);

            if (activeProcess == null)
            {
                return(null);
            }

            activeProcess.Name = flatProcess.Name;
            activeProcess.CalculationMethod = flatProcess.CalculationMethod;
            activeProcess.Rate    = flatProcess.Rate;
            activeProcess.Formula = _formulaFactory.RateFor(activeProcess.CalculationMethod, activeProcess.Rate, new FormulaCache());
            var repInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.PROCESS, activeProcess.Name);

            activeProcess.Icon = repInfo.IconName;
            updateTransporterDescriptors(activeProcess as PKSimTransport);
            activeProcess.CreateProcessRateParameter = flatProcess.CreateProcessRateParameter;
            activeProcess.Dimension = activeProcess.Formula.Dimension;
            return(activeProcess);
        }
 public string IconFor(TissueLocation tissueLocation)
 {
     return(_representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, tissueLocation.ToString()).IconName);
 }
 public void should_have_updated_the_description_of_the_auc_ratio()
 {
     _representationInfoRepository.InfoFor(RepresentationObjectType.PARAMETER, CoreConstants.PKAnalysis.AUCRatio).Description.Contains("AUC_inf_tDLast").ShouldBeTrue();
 }
示例#28
0
 public string DisplayFor(ModelConfiguration modelConfiguration)
 {
     return(_representationInfoRepository.InfoFor(RepresentationObjectType.MODEL, modelConfiguration.ModelName).DisplayName);
 }
示例#29
0
        private ITreeNode nodeFor <T>(T entity) where T : class, IEntity
        {
            var representationInfo = _representationInfoRepository.InfoFor(entity);

            return(_treeNodeFactory.CreateFor(entity, representationInfo));
        }