示例#1
0
        protected override void Context()
        {
            _view = A.Fake <IAdvancedParameterDistributionView>();
            _representationInfoRepository      = A.Fake <IRepresentationInfoRepository>();
            _entityPathResolver                = A.Fake <IEntityPathResolver>();
            _parametersPresenter               = A.Fake <IPopulationParameterGroupsPresenter>();
            _popParameterDistributionPresenter = A.Fake <IPopulationDistributionPresenter>();
            _population             = A.Fake <Population>();
            _projectChangedNotifier = A.Fake <IProjectChangedNotifier>();

            _gender1 = A.Fake <Gender>().WithName("Gender1");
            _gender2 = A.Fake <Gender>().WithName("Gender2");
            A.CallTo(() => _population.AllGenders()).Returns(new[] { _gender1, _gender2 });
            A.CallTo(() => _representationInfoRepository.DisplayNameFor(_gender1)).Returns("Display1");
            A.CallTo(() => _representationInfoRepository.DisplayNameFor(_gender2)).Returns("Display2");


            _allParameters      = new List <IParameter>();
            _allParametersCache = new PathCacheForSpecs <IParameter>();
            A.CallTo(() => _population.AllVectorialParameters(_entityPathResolver)).Returns(_allParameters);
            A.CallTo(() => _population.AllParameters(_entityPathResolver)).Returns(_allParametersCache);
            A.CallTo(() => _popParameterDistributionPresenter.Plot(_population, A <IParameter> ._, A <DistributionSettings> ._, A <IDimension> ._, A <Unit> ._))
            .Invokes(x => _settings = x.GetArgument <DistributionSettings>(2));


            sut = new PopulationAdvancedParameterDistributionPresenter(_view, _parametersPresenter,
                                                                       _representationInfoRepository, _entityPathResolver, _popParameterDistributionPresenter, _projectChangedNotifier);
        }
        protected override void FillUpReport(IEnumerable <CalculationMethod> calculationMethods, ReportPart reportPart)
        {
            var calcMethodPart = new TablePart(keyName: PKSimConstants.UI.Category, valueName: PKSimConstants.UI.CalculationMethods)
            {
                Title = PKSimConstants.UI.CalculationMethods
            };

            foreach (var calculationMethod in calculationMethods)
            {
                var currentCalculationMethod = calculationMethod;
                var category = _calculationMethodCategoryRepository.FindBy(currentCalculationMethod.Category);
                var allCalculationMethods = category.AllItems().ToList();
                if (allCalculationMethods.Count == 1)
                {
                    continue;
                }

                //more than one cm in this category. Check that this is not only due to different models
                allCalculationMethods.Remove(calculationMethod);
                var allModelsUsedInCategory  = allCalculationMethods.SelectMany(x => x.AllModels).Distinct();
                var allSpeciesUsedInCategory = allCalculationMethods.SelectMany(x => x.AllSpecies).Distinct();

                //at least another category available in the model and species
                if (allModelsUsedInCategory.Any(x => currentCalculationMethod.AllModels.Contains(x)) &&
                    allSpeciesUsedInCategory.Any(x => currentCalculationMethod.AllSpecies.Contains(x)))
                {
                    calcMethodPart.AddIs(_representationInfoRepository.DisplayNameFor(category),
                                         _representationInfoRepository.DisplayNameFor(calculationMethod));
                }
            }

            reportPart.AddPart(calcMethodPart);
        }
