public virtual void EditProcessesIn(Simulation simulation, CompoundProperties compoundProperties)
        {
            _simulation                  = simulation;
            _compound                    = compoundProperties.Compound;
            _compoundProperties          = compoundProperties;
            _notSelectedSystemicProcess  = new NotSelectedSystemicProcess();
            _notAvailableSystemicProcess = new NotAvailableSystemicProcess();

            _allPartialProcesses = _compound.AllProcesses <TPartialProcess>();

            var partialProcessSelection = ProcessSelectionGroup().AllPartialProcesses();

            _selectedProcesses = _partialProcessRetriever.AllFor <TMolecule, TPartialProcess>(simulation, _compound, partialProcessSelection, addDefaultPartialProcess: true);

            _allPartialProcessesDTO = MapPartialProcesses(_selectedProcesses).ToList();

            createSystemicProcessesFor(simulation);

            _view.BindToPartialProcesses(_allPartialProcessesDTO);
            _view.BindToSystemicProcesses(_allSystemicProcessesDTO);

            ValidateProcessSelection();


            //this needs to be done after binding to the processes, since binding affects the height of the view
            _view.AdjustHeight();
        }
        protected override void Context()
        {
            base.Context();
            _updateTableFormulaCommand        = A.Fake <ICommand>();
            _editedTableFormula               = new TableFormula();
            _editSolubilityParameterPresenter = A.Fake <IEditTableSolubilityParameterPresenter>();
            _parameter = DomainHelperForSpecs.ConstantParameterWithValue().WithName("SOL");
            A.CallTo(() => _applicationController.Start <IEditTableSolubilityParameterPresenter>()).Returns(_editSolubilityParameterPresenter);

            A.CallTo(() => _editSolubilityParameterPresenter.Edit(_parameter)).Returns(true);
            A.CallTo(() => _editSolubilityParameterPresenter.EditedFormula).Returns(_editedTableFormula);

            A.CallTo(() => _parameterTask.UpdateTableFormula(_parameter, _editedTableFormula)).Returns(_updateTableFormulaCommand);


            var solGroup = new ParameterAlternativeGroup().WithName(CoreConstants.Groups.COMPOUND_SOLUBILITY);

            _alternative = new ParameterAlternative().WithName("ALT1");
            _alternative.Add(_parameter);
            solGroup.AddAlternative(_alternative);
            var simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };

            A.CallTo(() => _buildingBlockRepository.All <Simulation>()).Returns(new[] { simulation });

            var compoundProperties = new CompoundProperties();

            simulation.Properties.AddCompoundProperties(compoundProperties);
            compoundProperties.AddCompoundGroupSelection(new CompoundGroupSelection {
                AlternativeName = _alternative.Name, GroupName = solGroup.Name
            });
        }
示例#3
0
 public void EditSimulation(Simulation simulation, Compound compound)
 {
     _simulation         = simulation;
     _compound           = compound;
     _compoundProperties = _simulation.CompoundPropertiesFor(_compound);
     updateActiveCompound();
 }
 protected override void Context()
 {
     base.Context();
     _compoundProperties = new CompoundProperties {
         Compound = new Compound().WithName(_compound1.Name)
     };
     _simulation.Properties.AddCompoundProperties(_compoundProperties);
 }
示例#5
0
 protected override void Context()
 {
     base.Context();
     _compoundProperties = new CompoundProperties {
         Compound = A.Fake <Compound>()
     };
     _simulation.Properties.AddCompoundProperties(_compoundProperties);
 }
 public override void EditProcessesIn(Simulation simulation, CompoundProperties compoundProperties)
 {
     base.EditProcessesIn(simulation, compoundProperties);
     if (simulation.Compounds.Count <= 1)
     {
         enzymaticProcessView.HideMetaboliteColumn();
     }
 }
        protected override void Context()
        {
            base.Context();
            _interactionProperties = new InteractionProperties();
            var inhibitionProcess = new InhibitionProcess().WithName("Proc");

            _compound.AddProcess(inhibitionProcess);
            _compoundProperties = new CompoundProperties();
        }
