Exemple #1
0
 protected override void Context()
 {
     base.Context();
     _userDefinedPKParameter = new UserDefinedPKParameter {
         Name = "MyParam"
     };
 }
Exemple #2
0
        public override void GlobalContext()
        {
            base.GlobalContext();
            var simulationFile      = HelperForSpecs.DataFile("S1.pkml");
            var simulationPersister = Api.GetSimulationPersister();
            var pkParametersTask    = Api.GetPKParameterTask();

            _simulation          = simulationPersister.LoadSimulation(simulationFile);
            _sensitivityAnalysis = new SensitivityAnalysis(_simulation)
            {
                NumberOfSteps = 2, VariationRange = 0.2
            };

            //Should calculate CMax/100
            _userDefinedPKParameter = new UserDefinedPKParameter {
                Name = "Toto", NormalizationFactor = 100, StandardPKParameter = StandardPKParameter.C_max
            };
            pkParametersTask.AddUserDefinedPKParameter(_userDefinedPKParameter);

            _userDefinedCLParameter = new UserDefinedPKParameter {
                Name = "MyCL", StandardPKParameter = StandardPKParameter.CL
            };
            pkParametersTask.AddUserDefinedPKParameter(_userDefinedCLParameter);

            var containerTask = Api.GetContainerTask();
            var liverVolumes  = containerTask.AllParametersMatching(_simulation, "Organism|Liver|Volume");

            _sensitivityAnalysis.AddParameterPaths(liverVolumes.Select(x => x.ConsolidatedPath()));
        }