示例#3
0
 protected override void Context()
 {
     _dimensionRepository          = A.Fake <IDimensionRepository>();
     _representationInfoRepository = A.Fake <IRepresentationInfoRepository>();
     _lazyLoadTask            = A.Fake <ILazyLoadTask>();
     _observedcurveDataMapper = A.Fake <IDataRepositoryToObservedCurveDataMapper>();
     _statisticalAnalysis     = new PopulationStatisticalAnalysis();
     _genderField             = ChartDataHelperForSpecs.CreateGenderField();
     _statisticalAnalysis.Add(_genderField);
     _statisticalAnalysis.Add(_outputFieldVenousBloodPlasma);
     _statisticalAnalysis.Add(_outputFieldLiverCell);
     _predefinedStatisticalAggregation = new PredefinedStatisticalAggregation {
         Selected = true
     };
     _percentileStatisticalAggregation = new PercentileStatisticalAggregation {
         Selected = false, Percentile = 50
     };
     _statisticalAnalysis.AddStatistic(_predefinedStatisticalAggregation);
     _statisticalAnalysis.AddStatistic(_percentileStatisticalAggregation);
     A.CallTo(() => _representationInfoRepository.DisplayNameFor(_predefinedStatisticalAggregation)).Returns(_singlecurveId);
     A.CallTo(() => _representationInfoRepository.DisplayNameFor(_percentileStatisticalAggregation)).Returns(_percentileId);
     _statisticalDataCalculator = new StatisticalDataCalculator();
     _pivotResultCreator        = A.Fake <IPivotResultCreator>();
     sut = new TimeProfileChartDataCreator(_dimensionRepository, _pivotResultCreator, _representationInfoRepository,
                                           _statisticalDataCalculator, _lazyLoadTask, _observedcurveDataMapper);
 }
        protected override void FillUpReport(Formulation formulation, ReportPart reportPart)
        {
            reportPart.Title = _infoRepository.DisplayNameFor(RepresentationObjectType.CONTAINER, formulation.FormulationType);
            string parameterTableCaption = PKSimConstants.UI.ParametersDefinedIn(formulation.Name);

            if (formulation.IsDissolved)
            {
                reportPart.AddToContent(PKSimConstants.UI.NoParameter);
                return;
            }

            TablePart tablePart;

            if (!formulation.IsParticleDissolution)
            {
                var parameterList = new ParameterList(parameterTableCaption, formulation.AllVisibleParameters());
                tablePart = parameterList.ToTable(_infoRepository);
            }
            else
            {
                var particleDisperseSystem      = formulation.Parameter(Constants.Parameters.PARTICLE_DISPERSE_SYSTEM);
                var particleDistribution        = formulation.Parameter(Constants.Parameters.PARTICLE_SIZE_DISTRIBUTION);
                var displayParticleDistribution = _infoRepository.DisplayNameFor(particleDistribution);
                tablePart = new TablePart(PKSimConstants.UI.Parameter)
                {
                    Caption = parameterTableCaption
                };

                if (particleDisperseSystem.Value == CoreConstants.Parameters.MONODISPERSE)
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Monodisperse);
                    tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                }
                else
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Polydisperse);
                    if (particleDistribution.Value == CoreConstants.Parameters.PARTICLE_SIZE_DISTRIBUTION_NORMAL)
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.Normal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_STD_DEVIATION), _infoRepository);
                    }
                    else
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.LogNormal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_DISTRIBUTION_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_VARIATION_COEFF), _infoRepository);
                    }
                }
            }

            tablePart.Title = reportPart.Title;
            reportPart.AddPart(tablePart);
        }