示例#8
0
        public override void EditProcessesIn(Simulation simulation, CompoundProperties compoundProperties)
        {
            base.EditProcessesIn(simulation, compoundProperties);
            if (simulation.Compounds.Count > 1)
            {
                return;
            }

            enzymaticProcessView.HideMultipleCompoundsColumns();
        }
 protected override void Context()
 {
     base.Context();
     _protocolProperties = new ProtocolProperties();
     _simulation.RemoveUsedBuildingBlock(_compound2);
     _compoundProperties = new CompoundProperties {
         Compound = new Compound().WithName(_compound2.Name), ProtocolProperties = _protocolProperties
     };
     _simulation.Properties.AddCompoundProperties(_compoundProperties);
 }
        private void updateUsedProtocol(CompoundProperties compoundProperties, IEnumerable <Protocol> allExistingProtocols)
        {
            if (!compoundProperties.IsAdministered)
            {
                return;
            }

            var protocolProperties = compoundProperties.ProtocolProperties;

            protocolProperties.Protocol = allExistingProtocols.FindByName(protocolProperties.Protocol.Name);
        }
示例#11
0
        private void moveMoleculeCalculationMethod(ModelProperties modelProperties, CompoundProperties compoundProperties, string category)
        {
            var cm = modelProperties.CalculationMethodFor(category);

            if (cm == null)
            {
                return;
            }
            modelProperties.RemoveCalculationMethod(cm);
            compoundProperties.AddCalculationMethod(cm);
        }
 protected override void Context()
 {
     base.Context();
     _interactionProperties = new InteractionProperties();
     _compoundProperties    = new CompoundProperties();
     _compoundProperties.AddCompoundGroupSelection(new CompoundGroupSelection {
         AlternativeName = _alternativeLipo1.Name, GroupName = CoreConstants.Groups.COMPOUND_LIPOPHILICITY
     });
     _compoundProperties.AddCompoundGroupSelection(new CompoundGroupSelection {
         AlternativeName = _alternativePerm2.Name, GroupName = CoreConstants.Groups.COMPOUND_PERMEABILITY
     });
 }
示例#13
0
        protected override void Context()
        {
            base.Context();
            _templateSimulation                 = new IndividualSimulation();
            _templateSimulation.Properties      = new SimulationProperties();
            _templateSimulation.ModelProperties = new ModelProperties();
            _templateSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("templateId3", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = new Individual()
            });

            var theCompound = new Compound {
                Name = "theCompound"
            };

            _originalCalculationMethod = new CalculationMethod();

            var usedBuildingBlock = new UsedBuildingBlock("templateID", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = theCompound
            };

            var theOtherCompound = new Compound {
                Name = "theOtherCompound"
            };
            var anotherUsedBuildingBlock = new UsedBuildingBlock("templateID2", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = theOtherCompound
            };

            _templateSimulation.AddUsedBuildingBlock(usedBuildingBlock);
            _templateSimulation.AddUsedBuildingBlock(anotherUsedBuildingBlock);
            _replacementCalculationMethod = new CalculationMethod();
            _newCalculationMethods        = new List <CalculationMethodWithCompoundName> {
                new CalculationMethodWithCompoundName(_replacementCalculationMethod, "theCompound")
            };

            var compoundProperties = new CompoundProperties {
                Compound = theCompound
            };

            compoundProperties.CalculationMethodCache.AddCalculationMethod(_originalCalculationMethod);
            _templateSimulation.Properties.AddCompoundProperties(compoundProperties);
            compoundProperties = new CompoundProperties {
                Compound = theOtherCompound
            };
            compoundProperties.CalculationMethodCache.AddCalculationMethod(_originalCalculationMethod);
            _templateSimulation.Properties.AddCompoundProperties(compoundProperties);

            A.CallTo(() => _cloner.Clone(_templateSimulation)).Returns(_templateSimulation);
            A.CallTo(() => _objectBaseFactory.Create <IndividualSimulation>()).ReturnsLazily(() => new IndividualSimulation());
        }
示例#14
0
        protected override void Context()
        {
            base.Context();
            _simulation         = A.Fake <Simulation>();
            _selectedProtocol   = A.Fake <Protocol>();
            _compound           = A.Fake <Compound>();
            _protocolProperties = A.Fake <ProtocolProperties>();
            var compoundProperties = new CompoundProperties {
                ProtocolProperties = _protocolProperties
            };

            A.CallTo(() => _simulation.CompoundPropertiesFor(_compound)).Returns(compoundProperties);
            sut.EditSimulation(_simulation, _compound);
        }
 protected override void Context()
 {
     base.Context();
     _compound      = new Compound().WithName("TOTO");
     sut.Properties = new SimulationProperties();
     sut.AddUsedBuildingBlock(new UsedBuildingBlock("compound", PKSimBuildingBlockType.Compound)
     {
         BuildingBlock = _compound
     });
     _compoundProperties = new CompoundProperties {
         Compound = _compound
     };
     sut.Properties.AddCompoundProperties(_compoundProperties);
 }