Exemple #3
0
        protected override void Context()
        {
            base.Context();
            _simulation = A.Fake <ISimulation>();
            _runResults = A.Fake <SimulationResults>();
            var outputSelections = new OutputSelections();

            outputSelections.AddOutput(new QuantitySelection("Liver|Cell|Drug|Concentration", QuantityType.Drug));

            A.CallTo(() => _simulation.OutputSelections).Returns(outputSelections);
            var pKCalculationOptions = new PKCalculationOptions();

            A.CallTo(_pkCalculationOptionsFactory).WithReturnType <PKCalculationOptions>().Returns(pKCalculationOptions);

            _p1 = new PKParameter {
                Name = "AUC", Mode = PKParameterMode.Single
            };
            _userDefinedParameter1 = new UserDefinedPKParameter {
                Name = "Dynamic1", Mode = PKParameterMode.Single
            };

            A.CallTo(() => _pkParameterRepository.All()).Returns(new[] { _p1, _userDefinedParameter1 });
            var individualResults = A.Fake <IndividualResults>();

            A.CallTo(() => _runResults.AllIndividualResults).Returns(new HashSet <IndividualResults>(new[] { individualResults }));

            var pKValues = new PKValues();

            pKValues.AddValue(_p1.Name, 10f);
            pKValues.AddValue(_userDefinedParameter1.Name, 30f);
            A.CallTo(_pkValuesCalculator).WithReturnType <PKValues>().Returns(pKValues);
        }
        public void RemoveUserDefinedPKParameter(UserDefinedPKParameter userDefinedPKParameter)
        {
            if (userDefinedPKParameter == null)
            {
                return;
            }

            _pkParameterRepository.Remove(userDefinedPKParameter);
        }
 protected override void Context()
 {
     base.Context();
     _result = _simulationRunner.Run(new SimulationRunArgs {
         Simulation = _simulation
     });
     _userDefinedPKParameter =
         _pkParameterTask.CreateUserDefinedPKParameter("MyCmax", StandardPKParameter.C_max, displayName: null, displayUnit: "mg/l");
     _pkParameterTask.AddUserDefinedPKParameter(_userDefinedPKParameter);
 }
        public void AddUserDefinedPKParameter(UserDefinedPKParameter userDefinedPKParameter)
        {
            var existingUserDefinedPKParameter = UserDefinedPKParameterByName(userDefinedPKParameter.Name);

            if (existingUserDefinedPKParameter != null)
            {
                _logger.AddWarning(Warning.UserDefinedPKParameterAlreadyExistsAndWillBeReplaced(userDefinedPKParameter.Name));
                return;
            }

            _pkParameterRepository.Add(userDefinedPKParameter);
        }
        public override void GlobalContext()
        {
            base.GlobalContext();
            _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16");

            _pkOptions = new PKCalculationOptions
            {
                TotalDrugMassPerBodyWeight = 10,
            };
            _pkOptions.AddInterval(new DosingInterval {
                StartValue = 0, EndValue = 8, DrugMassPerBodyWeight = _firstDose
            });
            _pkOptions.AddInterval(new DosingInterval {
                StartValue = 8, EndValue = 16, DrugMassPerBodyWeight = _oneMinusLastDose
            });
            _pkOptions.AddInterval(new DosingInterval {
                StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose
            });

            _cmax_tD1_tD2 = new UserDefinedPKParameter {
                StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxD1D2"
            };
            _cmax_tD1_tD2_DOSE_BW = new UserDefinedPKParameter {
                StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxD1D2_Normalized", NormalizationFactor = _firstDose
            };
            _cmax_tD1_tD2_DOSE_BW_auto = new UserDefinedPKParameter {
                StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max_norm, Name = "MyCmaxD1D2_Normalized_auto"
            };

            _tmax_tD1_tD2 = new UserDefinedPKParameter {
                StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.t_max, Name = "MyTmaxD1D2"
            };

            _cmax_t1_t2 = new UserDefinedPKParameter {
                StartTime = 0, EndTime = 8, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1T2"
            };
            _cmax_t1_t2_offset = new UserDefinedPKParameter {
                StartTime = 0, StartTimeOffset = 16, EndTime = 48, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1T2offset"
            };
            _cmax_t1_offset_no_end = new UserDefinedPKParameter {
                StartTime = 0, StartTimeOffset = 16, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1offset_no_end"
            };
            _tThreshold = new UserDefinedPKParameter {
                StartApplicationIndex = 0, StandardPKParameter = StandardPKParameter.Tthreshold, Name = "Threshold", ConcentrationThreshold = 4
            };
            _tThreshold_last = new UserDefinedPKParameter {
                StartApplicationIndex = 2, StandardPKParameter = StandardPKParameter.Tthreshold, Name = "Threshold_last", ConcentrationThreshold = 5
            };


            _allDynamicPkParameters = new[] { _cmax_tD1_tD2, _tmax_tD1_tD2, _cmax_t1_t2, _cmax_t1_t2_offset, _cmax_t1_offset_no_end, _cmax_tD1_tD2_DOSE_BW, _tThreshold, _tThreshold_last, _cmax_tD1_tD2_DOSE_BW_auto };
        }
        public UserDefinedPKParameter CreateUserDefinedPKParameter(
            string name,
            StandardPKParameter standardPKParameter,
            string displayName,
            string displayUnit)
        {
            var defaultDimension        = _dimensionTask.DimensionForStandardPKParameter(standardPKParameter);
            var userDefinedPKParameters = new UserDefinedPKParameter
            {
                Name                = name,
                DisplayName         = displayName,
                Dimension           = defaultDimension,
                DisplayUnit         = displayUnit,
                StandardPKParameter = standardPKParameter
            };

            //No display unit defined, we return the user defined pk parameter
            if (string.IsNullOrEmpty(displayUnit))
            {
                return(userDefinedPKParameters);
            }

            var dimensionForDisplayUnit = _dimensionTask.DimensionForUnit(displayUnit);

            //Display unit belongs to the dimension. We can use this
            if (Equals(defaultDimension, dimensionForDisplayUnit))
            {
                return(userDefinedPKParameters);
            }

            //We have two dimensions. Do we have a converter between those dimensions?
            if (_dimensionFactory.HasMergingInformation(defaultDimension, dimensionForDisplayUnit))
            {
                return(userDefinedPKParameters);
            }

            //There is no converter defined between those dimensions.
            //We use the dimension defined for the display unit or create a user defined dimension otherwise
            userDefinedPKParameters.Dimension = dimensionForDisplayUnit ?? _dimensionFactory.CreateUserDefinedDimension(name, displayUnit);
            return(userDefinedPKParameters);
        }
Exemple #9
0
 protected override void Because()
 {
     _userDefinedParameter = sut.CreateUserDefinedPKParameter("Test", StandardPKParameter.C_trough, "Test", "not_there");
 }