示例#5
0
        public ContinuousDistributionData CreateFor(IVectorialParametersContainer parameterContainer, DistributionSettings settings, IReadOnlyList <double> values, IDimension dimension, Unit displayUnit)
        {
            var allValuesInDisplayUnit = values.Select(value => dimension.BaseUnitValueToUnitValue(displayUnit, value)).ToList();
            var allGenders             = allGendersFrom(parameterContainer, allValuesInDisplayUnit.Count);
            var allValidValues         = allValuesInDisplayUnit.Where(x => !double.IsNaN(x)).ToList();

            var allIntervals = _binIntervalsCreator.CreateUniformIntervalsFor(allValidValues);

            var data = new ContinuousDistributionData(settings.AxisCountMode, allIntervals.Count);

            if (!allValidValues.Any())
            {
                return(data);
            }

            int allItemsForSelectedGender = numberOfItemsFor(allGenders, settings.SelectedGender);

            //group the values by gender
            var valueGenders = allValuesInDisplayUnit.Select((value, index) => new { Value = value, Gender = allGenders[index] })
                               .Where(x => !double.IsNaN(x.Value))
                               .GroupBy(x => x.Gender)
                               .ToList();


            foreach (var interval in allIntervals)
            {
                var currentInterval = interval;
                foreach (var valueGender in valueGenders)
                {
                    if (!shouldDisplayGender(valueGender.Key, settings.SelectedGender))
                    {
                        continue;
                    }

                    double count = valueGender.Count(item => currentInterval.Contains(item.Value));
                    if (settings.AxisCountMode == AxisCountMode.Percent)
                    {
                        count = count * 100.0 / allItemsForSelectedGender;
                    }

                    data.AddData(currentInterval.MeanValue, count, _representationInfoRepository.DisplayNameFor(valueGender.Key));
                }
            }

            data.XMinData = allValidValues.Min();
            data.XMaxData = allValidValues.Max();

            return(data);
        }
示例#6
0
 protected void SetProperties <TCompoundProcess>(TCompoundProcess compoundProcess, ProcessDTO <TCompoundProcess> compoundProcessDTO) where TCompoundProcess : CompoundProcess
 {
     compoundProcessDTO.Description            = compoundProcess.Description;
     compoundProcessDTO.Name                   = compoundProcess.Name;
     compoundProcessDTO.ProcessTypeDisplayName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.PROCESS, compoundProcess.InternalName);
     compoundProcessDTO.Species                = compoundProcess.Species;
 }
示例#7
0
        public string DisplayNameFor(string parameterName)
        {
            var parameter   = pkParameterNamed(parameterName);
            var displayName = _representationInfoRepository.DisplayNameFor(parameter);

            return(Constants.NameWithUnitFor(displayName, parameter.DisplayUnit));
        }
示例#8
0
        public override void Build(CompoundProperties compoundProperties, OSPSuiteTracker buildTracker)
        {
            var objectsToReport = new List <object>();
            var compoundConfig  = new TablePart(PKSimConstants.UI.Parameter, PKSimConstants.UI.AlternativeInCompound, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Caption = PKSimConstants.UI.CompoundConfiguration
            };

            compoundConfig.Types[PKSimConstants.UI.Value] = typeof(double);

            var compound = compoundProperties.Compound;

            foreach (var alternativeSelection in compoundProperties.CompoundGroupSelections)
            {
                var parameterName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, alternativeSelection.GroupName);
                var parameter     = getParameterForAlternative(compound, compoundProperties, alternativeSelection);
                compoundConfig.AddIs(parameterName, alternativeSelection.AlternativeName, ParameterMessages.DisplayValueFor(parameter, numericalDisplayOnly: true), ParameterMessages.DisplayUnitFor(parameter));
            }

            objectsToReport.Add(buildTracker.CreateRelativeStructureElement(PKSimConstants.UI.CompoundConfiguration, 2));
            objectsToReport.Add(compoundConfig);

            objectsToReport.Add(compoundProperties.AllCalculationMethods().Where(cm => cm.Category.IsOneOf(CoreConstants.Category.DistributionCellular, CoreConstants.Category.DistributionInterstitial, CoreConstants.Category.DiffusionIntCell)));

            _builderRepository.Report(objectsToReport, buildTracker);
        }
示例#9
0
        public override void Build(IParameter parameter, OSPSuiteTracker buildTracker)
        {
            var parameterDisplay = PKSimConstants.UI.ReportIs(_representationInfoRepository.DisplayNameFor(parameter), ParameterMessages.DisplayValueFor(parameter));

            _texBuilderRepository.Report(parameterDisplay, buildTracker);
            _texBuilderRepository.Report(new LineBreak(), buildTracker);
        }
 protected CompoundParameterGroupPresenter(TView view, IRepresentationInfoRepository representationInfoRepository, string groupName, bool needsCaption = true) : base(view)
 {
     if (needsCaption)
     {
         View.Caption = representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, groupName);
     }
 }
        protected override void InitializeResourcesFor(ParameterAlternativeGroup parameterAlternativeGroup)
        {
            var parameterGroupDisplayName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, parameterAlternativeGroup.Name);

            _view.Caption            = PKSimConstants.UI.CreateGroupParameterAlternativeCaption(parameterGroupDisplayName);
            _view.NameDescription    = PKSimConstants.UI.Name;
            _view.DescriptionVisible = false;
        }