示例#16
0
        protected override void Context()
        {
            base.Context();
            _simulation         = A.Fake <Simulation>();
            _simulationProtocol = A.Fake <Protocol>();
            _compound           = A.Fake <Compound>();
            _templateProtocol   = A.Fake <Protocol>();
            var compoundProperties = new CompoundProperties {
                ProtocolProperties = { Protocol = _simulationProtocol }
            };

            A.CallTo(() => _simulation.CompoundPropertiesFor(_compound)).Returns(compoundProperties);
            A.CallTo(() => _buildingBlockInSimulationManager.TemplateBuildingBlockUsedBy(_simulation, _simulationProtocol)).Returns(_templateProtocol);
        }
        protected override void Context()
        {
            base.Context();
            _interactionProperties = new InteractionProperties();
            var inhibitionProcess = new InhibitionProcess {
                InteractionType = InteractionType.CompetitiveInhibition
            }.WithName("Proc");
            var interaction = new InteractionSelection {
                CompoundName = _compound.Name, ProcessName = inhibitionProcess.Name
            };

            _compound.AddProcess(inhibitionProcess);
            _interactionProperties.AddInteraction(interaction);
            _compoundProperties = new CompoundProperties();
        }
        protected override void Context()
        {
            _view = A.Fake <ISimulationCompoundCalculationMethodSelectionView>();
            _calculationMethodSelectionPresenter = A.Fake <ICalculationMethodSelectionPresenterForSimulation>();

            sut = new SimulationCompoundCalculationMethodSelectionPresenter(_view, _calculationMethodSelectionPresenter);

            _compound   = new Compound();
            _simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };
            _compoundProperties = new CompoundProperties {
                Compound = _compound
            };
            _simulation.Properties.AddCompoundProperties(_compoundProperties);
        }
示例#19
0
        public IMoleculeBuilder Create(Compound compound, CompoundProperties compoundProperties, InteractionProperties interactionProperties, IFormulaCache formulaCache)
        {
            var drug = Create(QuantityType.Drug, formulaCache).WithName(compound.Name);

            //first update all parameters defined in the molecule that are also in the compound and that DO NOT belong in one alternative
            _parameterSetUpdater.UpdateValuesByName(allSimpleParametersFrom(compound), drug.AllParameters());

            //once simple parameters have been set, set the alternative parameters
            updateAlternativeParameters(compound, compoundProperties, drug, formulaCache);

            //add interaction parameters
            addInteractionParameters(compound, drug, interactionProperties);

            _parameterIdUpdater.UpdateBuildingBlockId(drug.GetAllChildren <IParameter>(), compound);
            return(drug);
        }
示例#20
0
        protected override void Context()
        {
            base.Context();
            _compound           = new Compound().WithId("Drug").WithName("Drug");
            _originalSimulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };

            _clonedSimulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };
            _clonedSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("Compound", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _compound
            });
            _clonedSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("Individual", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = _individual
            });
            var compoundProperties = new CompoundProperties {
                Compound = _compound
            };

            A.CallTo(() => _cloner.Clone(_originalSimulation)).Returns(_clonedSimulation);
            _clonedSimulation.Properties.AddCompoundProperties(compoundProperties);

            _originalProtocol = new SimpleProtocol().WithName("Original").WithId("Original");
            compoundProperties.ProtocolProperties.Protocol = _originalProtocol;

            _ivProtocol = new SimpleProtocol().WithName("Iv").WithId("IV");

            var pkSimulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };

            pkSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("Compound", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _compound
            });
            A.CallTo(() => _objectBaseFactory.Create <IndividualSimulation>()).Returns(pkSimulation);
            A.CallTo(() => _simulationBuildingBlockUpdater.UpdateMultipleUsedBuildingBlockInSimulationFromTemplate(A <Simulation> ._,
                                                                                                                   A <IEnumerable <IPKSimBuildingBlock> > ._, PKSimBuildingBlockType.Protocol))
            .Invokes(x => x.GetArgument <Simulation>(0).AddUsedBuildingBlock(new UsedBuildingBlock("Protocol", PKSimBuildingBlockType.Protocol)
            {
                BuildingBlock = _ivProtocol
            }));
        }
