コード例 #1
0
        protected override async Task Context()
        {
            await base.Context();

            _compoundCalculationMethod = new OSPSuite.Core.Domain.CalculationMethodCache();
            _calculationMethodSnapshot = new CalculationMethodCache();
            _categorialParameterIdentificationRunMode = new CategorialParameterIdentificationRunMode {
                AllTheSame = false
            };
            _categorialParameterIdentificationRunMode.CalculationMethodsCache["C1"] = _compoundCalculationMethod;
            A.CallTo(() => _calculationMethodMapper.MapToSnapshot(_compoundCalculationMethod)).Returns(_calculationMethodSnapshot);
        }
コード例 #2
0
        public CalculationMethodCache CalculationMethodCacheFor(string compoundName)
        {
            if (AllTheSame)
            {
                return(AllTheSameSelection);
            }

            if (!CalculationMethodsCache.Contains(compoundName))
            {
                CalculationMethodsCache[compoundName] = new CalculationMethodCache();
            }

            return(CalculationMethodsCache[compoundName]);
        }
コード例 #3
0
        protected override Task Context()
        {
            _calculationMethodRepository         = A.Fake <ICalculationMethodRepository>();
            _calculationMethodCategoryRepository = A.Fake <ICalculationMethodCategoryRepository>();
            _logger = A.Fake <IOSPSuiteLogger>();

            sut             = new CalculationMethodCacheMapper(_calculationMethodRepository, _calculationMethodCategoryRepository, _logger);
            _singleCategory = new CalculationMethodCategory {
                Name = "Multiple"
            };
            _multipleCategory = new CalculationMethodCategory {
                Name = "Single"
            };


            _calculationMethodWithMultipleOptions = new CalculationMethod
            {
                Name        = "CM1",
                DisplayName = "CM1",
                Category    = _multipleCategory.Name
            };

            _calculationMethodWithSingleOption = new CalculationMethod
            {
                Name        = "CM2",
                DisplayName = "CM2",
                Category    = _singleCategory.Name
            };

            _anotherCalculationMethodInMultipleOptions = new CalculationMethod
            {
                Name     = "Another CM",
                Category = _multipleCategory.Name
            };

            A.CallTo(() => _calculationMethodRepository.All()).Returns(new[] { _calculationMethodWithMultipleOptions, _anotherCalculationMethodInMultipleOptions, _calculationMethodWithSingleOption, });

            _singleCategory.Add(_calculationMethodWithSingleOption);
            _multipleCategory.Add(_calculationMethodWithMultipleOptions);
            _multipleCategory.Add(_anotherCalculationMethodInMultipleOptions);

            _calculationMethodCache = new CalculationMethodCache();
            _calculationMethodCache.AddCalculationMethod(_calculationMethodWithMultipleOptions);
            _calculationMethodCache.AddCalculationMethod(_calculationMethodWithSingleOption);

            A.CallTo(() => _calculationMethodCategoryRepository.FindBy(_singleCategory.Name)).Returns(_singleCategory);
            A.CallTo(() => _calculationMethodCategoryRepository.FindBy(_multipleCategory.Name)).Returns(_multipleCategory);

            return(Task.FromResult(true));
        }
コード例 #4
0
ファイル: CompoundProperties.cs プロジェクト: valdiman/PK-Sim
        public virtual CompoundProperties Clone(ICloneManager cloneManager)
        {
            var clone = new CompoundProperties
            {
                CalculationMethodCache = CalculationMethodCache.Clone(),
                Processes          = Processes.Clone(cloneManager),
                ProtocolProperties = ProtocolProperties.Clone(),

                //do not clone: simply update reference that should be changed if required
                Compound = Compound
            };

            CompoundGroupSelections.Each(clone.AddCompoundGroupSelection);
            return(clone);
        }
コード例 #5
0
        protected override ParameterIdentificationRunMode CreateRunMode()
        {
            var calculationMethodRepository = IoC.Resolve <ICompoundCalculationMethodRepository>();

            _categorialRunMode = new CategorialParameterIdentificationRunMode {
                AllTheSame = false
            };
            _calculationMethod1      = calculationMethodRepository.All().ElementAt(0);
            _calculationMethod2      = calculationMethodRepository.All().ElementAt(1);
            _calculationMethodCache1 = new CalculationMethodCache();
            _calculationMethodCache2 = new CalculationMethodCache();
            _calculationMethodCache1.AddCalculationMethod(_calculationMethod1);
            _calculationMethodCache1.AddCalculationMethod(_calculationMethod2);
            _calculationMethodCache2.AddCalculationMethod(_calculationMethod2);
            _categorialRunMode.CalculationMethodsCache.Add("Drug1", _calculationMethodCache1);
            _categorialRunMode.CalculationMethodsCache.Add("Drug2", _calculationMethodCache2);

            return(_categorialRunMode);
        }
        protected override void Context()
        {
            base.Context();
            sut.AllTheSame = false;
            var cacheComp1 = new CalculationMethodCache();

            cacheComp1.AddCalculationMethod(_calculationMethod1);
            cacheComp1.AddCalculationMethod(_calculationMethod2);

            var cacheComp2 = new CalculationMethodCache();

            cacheComp2.AddCalculationMethod(_calculationMethod3);
            cacheComp2.AddCalculationMethod(_calculationMethod2);

            sut.CalculationMethodsCache["Comp1"] = cacheComp1;
            sut.CalculationMethodsCache["Comp2"] = cacheComp2;
            sut.AllTheSameSelection.AddCalculationMethod(_calculationMethod1);
            sut.AllTheSameSelection.AddCalculationMethod(_calculationMethod2);
            sut.AllTheSameSelection.AddCalculationMethod(_calculationMethod3);
        }