示例#12
0
        public override void Report(PKSimEvent pkSimEvent, MarkdownTracker tracker, int indentationLevel)
        {
            base.Report(pkSimEvent, tracker, indentationLevel);
            var eventTemplate = _eventGroupRepository.FindByName(pkSimEvent.TemplateName);

            tracker.AddValue(PKSimConstants.UI.Type, _representationInfoRepository.DisplayNameFor(eventTemplate));
            ReportParametersIn(pkSimEvent, tracker, indentationLevel);
        }
示例#13
0
        private IEnumerable <object> basicPharmacochemistry(Compound compound)
        {
            var molWeight = _representationRepository.DisplayNameFor(RepresentationObjectType.PARAMETER, Constants.Parameters.MOL_WEIGHT);

            return(new List <object>
            {
                compound.Parameter(Constants.Parameters.IS_SMALL_MOLECULE),
                new SubSubSection(molWeight),
                new ParameterList(molWeight,
                                  compound.Parameter(Constants.Parameters.MOL_WEIGHT),
                                  compound.Parameter(CoreConstants.Parameters.EFFECTIVE_MOLECULAR_WEIGHT),
                                  compound.Parameter(Constants.Parameters.I),
                                  compound.Parameter(Constants.Parameters.F),
                                  compound.Parameter(Constants.Parameters.CL),
                                  compound.Parameter(Constants.Parameters.BR))
            });
        }
 protected CompoundParameterGroupWithAlternativePresenter(TView view, IRepresentationInfoRepository representationRepository, ICompoundAlternativeTask compoundAlternativeTask, IDialogCreator dialogCreator, string groupName)
     : base(view)
 {
     _dialogCreator           = dialogCreator;
     _compoundAlternativeTask = compoundAlternativeTask;
     _dialogCreator           = dialogCreator;
     _parameterGroupName      = groupName;
     View.Caption             = representationRepository.DisplayNameFor(RepresentationObjectType.GROUP, _parameterGroupName);
 }
        public override void Build(T process, OSPSuiteTracker buildTracker)
        {
            string processDisplay = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.PROCESS, process.InternalName);

            _builderRepository.Report(process.Name.AsFullLine(), buildTracker);
            _builderRepository.Report(this.ReportValue(PKSimConstants.UI.ProcessType, processDisplay), buildTracker);
            _builderRepository.Report(this.ReportDescription(process, buildTracker), buildTracker);
            _builderRepository.Report(tableParameterFor(process), buildTracker);
        }
示例#16
0
        public override void Build(TMolecule molecule, OSPSuiteTracker buildTracker)
        {
            var sb = new StringBuilder();

            sb.AppendLine(molecule.Name);
            sb.AddIs(_representationInfoRepository.DisplayNameFor(molecule.ReferenceConcentration), ParameterMessages.DisplayValueFor(molecule.ReferenceConcentration));
            sb.AddIs(_representationInfoRepository.DisplayNameFor(molecule.HalfLifeLiver), ParameterMessages.DisplayValueFor(molecule.HalfLifeLiver));
            sb.AddIs(_representationInfoRepository.DisplayNameFor(molecule.HalfLifeIntestine), ParameterMessages.DisplayValueFor(molecule.HalfLifeIntestine));
            sb.AddIs(PKSimConstants.UI.OntogenyVariabilityLike, molecule.Ontogeny.Name);

            _builderRepository.Report(sb, buildTracker);

            //specific part
            AddMoleculeSpecificReportPart(molecule, buildTracker);

            _builderRepository.Report(PKSimConstants.UI.NormalizedExpressionLevels, buildTracker);
            _builderRepository.Report(ExpressionLevelParameters(molecule), buildTracker);
        }