示例#21
0
        private void addMoleculeToBuildingBlock(IMoleculeBuilder moleculeBuilder, CompoundProperties compoundProperties)
        {
            if (_allMoleculeNames.Contains(moleculeBuilder.Name))
            {
                throw new TwoMoleculesWithSameNameException(moleculeBuilder.Name);
            }

            _allMoleculeNames.Add(moleculeBuilder.Name);

            //set the used calculation method according to current settings
            if (compoundProperties != null)
            {
                _moleculeCalculationRetriever.AllMoleculeCalculationMethodsUsedBy(compoundProperties).Each(moleculeBuilder.AddUsedCalculationMethod);
            }

            _moleculeBuildingBlock.Add(moleculeBuilder);
        }
        protected override void Context()
        {
            base.Context();
            _sourceSimulation  = new IndividualSimulation();
            _cloneDiagramModel = A.Fake <IDiagramModel>();
            _sourceSimulation.ReactionDiagramModel = A.Fake <IDiagramModel>();
            A.CallTo(() => _sourceSimulation.ReactionDiagramModel.CreateCopy(null)).Returns(_cloneDiagramModel);
            _sourceSimulation.DataRepository = A.Fake <DataRepository>();
            _sourceSimulation.Properties     = new SimulationProperties();
            _sourceCompound1           = new Compound().WithId("SourceComp1");
            _sourceCompound2           = new Compound().WithId("SourceComp2");
            _cloneCompound1            = new Compound().WithId("CloneComp1");
            _cloneCompound2            = new Compound().WithId("CloneComp2");
            _sourceProtocol            = new SimpleProtocol().WithId("SourceProtocol");
            _cloneProtocol             = new SimpleProtocol().WithId("CloneProtocol");
            _sourceCompoundProperties1 = new CompoundProperties {
                Compound = _sourceCompound1
            };
            _sourceCompoundProperties2 = new CompoundProperties {
                Compound = _sourceCompound2
            };


            _sourceSimulation.Properties.AddCompoundProperties(_sourceCompoundProperties1);
            _sourceSimulation.Properties.AddCompoundProperties(_sourceCompoundProperties2);
            _sourceSimulation.Model = A.Fake <IModel>();

            _sourceSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompoundTemplate1", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _sourceCompound1
            });
            _sourceSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompoundTemplate2", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _sourceCompound2
            });
            _sourceSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("ProtocolTemplate", PKSimBuildingBlockType.Protocol)
            {
                BuildingBlock = _sourceProtocol
            });

            A.CallTo(() => _cloneManager.Clone((IPKSimBuildingBlock)_sourceCompound1)).Returns(_cloneCompound1);
            A.CallTo(() => _cloneManager.Clone((IPKSimBuildingBlock)_sourceCompound2)).Returns(_cloneCompound2);
            A.CallTo(() => _cloneManager.Clone((IPKSimBuildingBlock)_sourceProtocol)).Returns(_cloneProtocol);

            _sourceCompoundProperties1.ProtocolProperties.Protocol = _sourceProtocol;
        }
        protected override void Context()
        {
            _partialProcessRetriever = A.Fake <IPartialProcessRetriever>();
            _view = A.Fake <ISimulationCompoundProcessView <TransportPartialProcess, SimulationPartialProcessSelectionDTO> >();
            _selectedSimulationPrtialProcess = new List <SimulationPartialProcess>();
            _compound   = new Compound();
            _simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };
            _compoundProperties = new CompoundProperties {
                Compound = _compound
            };
            _simulation.Properties.AddCompoundProperties(_compoundProperties);
            A.CallTo(_partialProcessRetriever).WithReturnType <IEnumerable <SimulationPartialProcess> >().Returns(_selectedSimulationPrtialProcess);

            sut = new SimulationCompoundTransportAndExcretionPresenter(_view, _partialProcessRetriever);
        }
 protected override void Context()
 {
     base.Context();
     _protocolUsedInSimulation = new SimpleProtocol().WithName("P");
     _templateProtocol         = new SimpleProtocol().WithName("P");
     _simulation = new IndividualSimulation {
         Properties = new SimulationProperties()
     };
     _usedBuildingBlockProtocol = new UsedBuildingBlock("template", PKSimBuildingBlockType.Protocol)
     {
         BuildingBlock = _protocolUsedInSimulation
     };
     _compoundProperties = new CompoundProperties {
         ProtocolProperties = { Protocol = _templateProtocol }
     };
     _simulation.Properties.AddCompoundProperties(_compoundProperties);
     A.CallTo(() => _buildingBlockMapper.MapFrom(_templateProtocol, null)).Returns(_usedBuildingBlockProtocol);
 }
