private void addPKParametersForOutput(ISimulation simulation, int numberOfIndividuals, SimulationResults runResults, Action <int> performIndividualScalingAction, QuantitySelection selectedQuantity, PopulationSimulationPKAnalyses popAnalyses, string moleculeName, PKCalculationOptions pkCalculationOptions, IReadOnlyList <PKCalculationOptionsFactory.ApplicationParameters> allApplicationParameters) { var availablePKParameters = _pkParameterRepository.All().Where(p => PKParameterCanBeUsed(p, pkCalculationOptions)).ToList(); //create pk parameter for each quantities foreach (var pkParameter in availablePKParameters) { var quantityPKParameter = new QuantityPKParameter { Name = pkParameter.Name, QuantityPath = selectedQuantity.Path, Dimension = pkParameter.Dimension }; quantityPKParameter.SetNumberOfIndividuals(numberOfIndividuals); popAnalyses.AddPKAnalysis(quantityPKParameter); } //add the values for each individual foreach (var individualResult in runResults.AllIndividualResults) { performIndividualScalingAction(individualResult.IndividualId); _pkCalculationOptionsFactory.UpdateAppliedDose(simulation, moleculeName, pkCalculationOptions, allApplicationParameters); var values = individualResult.ValuesFor(selectedQuantity.Path); var pkValues = _pkValuesCalculator.CalculatePK(individualResult.Time.Values, values.Values, pkCalculationOptions); foreach (var pkParameter in availablePKParameters) { var quantityPKParameter = popAnalyses.PKParameterFor(selectedQuantity.Path, pkParameter.Name); quantityPKParameter.SetValue(individualResult.IndividualId, pkValues.ValueOrDefaultFor(pkParameter.Name)); } } }
private void addPKParametersForOutput( IModelCoreSimulation simulation, SimulationResults simulationResults, Action <int> performIndividualScalingAction, QuantitySelection selectedQuantity, PopulationSimulationPKAnalyses popAnalyses, string moleculeName, PKCalculationOptions pkCalculationOptions, IReadOnlyList <ApplicationParameters> allApplicationParameters) { var allPKParameters = _pkParameterRepository.All().Where(p => PKParameterCanBeUsed(p, pkCalculationOptions)).ToList(); var allUserDefinedPKParameters = allPKParameters.OfType <UserDefinedPKParameter>().ToList(); //create pk parameter for each pk parameters (predefined and dynamic) foreach (var pkParameter in allPKParameters) { var quantityPKParameter = new QuantityPKParameter { Name = pkParameter.Name, QuantityPath = selectedQuantity.Path, Dimension = pkParameter.Dimension }; popAnalyses.AddPKAnalysis(quantityPKParameter); } //add the values for each individual foreach (var individualResult in simulationResults.AllIndividualResults) { performIndividualScalingAction(individualResult.IndividualId); _pkCalculationOptionsFactory.UpdateTotalDrugMassPerBodyWeight(simulation, moleculeName, pkCalculationOptions, allApplicationParameters); var values = individualResult.QuantityValuesFor(selectedQuantity.Path); //This can happen is the results do not match the simulation if (values == null) { continue; } var pkValues = _pkValuesCalculator.CalculatePK(individualResult.Time.Values, values.Values, pkCalculationOptions, allUserDefinedPKParameters); foreach (var quantityPKParameter in popAnalyses.AllPKParametersFor(selectedQuantity.Path)) { quantityPKParameter.SetValue(individualResult.IndividualId, pkValues.ValueOrDefaultFor(quantityPKParameter.Name)); } } }
public PKValues CalculatePK(DataColumn column, PKCalculationOptions options) { return(_pkValuesCalculator.CalculatePK(column, options)); }