示例#17
0
        public override void Report(CalculationMethodCache calculationMethodCache, MarkdownTracker tracker, int indentationLevel = 0)
        {
            var calculationMethods = calculationMethodCache
                                     .Select(x => new
            {
                CalculationMethod = x,
                Category          = _calculationMethodCategoryRepository.FindBy(x.Category)
            })
                                     .Where(x => x.Category.AllItems().Count() > 1)
                                     .Select(x => new
            {
                Name  = _representationInfoRepository.DisplayNameFor(x.Category),
                Value = _representationInfoRepository.DisplayNameFor(x.CalculationMethod),
            }
                                             );


            tracker.Add(calculationMethods.ToMarkdownTable());
        }
        protected override ChartData <TimeProfileXValue, TimeProfileYValue> BuildChartsData()
        {
            var statisticalAnalysis = _analysis.DowncastTo <PopulationStatisticalAnalysis>();
            var paneFieldNames      = _analysis.StringFieldNamesOn(PivotArea.RowArea);
            var paneFieldComparers  = GetFieldComparers(PivotArea.RowArea);
            var seriesFieldNames    = new List <string> {
                _dataColumnName, STATISTICAL_AGGREGATION_DISPLAY_NAME
            };

            if (_analysis.ColorField != null)
            {
                seriesFieldNames.Add(_analysis.ColorField.Name);
            }

            var seriesFieldComparers = GetFieldComparers(PivotArea.ColumnArea);
            var timeField            = new TimeField {
                Dimension = _dimensionRepository.Time, DisplayUnit = statisticalAnalysis.TimeUnit
            };

            _data.AddColumn <StatisticalAggregation>(STATISTICAL_AGGREGATION);
            _data.AddColumn <string>(STATISTICAL_AGGREGATION_DISPLAY_NAME);
            _data.AddColumn <Tuple <QuantityValues, FloatMatrix> >(TIME_AND_VALUES);

            // Create rows for each combination of row<=>DATA_FIELD value and selected STATISTICAL_AGGREGATION
            var dataCopy = _data.Copy();

            _data.Clear();

            foreach (DataRow row in dataCopy.Rows)
            {
                var timeAndAllValues = getTimeAndAllValuesFor(row); // calculate once because expensive

                foreach (var statisticalAggregation in statisticalAnalysis.SelectedStatistics)
                {
                    row[STATISTICAL_AGGREGATION] = statisticalAggregation;
                    row[STATISTICAL_AGGREGATION_DISPLAY_NAME] = _representationInfoRepository.DisplayNameFor(statisticalAggregation);
                    row[TIME_AND_VALUES] = timeAndAllValues;
                    _data.ImportRow(row);
                }
            }

            var chart = CreateChart(timeField, paneFieldComparers);

            // Create series for each row (combination of DATA_FIELD value and selected STATISTICAL_AGGREGATION)
            foreach (DataRow row in _data.Rows)
            {
                var yAxisField = DataField <PopulationAnalysisOutputField>(row);
                var series     = GetCurveData(row, paneFieldNames, paneFieldComparers, seriesFieldNames, seriesFieldComparers, chart, yAxisField);
                setSeriesValues(series, row);
            }

            //add observed data if availables
            addObservedDataToChart(chart);
            return(chart);
        }
        private CalculationMethod mapFrom(FlatCalculationMethod flatCalculationMethod)
        {
            var cm = new CalculationMethod {
                Category = flatCalculationMethod.Category, Name = flatCalculationMethod.Id
            };

            cm.DisplayName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.CALCULATION_METHOD, cm.Name);
            _flatSpeciesCalculationMethodRepository.SpeciesListFor(cm.Name).Each(cm.AddSpecies);
            _flatModelCalculationMethodRepository.ModelListFor(cm.Name).Each(cm.AddModel);
            return(cm);
        }
        public SpeciesDatabaseMapDTO MapFrom(SpeciesDatabaseMap speciesDatabaseMap)
        {
            var dto     = new SpeciesDatabaseMapDTO();
            var species = _speciesRepository.FindByName(speciesDatabaseMap.Species);

            dto.DatabaseFullPath             = speciesDatabaseMap.DatabaseFullPath;
            dto.OriginalDatabasePathFullPath = speciesDatabaseMap.DatabaseFullPath;
            dto.SpeciesName        = speciesDatabaseMap.Species;
            dto.SpeciesDisplayName = _representationInfoRepository.DisplayNameFor(species);
            return(dto);
        }