コード例 #7
0
ファイル: OriginData.cs プロジェクト: valdiman/PK-Sim
 public virtual OriginData Clone()
 {
     return(new OriginData
     {
         Age = Age,
         AgeUnit = AgeUnit,
         Comment = Comment,
         Height = Height,
         HeightUnit = HeightUnit,
         BMI = BMI,
         BMIUnit = BMIUnit,
         SpeciesPopulation = SpeciesPopulation,
         Gender = Gender,
         Species = Species,
         SubPopulation = SubPopulation,
         Weight = Weight,
         WeightUnit = WeightUnit,
         GestationalAge = GestationalAge,
         CalculationMethodCache = CalculationMethodCache.Clone()
     });
 }
コード例 #8
0
ファイル: OriginData.cs プロジェクト: yvkashyap/PK-Sim
        public virtual OriginData Clone()
        {
            var clone = new OriginData
            {
                Age                    = Age,
                AgeUnit                = AgeUnit,
                Comment                = Comment,
                Height                 = Height,
                HeightUnit             = HeightUnit,
                BMI                    = BMI,
                BMIUnit                = BMIUnit,
                SpeciesPopulation      = SpeciesPopulation,
                Gender                 = Gender,
                Species                = Species,
                SubPopulation          = SubPopulation,
                Weight                 = Weight,
                WeightUnit             = WeightUnit,
                GestationalAge         = GestationalAge,
                CalculationMethodCache = CalculationMethodCache.Clone()
            };

            clone.UpdateValueOriginFrom(ValueOrigin);
            return(clone);
        }
コード例 #9
0
 private void updateCalculationMethodCache(OSPSuite.Core.Domain.CalculationMethodCache modelCalculationMethodCache, CalculationMethodCache snapshotCalculationMethodCache)
 {
     _calculationMethodCacheMapper.UpdateCalculationMethodCache(modelCalculationMethodCache, snapshotCalculationMethodCache, oneCalculationMethodPerCategory: false);
 }
コード例 #10
0
ファイル: OriginData.cs プロジェクト: valdiman/PK-Sim
 public OriginData()
 {
     CalculationMethodCache = new CalculationMethodCache();
 }
コード例 #11
0
ファイル: Compound.cs プロジェクト: valdiman/PK-Sim
 public Compound() : base(PKSimBuildingBlockType.Compound)
 {
     CalculationMethodCache = new CalculationMethodCache();
 }
コード例 #12
0
ファイル: ModelProperties.cs プロジェクト: yvkashyap/PK-Sim
 public ModelProperties()
 {
     CalculationMethodCache = new CalculationMethodCache();
 }