示例#25
0
        private void addMetabolismProcess(IMoleculeBuilder compoundBuilder, IReactionMapping compoundReactionMapping,
                                          CompoundProperties compoundProperties)
        {
            var compound = compoundProperties.Compound;
            var process  = compound.ProcessByName(compoundReactionMapping.ProcessName);

            if (process == null)
            {
                return;
            }

            var metabolite = getOrCreateMetaboliteFor(compoundReactionMapping, compoundProperties);
            var reaction   = _processBuilderMapper.MetabolismReactionFrom(process, compoundBuilder, metabolite, compoundReactionMapping.MoleculeName,
                                                                          _allMoleculeNames, _reactionBuildingBlock.FormulaCache);

            _interactionKineticUpdater.UpdateReaction(reaction, compoundReactionMapping.MoleculeName, compound.Name, _simulation,
                                                      _reactionBuildingBlock.FormulaCache);
            addReactionToBuildingBlock(reaction, compound);
        }
示例#26
0
        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 formulation = new Formulation().WithName("F");

            _simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };
            var formulationUsedInSimulation = new Formulation().WithName("F");
            var compoundProperties          = new CompoundProperties();

            compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping {
                Formulation = formulation
            });
            compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping {
                Formulation = formulationUsedInSimulation
            });
            _simulation.Properties.AddCompoundProperties(compoundProperties);
        }
        protected override void Context()
        {
            _view = A.Fake <ISimulationCompoundEnzymaticProcessView>();
            _partialProcessRetriever = A.Fake <IPartialProcessRetriever>();
            _compound   = new Compound();
            _simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };
            _compoundProperties = new CompoundProperties {
                Compound = _compound
            };
            _simulation.Properties.AddCompoundProperties(_compoundProperties);
            _allEnzymes        = new List <IndividualEnzyme>();
            _processesCompound = new List <EnzymaticProcess>();
            _partialProcesses  = new List <SimulationPartialProcess>();

            A.CallTo(_partialProcessRetriever).WithReturnType <IReadOnlyList <SimulationPartialProcess> >().Returns(_partialProcesses);

            sut = new SimulationCompoundEnzymaticProcessPresenter(_view, _partialProcessRetriever);
        }
        protected override void Context()
        {
            _view                            = A.Fake <ISimulationCompoundProtocolFormulationView>();
            _formulationTask                 = A.Fake <IFormulationTask>();
            _formulationMappingMapper        = A.Fake <IFormulationMappingDTOToFormulationMappingMapper>();
            _formulationFromMappingRetriever = A.Fake <IFormulationFromMappingRetriever>();
            _formulation1                    = new Formulation();
            _formulation2                    = new Formulation();
            _protocol                        = A.Fake <Protocol>();
            _compound                        = A.Fake <Compound>();
            _simulation                      = A.Fake <Simulation>();
            _protocolProperties              = A.Fake <ProtocolProperties>();
            var compoundProperties = new CompoundProperties();

            A.CallTo(() => _simulation.CompoundPropertiesFor(_compound)).Returns(compoundProperties);
            compoundProperties.ProtocolProperties = _protocolProperties;
            _protocolProperties.Protocol          = _protocol;
            A.CallTo(() => _formulationTask.All()).Returns(new[] { _formulation1, _formulation2 });
            _buildingBlockSelectionDisplayer = A.Fake <IBuildingBlockSelectionDisplayer>();
            sut = new SimulationCompoundProtocolFormulationPresenter(_view, _formulationTask, _formulationMappingMapper, _formulationFromMappingRetriever, _buildingBlockSelectionDisplayer);
        }
        protected override void Context()
        {
            base.Context();
            _compoundProperties = A.Fake <CompoundProperties>();
            var alternative1 = A.Fake <ParameterAlternative>();
            var alternative2 = A.Fake <ParameterAlternative>();
            var compoundParameterSelection1 = new CompoundParameterSelectionDTO(A.Fake <ParameterAlternativeGroup>());

            compoundParameterSelection1.SelectedAlternative = alternative1;
            var compoundParameterSelection2 = new CompoundParameterSelectionDTO(A.Fake <ParameterAlternativeGroup>());

            compoundParameterSelection2.SelectedAlternative = alternative2;
            var simulationCompoundMappingDTO = new SimulationCompoundParameterMappingDTO();

            simulationCompoundMappingDTO.Add(compoundParameterSelection1);
            simulationCompoundMappingDTO.Add(compoundParameterSelection2);
            A.CallTo(() => _mapper.MapFrom(_simulation, _compound)).Returns(simulationCompoundMappingDTO);

            A.CallTo(() => _simulation.CompoundPropertiesFor(_compound)).Returns(_compoundProperties);
            sut.EditSimulation(_simulation, _compound);
        }