示例#21
0
        public string GenderDisplayFor(string genderId)
        {
            if (string.Equals(genderId, CoreConstants.Population.AllGender))
            {
                return(PKSimConstants.UI.AllGender);
            }

            var gender = _vectorialParametersContainer.AllGenders().Distinct().FindByName(genderId);

            return(_representationInfoRepository.DisplayNameFor(gender));
        }
        public string GenderDisplayFor(string genderName)
        {
            if (string.Equals(genderName, Constants.Population.ALL_GENDERS))
            {
                return(PKSimConstants.UI.AllGender);
            }

            var gender = _genderRepository.FindByName(genderName);

            return(_representationInfoRepository.DisplayNameFor(gender));
        }
示例#23
0
 protected CompoundAdvancedParameterGroupPresenter(TView view, IRepresentationInfoRepository representationInfoRepository,
                                                   IMultiParameterEditPresenter parameterEditPresenter, IParameterGroupTask parameterGroupTask,
                                                   string groupName)
     : base(view)
 {
     _parameterEditPresenter = parameterEditPresenter;
     _parameterGroupTask     = parameterGroupTask;
     _parameterEditPresenter.IsSimpleEditor = true;
     _groupName   = groupName;
     View.Caption = representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, _groupName);
     View.SetParameterView(_parameterEditPresenter.View);
 }
 private TParameterRangeDTO createParameterRange <TParameterRangeDTO>(IParameter parameter) where TParameterRangeDTO : ParameterRange, new()
 {
     return(new TParameterRangeDTO
     {
         ParameterName = parameter.Name,
         ParameterDisplayName = _representationInfoRepository.DisplayNameFor(parameter),
         Dimension = parameter.Dimension,
         Unit = parameter.DisplayUnit,
         DbMaxValue = parameter.MaxValue,
         DbMinValue = parameter.MinValue
     });
 }
示例#25
0
        protected override void FillUpReport(IParameter parameter, ReportPart reportPart)
        {
            var parameterDTO = _parameterMapper.MapFrom(parameter);
            var displayName  = _representationInfoRepository.DisplayNameFor(parameter);
            var displayValue = ParameterMessages.DisplayValueFor(parameter);

            if (parameterDTO.ListOfValues.Any())
            {
                displayValue = parameterDTO.ListOfValues[parameter.Value];
            }

            reportPart.AddToContent(PKSimConstants.UI.ReportIs(displayName, displayValue));
        }