コード例 #13
0
        protected override Task Context()
        {
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMappingMapper         = A.Fake <ProcessMappingMapper>();
            _logger  = A.Fake <ILogger>();
            _project = new PKSimProject();
            _calculationMethodSnapshot = new CalculationMethodCache();
            sut = new CompoundPropertiesMapper(_calculationMethodCacheMapper, _processMappingMapper, _logger);

            _compoundGroupSelectionOneAlternative = new CompoundGroupSelection
            {
                AlternativeName = "ALT1",
                GroupName       = "ALTERNATIVE_GROUP_1"
            };

            _compoundGroupSelectionTwoAlternatives = new CompoundGroupSelection
            {
                AlternativeName = "ALT2",
                GroupName       = "ALTERNATIVE_GROUP_2"
            };

            _compound = new Compound
            {
                Name = "COMP",
            };

            _protocol = new SimpleProtocol
            {
                Name = "PROTOCOL"
            };

            _parameterAlternativeGroupWithOneAlternative = new ParameterAlternativeGroup {
                Name = _compoundGroupSelectionOneAlternative.GroupName
            };
            _parameterAlternativeGroupWithTwoAlternatives = new ParameterAlternativeGroup {
                Name = _compoundGroupSelectionTwoAlternatives.GroupName
            };

            _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative {
                Name = "ALT1"
            });
            _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative {
                Name = "ALT2"
            });

            _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithOneAlternative);
            _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithTwoAlternatives);

            _compoundProperties = new Model.CompoundProperties();

            _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionOneAlternative);
            _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionTwoAlternatives);
            _compoundProperties.Compound = _compound;
            _enzymaticProcess            = new EnzymaticProcess {
                Name = "EnzymaticProcess"
            };
            _anotherEnzymaticProcess = new EnzymaticProcess {
                Name = "AnotherEnzymaticProcess", MoleculeName = "CYP3A4"
            };
            _specificBindingProcess = new SpecificBindingPartialProcess {
                Name = "SpecificBinding"
            };
            _gfrTransportProcess = new SystemicProcess {
                Name = "Transport", SystemicProcessType = SystemicProcessTypes.GFR
            };
            _hepaticEnzymaticProcess = new SystemicProcess {
                Name = "Plasma Clearance", SystemicProcessType = SystemicProcessTypes.Hepatic
            };
            _compound.AddProcess(_enzymaticProcess);
            _compound.AddProcess(_specificBindingProcess);
            _compound.AddProcess(_gfrTransportProcess);
            _compound.AddProcess(_hepaticEnzymaticProcess);

            _enzymaticPartialProcessSelection = new EnzymaticProcessSelection {
                ProcessName = _enzymaticProcess.Name
            };
            _noEnzymaticSystemicProcessSelection = new SystemicProcessSelection {
                ProcessType = SystemicProcessTypes.Hepatic
            };
            _specificBindingPartialProcessSelection = new ProcessSelection {
                ProcessName = _specificBindingProcess.Name
            };
            _transportSystemicProcessSelection = new SystemicProcessSelection {
                ProcessName = _gfrTransportProcess.Name, ProcessType = _gfrTransportProcess.SystemicProcessType,
            };
            _noEnzymaticPartialProcessSelection = new EnzymaticProcessSelection {
                MoleculeName = _anotherEnzymaticProcess.MoleculeName
            };
            _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_enzymaticPartialProcessSelection);
            _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_noEnzymaticPartialProcessSelection);
            _compoundProperties.Processes.MetabolizationSelection.AddSystemicProcessSelection(_noEnzymaticSystemicProcessSelection);
            _compoundProperties.Processes.SpecificBindingSelection.AddPartialProcessSelection(_specificBindingPartialProcessSelection);
            _compoundProperties.Processes.TransportAndExcretionSelection.AddSystemicProcessSelection(_transportSystemicProcessSelection);

            _snapshotProcess1 = new CompoundProcessSelection {
                Name = _enzymaticPartialProcessSelection.ProcessName
            };
            _snapshotProcess2 = new CompoundProcessSelection {
                Name = _specificBindingPartialProcessSelection.ProcessName
            };
            _snapshotProcess3 = new CompoundProcessSelection {
                Name = _transportSystemicProcessSelection.ProcessName
            };
            _snapshotProcess4 = new CompoundProcessSelection {
                SystemicProcessType = _noEnzymaticSystemicProcessSelection.ProcessType.SystemicProcessTypeId.ToString()
            };
            _snapshotProcess5 = new CompoundProcessSelection {
                MoleculeName = _noEnzymaticPartialProcessSelection.MoleculeName
            };

            _formulation = new Formulation
            {
                Id = "123456"
            };
            _compoundProperties.ProtocolProperties.Protocol = _protocol;
            _compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping
            {
                FormulationKey        = "F1",
                TemplateFormulationId = _formulation.Id
            });

            _project.AddBuildingBlock(_formulation);
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compoundProperties.CalculationMethodCache)).Returns(_calculationMethodSnapshot);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_enzymaticPartialProcessSelection)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_specificBindingPartialProcessSelection)).Returns(_snapshotProcess2);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_transportSystemicProcessSelection)).Returns(_snapshotProcess3);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticSystemicProcessSelection)).Returns(_snapshotProcess4);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticPartialProcessSelection)).Returns(_snapshotProcess5);

            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess1, _enzymaticProcess)).Returns(_enzymaticPartialProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess2, _specificBindingProcess)).Returns(_specificBindingPartialProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess3, _gfrTransportProcess)).Returns(_transportSystemicProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess4, A <NotSelectedSystemicProcess> ._)).Returns(_noEnzymaticSystemicProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess5, A <EnzymaticProcess> ._)).Returns(_noEnzymaticPartialProcessSelection);

            return(_completed);
        }
コード例 #14
0
ファイル: OriginData.cs プロジェクト: yvkashyap/PK-Sim
 public OriginData()
 {
     CalculationMethodCache = new CalculationMethodCache();
     ValueOrigin            = new ValueOrigin();
 }