public void CalculateBioavailabilityFor(Simulation simulation, string compoundName) { var individualSimulation = simulation as IndividualSimulation; if (individualSimulation == null) { return; } var compound = simulation.Compounds.FindByName(compoundName); //BA calculated with a Simple IV with 15 min infusion var simpleIvProtocol = _protocolFactory.Create(ProtocolMode.Simple, ApplicationTypes.Intravenous) .WithName("Simple IV for Bioavailability") .DowncastTo <SimpleProtocol>(); simpleIvProtocol.Parameter(Constants.Parameters.INFUSION_TIME).Value = 15; var simulationSingleDosingItem = singleDosingItem(simulation, compound); simpleIvProtocol.Dose.DisplayUnit = simulationSingleDosingItem.Dose.DisplayUnit; simpleIvProtocol.Dose.Value = simulationSingleDosingItem.Dose.Value; simpleIvProtocol.StartTime.Value = simulationSingleDosingItem.StartTime.Value; var ivSimulation = _globalPKAnalysisRunner.RunForBioavailability(simpleIvProtocol, individualSimulation, compound); var venousBloodCurve = ivSimulation.DataRepository.VenousBloodColumn(compoundName); var pkVenousBlood = _pkAnalysisTask.CalculateFor(ivSimulation, venousBloodCurve).PKAnalysis; individualSimulation.CompoundPKFor(compoundName).AucIV = pkParameterValue(pkVenousBlood, Constants.PKParameters.AUC_inf); }
private IEnumerable <object> pkAnalysisFor(Simulation simulation, CurveChart chart, OSPSuiteTracker buildTracker) { var report = new List <object>(); var globalPKAnalysis = _globalPKAnalysisTask.CalculateGlobalPKAnalysisFor(new[] { simulation }); updateDisplayUnits(globalPKAnalysis, PresentationSettingsFor(chart, PresenterConstants.PresenterKeys.GlobalPKAnalysisPresenter)); var globalPKAnalysisTable = _globalPKAnalysisToDataTableMapper.MapFrom(globalPKAnalysis); if (globalPKAnalysisTable.Rows.Count > 0) { report.Add(buildTracker.GetStructureElementRelativeToLast(PKSimConstants.UI.GlobalPKAnalyses, 1)); report.Add(globalPKAnalysisTable); } var curvesToDisplay = chart.Curves.ForPKAnalysis(); var pkAnalyses = _pkAnalysisTask.CalculateFor(new[] { simulation }, curvesToDisplay.Select(c => c.yData)).ToList(); updateDisplayUnits(pkAnalyses, PresentationSettingsFor(chart, PresenterConstants.PresenterKeys.IndividualPKParametersPresenter)); var pkAnalysesTable = _pkAnalysisToDataTableMapper.MapFrom(pkAnalyses, curvesToDisplay); var pkAnalysesForReport = new PKAnalysesTable(pkAnalysesTable); report.Add(buildTracker.GetStructureElementRelativeToLast(PKSimConstants.UI.PKAnalyses, 1)); report.Add(pkAnalysesForReport); return(report); }
public void CalculatePKAnalysis(IPopulationDataCollector populationDataCollector, ChartData <TimeProfileXValue, TimeProfileYValue> timeProfileChartData) { _allAnalyses.Clear(); _populationDataCollector = populationDataCollector; _allPKAnalyses = _pkAnalysesTask.CalculateFor(populationDataCollector, timeProfileChartData); _allAnalyses.AddRange(_allPKAnalyses); LoadPreferredUnitsForPKAnalysis(); BindToPKAnalysis(); }
private IEnumerable <object> pkAnalysisFor(PopulationPKAnalyses populationPKAnalyses, OSPSuiteTracker buildTracker) { var report = new List <object>(); var pkAnalyses = _pkAnalysisTask.CalculateFor(populationPKAnalyses.DataCollector, populationPKAnalyses.ChartData).ToList(); updateDisplayUnits(pkAnalyses, PresentationSettingsFor(populationPKAnalyses.PopulationAnalysisChart, PresenterConstants.PresenterKeys.PopulationPKAnalysisPresenter)); var pkAnalysesTable = _pkAnalysisToDataTableMapper.MapFrom(pkAnalyses); var pkAnalysesForReport = new PKAnalysesTable(pkAnalysesTable); report.Add(buildTracker.GetStructureElementRelativeToLast(PKSimConstants.UI.PKAnalyses, 1)); report.Add(pkAnalysesForReport); return(report); }
public void ShowPKAnalysis(IEnumerable <Simulation> simulations, IEnumerable <Curve> curves) { _simulations = simulations.ToList(); _globalPKAnalysisPresenter.CalculatePKAnalysis(_simulations); var globalPKAnalysis = _globalPKAnalysisPresenter.GlobalPKAnalysis; var curveList = curves.ToList(); createColumnsWithPKAnalysesFrom(curveList); _allColumns = _curveCache.Keys.ToList(); _allPKAnalysis = _pkAnalysesTask.CalculateFor(_simulations, _allColumns, globalPKAnalysis).ToList(); _view.GlobalPKVisible = _globalPKAnalysisPresenter.HasParameters(); _view.ShowControls = true; LoadPreferredUnitsForPKAnalysis(); BindToPKAnalysis(); }
protected override void Context() { _exportTask = A.Fake <IPKAnalysisExportTask>(); _pkAnalysesTask = A.Fake <IPKAnalysesTask>(); _view = A.Fake <IPopulationPKAnalysisView>(); _populationPKAnalysisToDTOMapper = A.Fake <IPopulationPKAnalysisToPKAnalysisDTOMapper>(); _populationPKAnalysisToDataTableMapper = A.Fake <IPopulationPKAnalysisToDataTableMapper>(); _pkParameterRepository = A.Fake <IPKParameterRepository>(); _presenterSettingsTask = A.Fake <IPresentationSettingsTask>(); sut = new PopulationPKAnalysisPresenter(_view, _pkAnalysesTask, _exportTask, _populationPKAnalysisToDTOMapper, _pkParameterRepository, _presenterSettingsTask); _populationDataCollector = A.Fake <IPopulationDataCollector>(); _timeProfileChartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(null, null); var pane = new PaneData <TimeProfileXValue, TimeProfileYValue>(null) { Caption = "TOTO" }; _curve1 = new TimeProfileCurveData { Caption = "A", Pane = pane }; _curve2 = new TimeProfileCurveData { Caption = "B", Pane = pane }; _pk1 = new PKAnalysis(); _pk2 = new PKAnalysis(); _allPKanalysis = new List <PopulationPKAnalysis> { new PopulationPKAnalysis(_curve1, _pk1), new PopulationPKAnalysis(_curve2, _pk2), }; A.CallTo(() => _pkAnalysesTask.CalculateFor(_populationDataCollector, _timeProfileChartData)).Returns(_allPKanalysis); A.CallTo(() => _view.BindTo(A <PKAnalysisDTO> ._)).Invokes(x => _dataTable = x.GetArgument <PKAnalysisDTO>(0).DataTable); A.CallTo(() => _populationPKAnalysisToDataTableMapper.MapFrom(A <IReadOnlyList <PopulationPKAnalysis> > ._, true)).Returns(_dataTable); }
protected override void Context() { base.Context(); _context = A.Fake <IExecutionContext>(); _quantityRetriever = A.Fake <IEntitiesInContainerRetriever>(); _populationAnalysisTask = A.Fake <IPKAnalysesTask>(); _pkAnalyses = A.Fake <PopulationSimulationPKAnalyses>(); _quantityCache = new PathCacheForSpecs <IQuantity>(); _quantity1 = new MoleculeAmount(); _quantity2 = new MoleculeAmount(); _quantityCache.Add("PATH1", _quantity1); _quantityCache.Add("PATH2", _quantity2); A.CallTo(() => _context.Resolve <IEntitiesInContainerRetriever>()).Returns(_quantityRetriever); A.CallTo(() => _context.Resolve <IPKAnalysesTask>()).Returns(_populationAnalysisTask); A.CallTo(() => _quantityRetriever.QuantitiesFrom(_populationSimulation)).Returns(_quantityCache); A.CallTo(() => _populationAnalysisTask.CalculateFor(_populationSimulation)).Returns(_pkAnalyses); _allQuantityPaths = new List <string> { "PATH1", "PATH2" }; _simulationSettings = new OutputSelections(); A.CallTo(() => _populationSimulation.OutputSelections).Returns(_simulationSettings); A.CallTo(() => _simulationResults.AllQuantityPaths()).Returns(_allQuantityPaths); }
public void Synchronize(PopulationSimulation populationSimulation, SimulationResults newResults) { populationSimulation.Results = newResults; populationSimulation.PKAnalyses = _populationPKAnalysesTask.CalculateFor(populationSimulation); }