示例#26
0
        protected override void Context()
        {
            _dimensionRepository          = A.Fake <IDimensionRepository>();
            _representationInfoRepository = A.Fake <IRepresentationInfoRepository>();
            _lazyLoadTask            = A.Fake <ILazyLoadTask>();
            _observedCurveDataMapper = A.Fake <IDataRepositoryToObservedCurveDataMapper>();
            _statisticalAnalysis     = new PopulationStatisticalAnalysis();
            _genderField             = ChartDataHelperForSpecs.CreateGenderField();
            _statisticalAnalysis.Add(_genderField);
            _statisticalAnalysis.Add(_outputFieldVenousBloodPlasma);
            _statisticalAnalysis.Add(_outputFieldLiverCell);
            _predefinedStatisticalAggregation = new PredefinedStatisticalAggregation {
                Selected = true
            };
            _percentileStatisticalAggregation = new PercentileStatisticalAggregation {
                Selected = false, Percentile = 50
            };
            _statisticalAnalysis.AddStatistic(_predefinedStatisticalAggregation);
            _statisticalAnalysis.AddStatistic(_percentileStatisticalAggregation);
            A.CallTo(() => _representationInfoRepository.DisplayNameFor(_predefinedStatisticalAggregation)).Returns(_singleCurveId);
            A.CallTo(() => _representationInfoRepository.DisplayNameFor(_percentileStatisticalAggregation)).Returns(_percentileId);
            _statisticalDataCalculator = new StatisticalDataCalculator();
            _pivotResultCreator        = A.Fake <IPivotResultCreator>();

            _mergedDimensionVenousBloodPlasma = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _mergedDimensionLiverCell         = DomainHelperForSpecs.FractionDimensionForSpecs();

            A.CallTo(() => _dimensionRepository.MergedDimensionFor(A <IWithDimension> ._))
            .WhenArgumentsMatch((IWithDimension context) => Equals((context as NumericFieldContext)?.NumericValueField, _outputFieldVenousBloodPlasma))
            .Returns(_mergedDimensionVenousBloodPlasma);

            A.CallTo(() => _dimensionRepository.MergedDimensionFor(A <IWithDimension> ._))
            .WhenArgumentsMatch((IWithDimension context) => Equals((context as NumericFieldContext)?.NumericValueField, _outputFieldLiverCell))
            .Returns(_mergedDimensionLiverCell);

            sut = new TimeProfileChartDataCreator(_dimensionRepository, _pivotResultCreator, _representationInfoRepository,
                                                  _statisticalDataCalculator, _lazyLoadTask, _observedCurveDataMapper);
        }
示例#27
0
        public string FullPathFor(IObjectBase objectBase, bool addSimulationName = false)
        {
            var quantity = objectBase as IQuantity;

            if (quantity != null)
            {
                return(_quantityDisplayPathMapper.DisplayPathAsStringFor(quantity, addSimulationName));
            }

            var entity = objectBase as IEntity;

            if (entity != null)
            {
                return(entity.EntityPath());
            }

            return(_representationInfoRepository.DisplayNameFor(objectBase));
        }
        protected override void FillUpReport(CompoundProperties compoundProperties, ReportPart reportPart)
        {
            var processes      = compoundProperties.Processes;
            var compoundConfig = new TablePart(PKSimConstants.UI.Parameter, PKSimConstants.UI.AlternativeInCompound)
            {
                Title = PKSimConstants.UI.SimulationCompoundsConfiguration
            };


            foreach (var alternativeSelection in compoundProperties.CompoundGroupSelections)
            {
                var parameterName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, alternativeSelection.GroupName);
                compoundConfig.AddIs(parameterName, alternativeSelection.AlternativeName);
            }

            reportPart.AddPart(compoundConfig);
            reportPart.AddPart(_reportGenerator.ReportFor(processes.MetabolizationSelection).WithTitle(PKSimConstants.UI.SimulationMetabolism));
            reportPart.AddPart(_reportGenerator.ReportFor(processes.TransportAndExcretionSelection).WithTitle(PKSimConstants.UI.SimulationTransportAndExcretion));
            reportPart.AddPart(_reportGenerator.ReportFor(processes.SpecificBindingSelection).WithTitle(PKSimConstants.UI.SimulationSpecificBinding));
        }
示例#29
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");
        }
示例#30
0
        public string DisplayNameFor(object objectToDisplay)
        {
            if (objectToDisplay == null)
            {
                return(string.Empty);
            }

            var withName = objectToDisplay as IWithName;

            if (withName == null)
            {
                return(_objectTypeResolver.TypeFor(objectToDisplay));
            }

            var objectBase = objectToDisplay as IObjectBase;

            if (objectBase == null)
            {
                return(withName.Name);
            }

            return(_representationInfoRepository.DisplayNameFor(objectBase));
        }