protected override void Context() { base.Context(); var organsim = new Container().WithName(Constants.ORGANISM); var kidney = new Container().WithName(CoreConstants.Organ.KIDNEY).WithParentContainer(organsim); var urine = new Container().WithName(CoreConstants.Compartment.URINE).WithParentContainer(kidney); var lumen = new Container().WithName(CoreConstants.Organ.LUMEN).WithParentContainer(organsim); var feces = new Container().WithName(CoreConstants.Compartment.FECES).WithParentContainer(lumen); var gallBladder = new Container().WithName(CoreConstants.Organ.GALLBLADDER).WithParentContainer(organsim); _moleculeUrine = new MoleculeAmount().WithName("DRUG") .WithParentContainer(urine); _moleculeUrine.Persistable = false; _moleculeFeces = new MoleculeAmount().WithName("DRUG") .WithParentContainer(feces); _moleculeFeces.Persistable = false; _moleculeGallBladder = new MoleculeAmount().WithName("DRUG") .WithParentContainer(gallBladder); _moleculeGallBladder.Persistable = false; _urineConcentrationObserver = new Observer().WithName(CoreConstants.Observer.CONCENTRATION_IN_CONTAINER); _urineConcentrationObserver.Persistable = true; _moleculeUrine.Add(_urineConcentrationObserver); _fecesConcentrationObserver = new Observer().WithName(CoreConstants.Observer.CONCENTRATION_IN_CONTAINER); _fecesConcentrationObserver.Persistable = true; _moleculeFeces.Add(_fecesConcentrationObserver); var compound = new Compound().WithName("DRUG"); _individualSimulation = new IndividualSimulation(); _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("Id", PKSimBuildingBlockType.Compound) { BuildingBlock = compound }); _individualSimulation.Model = new OSPSuite.Core.Domain.Model { Root = new Container { organsim } }; }
protected override void Context() { base.Context(); _chart = A.Fake <ISimulationAnalysis>(); _simulationToConfigure = new IndividualSimulation().WithId("oldSim"); _newSimulation = new IndividualSimulation().WithId("newSim"); _simulationToConfigure.AddUsedBuildingBlock(new UsedBuildingBlock("C1", PKSimBuildingBlockType.Compound) { BuildingBlock = new Compound().WithName("C1") }); _newSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("C2", PKSimBuildingBlockType.Compound) { BuildingBlock = new Compound().WithName("C2") }); _oldResults = new DataRepository("oldResult"); _simulationToConfigure.DataRepository = _oldResults; _simulationToConfigure.ResultsVersion = _resultVersion; _simulationToConfigure.AddAnalysis(_chart); }
protected override void Context() { base.Context(); _simulation = new IndividualSimulation(); _compound = new Compound().WithId("Comp"); _simulation.Properties = new SimulationProperties(); _compoundProperties = new CompoundProperties { Compound = _compound }; _simulation.Properties.AddCompoundProperties(_compoundProperties); _interactionSelection = new InteractionSelection { MoleculeName = "CYP3A4", ProcessName = "Proc" }; _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Id", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); }
protected override void Context() { base.Context(); var dimension = A.Fake <IDimension>(); _outputSelection = new OutputSelections(); _simulation = new IndividualSimulation { SimulationSettings = new SimulationSettings { OutputSelections = _outputSelection } }; _compound = A.Fake <Compound>(); A.CallTo(() => _compound.Name).Returns("Drug"); A.CallTo(() => _compound.MolWeight).Returns(20); _dataRepository = new DataRepository(); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("toto", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _newBaseGrid = new BaseGrid("baseGrid1", "baseGrid1", dimension); _newColumn = new DataColumn("col1", "col1", dimension, _newBaseGrid) { QuantityInfo = new QuantityInfo("Obs", new List <string> { "Sim", "Liver", "Cell", "Drug", "Obs" }, QuantityType.Observer | QuantityType.Drug) }; _otherColumn = new DataColumn("col2", "col2", dimension, _newBaseGrid) { QuantityInfo = new QuantityInfo("Obs", new List <string> { "Sim", "Liver", "Cell", "Sp1", "Obs" }, QuantityType.Observer | QuantityType.Metabolite) }; _dataRepository.Add(_newBaseGrid); _dataRepository.Add(_newColumn); _dataRepository.Add(_otherColumn); _simulationResults = A.Fake <SimulationResults>(); A.CallTo(() => _simulationResultsCreator.CreateResultsFrom(_dataRepository)).Returns(_simulationResults); _outputSelection.AddOutput(new QuantitySelection(new[] { "Liver", "Cell", "Drug", "Obs" }.ToPathString(), _newColumn.QuantityInfo.Type)); }
protected override void Context() { base.Context(); var organsim = new Container().WithName(Constants.ORGANISM); var venousBlood = new Container().WithName(CoreConstants.Organ.VENOUS_BLOOD).WithParentContainer(organsim); var peripheralVenousBlood = new Container().WithName(CoreConstants.Organ.PERIPHERAL_VENOUS_BLOOD).WithParentContainer(organsim); var lumen = new Container().WithName(CoreConstants.Organ.LUMEN).WithParentContainer(organsim); var plasma = new Container().WithName(CoreConstants.Compartment.PLASMA); var moleculeVenousBlood = new Container().WithName("DRUG") .WithParentContainer(plasma.WithParentContainer(venousBlood)); var moleculePeripheral = new Container().WithName("DRUG") .WithParentContainer(peripheralVenousBlood); _peripheralVenousBloodObserver = new Observer().WithName(CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD); moleculePeripheral.Add(_peripheralVenousBloodObserver); _venousBloodPlasma = new Observer().WithName(CoreConstants.Observer.CONCENTRATION_IN_CONTAINER); moleculeVenousBlood.Add(_venousBloodPlasma); var moleculeLumen = new Container().WithName("DRUG") .WithParentContainer(lumen); _fabsObserver = new Observer().WithName(CoreConstants.Observer.FABS_ORAL); moleculeLumen.Add(_fabsObserver); var compound = new Compound().WithName("DRUG"); _individualSimulation = new IndividualSimulation(); _individualSimulation.SimulationSettings = new SimulationSettings(); _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("Id", PKSimBuildingBlockType.Compound) { BuildingBlock = compound }); _individualSimulation.Model = new OSPSuite.Core.Domain.Model(); _individualSimulation.Model.Root = new Container(); _individualSimulation.Model.Root.Add(organsim); }
protected override Task Context() { _solverSettingsMapper = A.Fake <SolverSettingsMapper>(); _outputSchemaMapper = A.Fake <OutputSchemaMapper>(); _outputSelectionMapper = A.Fake <OutputSelectionsMapper>(); _parameterMapper = A.Fake <ParameterMapper>(); _compoundPropertiesMapper = A.Fake <CompoundPropertiesMapper>(); _advancedParameterMapper = A.Fake <AdvancedParameterMapper>(); _eventMappingMapper = A.Fake <EventMappingMapper>(); _observerSetMappingMapper = A.Fake <ObserverSetMappingMapper>(); _curveChartMapper = A.Fake <SimulationTimeProfileChartMapper>(); _processMappingMapper = A.Fake <ProcessMappingMapper>(); _simulationFactory = A.Fake <ISimulationFactory>(); _executionContext = A.Fake <IExecutionContext>(); _simulationModelCreator = A.Fake <ISimulationModelCreator>(); _simulationBuildingBlockUpdater = A.Fake <ISimulationBuildingBlockUpdater>(); _modelPropertiesTask = A.Fake <IModelPropertiesTask>(); _simulationRunner = A.Fake <ISimulationRunner>(); _populationAnalysisChartMapper = A.Fake <PopulationAnalysisChartMapper>(); _simulationParameterOriginIdUpdater = A.Fake <ISimulationParameterOriginIdUpdater>(); _logger = A.Fake <ILogger>(); _containerTask = A.Fake <IContainerTask>(); _entityPathResolver = A.Fake <IEntityPathResolver>(); sut = new SimulationMapper(_solverSettingsMapper, _outputSchemaMapper, _outputSelectionMapper, _compoundPropertiesMapper, _parameterMapper, _advancedParameterMapper, _eventMappingMapper, _observerSetMappingMapper, _curveChartMapper, _populationAnalysisChartMapper, _processMappingMapper, _simulationFactory, _executionContext, _simulationModelCreator, _simulationBuildingBlockUpdater, _modelPropertiesTask, _simulationRunner, _simulationParameterOriginIdUpdater, _logger, _containerTask, _entityPathResolver ); _project = new PKSimProject(); _individual = new Individual { Name = "IND", Id = "IND" }; _compound = new Compound { Name = "COMP", Id = "COMP" }; _observerSet = new ObserverSet { Name = "OBS_SET", Id = "OBS_SET" }; _protocol = new SimpleProtocol { Name = "PROT", Id = "PROT" }; _inductionProcess = new InductionProcess().WithName("Interaction process"); _compound.AddProcess(_inductionProcess); _event = new PKSimEvent { Name = "Event" }; _population = new RandomPopulation() { Name = "POP" }; _observedData = new DataRepository("OBS_ID").WithName("OBS"); _project.AddBuildingBlock(_individual); _project.AddBuildingBlock(_compound); _project.AddBuildingBlock(_event); _project.AddBuildingBlock(_population); _project.AddBuildingBlock(_observerSet); _project.AddObservedData(_observedData); _simulationProperties = new SimulationProperties { ModelProperties = new ModelProperties { ModelConfiguration = new ModelConfiguration { ModelName = "4Comp" } } }; _interactionSelection = new InteractionSelection { ProcessName = _inductionProcess.Name }; _noInteractionSelection = new InteractionSelection { MoleculeName = "CYP2D6" }; _simulationProperties.InteractionProperties.AddInteraction(_interactionSelection); _simulationProperties.InteractionProperties.AddInteraction(_noInteractionSelection); _settings = new SimulationSettings(); _rootContainer = new Container().WithName("Sim"); _model = new OSPSuite.Core.Domain.Model { Root = _rootContainer }; _individualSimulation = new IndividualSimulation { Name = "S1", Properties = _simulationProperties, SimulationSettings = _settings, Description = "Simulation Description", Model = _model }; _simulationTimeProfile = new SimulationTimeProfileChart(); _snapshotSimulationTimeProfile = new CurveChart(); _individualSimulation.AddAnalysis(_simulationTimeProfile); A.CallTo(() => _curveChartMapper.MapToSnapshot(_simulationTimeProfile)).Returns(_snapshotSimulationTimeProfile); _populationSimulation = new PopulationSimulation { Properties = _simulationProperties, SimulationSettings = _settings, Model = _model }; _advancedParameterCollection = new AdvancedParameterCollection(); _populationSimulationAnalysisChart = new BoxWhiskerAnalysisChart(); _populationSimulation.SetAdvancedParameters(_advancedParameterCollection); _populationSimulation.AddAnalysis(_populationSimulationAnalysisChart); _populationSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndTemplateId", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _snapshotPopulationAnalysisChart = new Snapshots.PopulationAnalysisChart(); A.CallTo(() => _populationAnalysisChartMapper.MapToSnapshot(_populationSimulationAnalysisChart)).Returns(_snapshotPopulationAnalysisChart); _snapshotInteraction = new CompoundProcessSelection(); A.CallTo(() => _processMappingMapper.MapToSnapshot(_interactionSelection)).Returns(_snapshotInteraction); _snapshotInteraction.CompoundName = _compound.Name; _snapshotInteraction.Name = _inductionProcess.Name; _noSelectionSnapshotInteraction = new CompoundProcessSelection(); A.CallTo(() => _processMappingMapper.MapToSnapshot(_noInteractionSelection)).Returns(_noSelectionSnapshotInteraction); _noSelectionSnapshotInteraction.MoleculeName = _noInteractionSelection.MoleculeName; _compoundProperties = new CompoundProperties(); _snapshotCompoundProperties = new Snapshots.CompoundProperties { Name = _compound.Name }; _individualSimulation.Properties.AddCompoundProperties(_compoundProperties); _eventMapping = new EventMapping(); _individualSimulation.EventProperties.AddEventMapping(_eventMapping); _observerSetMapping = new ObserverSetMapping(); _individualSimulation.ObserverSetProperties.AddObserverSetMapping(_observerSetMapping); A.CallTo(() => _compoundPropertiesMapper.MapToSnapshot(_compoundProperties, _project)).Returns(_snapshotCompoundProperties); _eventSelection = new EventSelection { Name = _event.Name, }; _observerSetSelection = new ObserverSetSelection { Name = _observerSet.Name, }; _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndTemplateId", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual, Altered = true }); _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompTemplateId", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("ProtTemplateId", PKSimBuildingBlockType.Protocol) { BuildingBlock = _protocol }); _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("ObserveSetTemplateId", PKSimBuildingBlockType.ObserverSet) { BuildingBlock = _observerSet }); _populationSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("PopTemplateId", PKSimBuildingBlockType.Population) { BuildingBlock = _population }); _individualSimulation.AddUsedObservedData(_observedData); A.CallTo(() => _eventMappingMapper.MapToSnapshot(_eventMapping, _project)).Returns(_eventSelection); A.CallTo(() => _observerSetMappingMapper.MapToSnapshot(_observerSetMapping, _project)).Returns(_observerSetSelection); _outputSelectionSnapshot = new OutputSelections(); A.CallTo(() => _outputSelectionMapper.MapToSnapshot(_individualSimulation.OutputSelections)).Returns(_outputSelectionSnapshot); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotInteraction, _inductionProcess)).Returns(_interactionSelection); return(_completed); }
protected override void Context() { _vssCalculator = A.Fake <IVSSCalculator>(); _parameterFactory = A.Fake <IParameterFactory>(); _protocolMapper = A.Fake <IProtocolToSchemaItemsMapper>(); _protocolFactory = A.Fake <IProtocolFactory>(); _globalPKAnalysisRunner = A.Fake <IGlobalPKAnalysisRunner>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _pkAnalysisTask = A.Fake <IPKAnalysesTask>(); _interactionTask = A.Fake <IInteractionTask>(); _cloner = A.Fake <ICloner>(); sut = new GlobalPKAnalysisTask(_parameterFactory, _protocolMapper, _protocolFactory, _globalPKAnalysisRunner, _pkAnalysisTask, _pkCalculationOptionsFactory, _vssCalculator, _interactionTask, _cloner); var baseGrid = new BaseGrid("time", A.Fake <IDimension>()); _peripheralVenousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.PeripheralVenousBlood, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, _compoundName); _venousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.VenousBlood, CoreConstants.Compartment.Plasma, CoreConstants.Observer.CONCENTRATION_IN_CONTAINER, _compoundName); _individual = A.Fake <Individual>(); _species = new Species(); A.CallTo(() => _individual.Species).Returns(_species); _compound = new Compound().WithName(_compoundName); _compoundProperties = new CompoundProperties { Compound = _compound }; _simulationSchemaItems = new List <SchemaItem>(); _protocol = new SimpleProtocol(); _compoundProperties.ProtocolProperties.Protocol = _protocol; A.CallTo(() => _protocolMapper.MapFrom(_protocol)).Returns(_simulationSchemaItems); _simulation = new IndividualSimulation { Properties = new SimulationProperties() }; _simulation.Properties.AddCompoundProperties(_compoundProperties); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompId", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndividualId", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.DataRepository = new DataRepository { _venousBloodPlasma, _peripheralVenousBloodPlasma }; _venousBloodPK = new PKValues(); _venousBloodPK.AddValue(Constants.PKParameters.Vss, 10); _venousBloodPK.AddValue(Constants.PKParameters.Vd, 11); _venousBloodPK.AddValue(Constants.PKParameters.CL, 12); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 13); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 14); _peripheralVenousBloodPK = new PKValues(); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vss, 21); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vd, 22); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.CL, 23); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 24); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 25); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max, 26); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max_tDLast_tDEnd, 27); A.CallTo(() => _pkAnalysisTask.CalculatePK(_venousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_venousBloodPK); A.CallTo(() => _pkAnalysisTask.CalculatePK(_peripheralVenousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_peripheralVenousBloodPK); A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation)) .ReturnsLazily(s => new PKSimParameter().WithName((string)s.Arguments[0]) .WithDimension(A.Fake <IDimension>()) .WithFormula(new ConstantFormula((double)s.Arguments[1]))); }
protected override void Context() { _vssCalculator = A.Fake <IVSSCalculator>(); _parameterFactory = A.Fake <IParameterFactory>(); _protocolMapper = A.Fake <IProtocolToSchemaItemsMapper>(); _protocolFactory = A.Fake <IProtocolFactory>(); _globalPKAnalysisRunner = A.Fake <IGlobalPKAnalysisRunner>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _pkAnalysisTask = A.Fake <IPKAnalysesTask>(); _interactionTask = A.Fake <IInteractionTask>(); _cloner = A.Fake <ICloner>(); sut = new GlobalPKAnalysisTask(_parameterFactory, _protocolMapper, _protocolFactory, _globalPKAnalysisRunner, _pkAnalysisTask, _pkCalculationOptionsFactory, _vssCalculator, _interactionTask, _cloner); var baseGrid = new BaseGrid("time", A.Fake <IDimension>()); _peripheralVenousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, _compoundName); _venousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.VENOUS_BLOOD, CoreConstants.Compartment.PLASMA, CoreConstants.Observer.CONCENTRATION_IN_CONTAINER, _compoundName); _individual = A.Fake <Individual>(); _species = new Species(); A.CallTo(() => _individual.Species).Returns(_species); _compound = new Compound().WithName(_compoundName); _compoundProperties = new CompoundProperties { Compound = _compound }; _protocol = new SimpleProtocol(); _compoundProperties.ProtocolProperties.Protocol = _protocol; _simulation = new IndividualSimulation { Properties = new SimulationProperties() }; _simulation.Properties.AddCompoundProperties(_compoundProperties); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompId", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndividualId", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.DataRepository = new DataRepository { _venousBloodPlasma, _peripheralVenousBloodPlasma }; _simulation.SimulationSettings = new SimulationSettings(); _simulation.OutputSchema = new OutputSchema(); _simulation.OutputSchema.AddInterval(new OutputInterval { DomainHelperForSpecs.ConstantParameterWithValue(100).WithName(Constants.Parameters.END_TIME) }); _simulation.Model = new OSPSuite.Core.Domain.Model { Root = new Container() }; _eventGroup = new EventGroup(); _application1 = new Container().WithName("App1").WithContainerType(ContainerType.Application); _application1.Add(new MoleculeAmount().WithName(_compoundName)); _application1.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.START_TIME)); _application2 = new Container().WithName("App2").WithContainerType(ContainerType.Application); _application2.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.START_TIME)); _application2.Add(new MoleculeAmount().WithName(_compoundName)); _simulation.Model.Root.Add(_eventGroup); _eventGroup.Add(_application1); _venousBloodPK = new PKValues(); _venousBloodPK.AddValue(Constants.PKParameters.Vss, 10); _venousBloodPK.AddValue(Constants.PKParameters.Vd, 11); _venousBloodPK.AddValue(Constants.PKParameters.CL, 12); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 13); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 14); _peripheralVenousBloodPK = new PKValues(); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vss, 21); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vd, 22); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.CL, 23); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 24); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 25); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max, 26); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max_tDLast_tDEnd, 27); A.CallTo(() => _pkAnalysisTask.CalculatePK(_venousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_venousBloodPK); A.CallTo(() => _pkAnalysisTask.CalculatePK(_peripheralVenousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_peripheralVenousBloodPK); A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation)) .ReturnsLazily(s => new PKSimParameter().WithName((string)s.Arguments[0]) .WithDimension(A.Fake <IDimension>()) .WithFormula(new ConstantFormula((double)s.Arguments[1]))); }