protected override void Context() { base.Context(); _templateMoleculeStartValues = new MoleculeStartValuesBuildingBlock(); A.CallTo(_context.Context.ObjectRepository).WithReturnType <bool>().Returns(true); var moleculeBuildingBlock = new MoleculeBuildingBlock(); A.CallTo(_context.Context).WithReturnType <IMoleculeBuildingBlock>().Returns(moleculeBuildingBlock); var spatialStructure = new SpatialStructure(); A.CallTo(_context.Context).WithReturnType <ISpatialStructure>().Returns(spatialStructure); A.CallTo(() => _moleculeStartValuesCreator.CreateFrom(spatialStructure, moleculeBuildingBlock)).Returns(_templateMoleculeStartValues); _newEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Plasma"), Name = "M", IsPresent = true }; _existingEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true }; _existingTemplateEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true }; _templateMoleculeStartValues.Add(_newEndogenousValue); _templateMoleculeStartValues.Add(_existingTemplateEndogenousValue); _moleculeStartValueBuildingBlock.Add(_existingEndogenousValue); }
protected override void Context() { base.Context(); _context = A.Fake <IMoBiContext>(); A.CallTo(() => _context.HistoryManager).Returns(A.Fake <IMoBiHistoryManager>()); _startValuesTask = A.Fake <IMoleculeStartValuesTask>(); _view = A.Fake <IImportQuantityView>(); _dialogCreator = A.Fake <IDialogCreator>(); _dataTableToImportQuantityDTOMapperForMolecules = A.Fake <IDataTableToImportQuantityDTOMapperForMolecules>(); _buildingBlock = new MoleculeStartValuesBuildingBlock(); _excelTask = A.Fake <IImportFromExcelTask>(); sut = new ImportMoleculeStartValuePresenter(_view, _dialogCreator, _context, _excelTask, _startValuesTask, _dataTableToImportQuantityDTOMapperForMolecules); sut.Initialize(); _quantityImporterDTO = new QuantityImporterDTO(); new List <ImportedQuantityDTO> { new ImportedQuantityDTO { Name = "drug", ContainerPath = new ObjectPath("First") }, new ImportedQuantityDTO { Name = "drug", ContainerPath = new ObjectPath("Second") }, }.Each(_quantityImporterDTO.QuantitDTOs.Add); A.CallTo(() => _dataTableToImportQuantityDTOMapperForMolecules.MapFrom(A <DataTable> ._, _buildingBlock)).Returns(_quantityImporterDTO); A.CallTo(() => _view.Display()).Invokes(() => { sut.StartImport(); sut.TransferImportedQuantities(); }); }
protected override void Context() { base.Context(); _buildConfiguration = A.Fake <IMoBiBuildConfiguration>(); _templateStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock(); _newMoleculeStartValues = new MoleculeStartValuesBuildingBlock(); _buildConfiguration.MoleculeStartValuesInfo = new MoleculeStartValuesBuildingBlockInfo { BuildingBlock = _templateStartValuesBuildingBlock, TemplateBuildingBlock = _templateStartValuesBuildingBlock }; A.CallTo(_moleculeStartValuesCreator).WithReturnType <IMoleculeStartValuesBuildingBlock>().Returns(_newMoleculeStartValues); _newEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Plasma"), Name = "M", IsPresent = true }; _existingEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true }; _otherStartValues = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", "Liver", "Cell"), Name = "M", IsPresent = true }; _existingTemplateEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true }; _templateStartValuesBuildingBlock.Add(_existingTemplateEndogenousValue); _newMoleculeStartValues.Add(_newEndogenousValue); _newMoleculeStartValues.Add(_existingEndogenousValue); _newMoleculeStartValues.Add(_otherStartValues); }
protected override void Context() { _msvCreator = A.Fake <IMoleculeStartValuesCreator>(); A.CallTo(() => _msvCreator.CreateMoleculeStartValue(A <IObjectPath> .Ignored, A <string> .Ignored, A <IDimension> .Ignored, A <Unit> ._, A <ValueOrigin> ._)) .ReturnsLazily((IObjectPath path, string moleculeName, IDimension dimension) => new MoleculeStartValue { ContainerPath = path, Name = moleculeName, Dimension = dimension }); _concentrationDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.MOLAR_CONCENTRATION, "mol/l"); _amountDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.AMOUNT, "mol"); _amountDimension.AddUnit("mmol", 0.001, 0); _timeDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.TIME, "s"); _timeDimension.Unit("s").Factor = 1.0 / 60; _dimensionFactory = A.Fake <IMoBiDimensionFactory>(); _startValuesBuildingBlock = A.Fake <IMoleculeStartValuesBuildingBlock>(); _reactionDimensionRetriever = A.Fake <IReactionDimensionRetriever>(); A.CallTo(() => _dimensionFactory.DimensionForUnit("mol")).Returns(_amountDimension); A.CallTo(() => _dimensionFactory.DimensionForUnit("mmol")).Returns(_amountDimension); A.CallTo(() => _dimensionFactory.DimensionForUnit("mol/l")).Returns(_concentrationDimension); A.CallTo(() => _dimensionFactory.DimensionForUnit("s")).Returns(_timeDimension); A.CallTo(() => _dimensionFactory.DimensionForUnit("")).Throws <Exception>(); A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.AMOUNT)).Returns(_amountDimension); A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION)).Returns(_concentrationDimension); A.CallTo(() => _reactionDimensionRetriever.SelectedDimensionMode).Returns(ReactionDimensionMode.AmountBased); sut = new DataTableToImportQuantityDTOMapperForMolecules(_dimensionFactory, _reactionDimensionRetriever); }
private void CreateMoleculeStartValueBuildingBlock(Model model) { _moleculeStartValuesBuildingBlock = _moleculeStartValuesCreator.CreateFrom(GetMainSpatialStructure(model), MoleculeBuildingBlock) .WithId(SBMLConstants.SBML_MOLECULESTARTVALUES_BB) .WithName(SBMLConstants.SBML_MOLECULESTARTVALUES_BB) .WithDescription(SBMLConstants.SBML_MOLECULESTARTVALUES_DESCRIPTION); }
public void Visit(IMoleculeStartValuesBuildingBlock moleculeStartValuesBuilding) { foreach (var moleculeStartValue in moleculeStartValuesBuilding) { moleculeStartValue.ScaleDivisor = Constants.DEFAULT_SCALE_DIVISOR; updateToAmountDimension(moleculeStartValue); } }
public IEnumerable <IMoleculeBuilder> AllPresentFor(IMoleculeStartValuesBuildingBlock moleculesStartValues) { var moleculeNames = (from moleculeStartValue in moleculesStartValues where moleculeStartValue.IsPresent select moleculeStartValue.MoleculeName).Distinct(); return(moleculeNames.Select(moleculeName => this[moleculeName]).Where(m => m != null)); }
protected override void Context() { base.Context(); _formula = new ExplicitFormula().WithName("F1").WithId("F11"); _templateFormula = new ExplicitFormula().WithName("F1").WithId("F12"); _moleculeStartValues = new MoleculeStartValuesBuildingBlock().WithName("MSV"); _moleculeStartValuesTemplate = new MoleculeStartValuesBuildingBlock().WithName("MSV"); _moleculeStartValuesTemplate.AddFormula(_templateFormula); _allBuildingBlocks.Add(_moleculeStartValuesTemplate); }
protected override void Context() { base.Context(); _msv = new MoleculeStartValue { NegativeValuesAllowed = false }; _moleculeStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock { _msv }; }
private void addMoleculesFrom(IMoleculeStartValuesBuildingBlock moleculesStartValuesBuildingBlock, IEntity container, IEnumerable <IMoleculeBuilder> molecules) { foreach (var molecule in molecules) { var moleculeStartValue = CreateMoleculeStartValue(_objectPathFactory.CreateAbsoluteObjectPath(container), molecule.Name, molecule.Dimension, molecule.DisplayUnit); setMoleculeStartValue(molecule, moleculeStartValue); setMoleculeStartValueFormula(molecule.DefaultStartFormula, moleculeStartValue, moleculesStartValuesBuildingBlock); moleculesStartValuesBuildingBlock.Add(moleculeStartValue); } }
public void TestComplexMoleculeStartValuesBuildingBlock() { MoleculeStartValuesBuildingBlock x1 = _buildConfiguration.MoleculeStartValues as MoleculeStartValuesBuildingBlock; Assert.IsNotNull(x1); IMoleculeStartValuesBuildingBlock x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualMoleculeStartValuesBuildingBlock(x2, x1); }
protected override void Context() { base.Context(); _context = A.Fake <IMoBiContext>(); _buildingBlock = new MoleculeStartValuesBuildingBlock(); _moleculeStartValue = new MoleculeStartValue(); _path = new ObjectPath("A", "B"); _moleculeStartValue.ContainerPath = _path; _moleculeStartValue.Name = "Name"; _buildingBlock.Add(_moleculeStartValue); }
protected override void Context() { base.Context(); _simulation = A.Fake <IMoBiSimulation>(); _templateBuildingBlock = new MoleculeStartValuesBuildingBlock(); _cloneSimulationStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock(); IMoleculeStartValuesBuildingBlock simulationStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock(); A.CallTo(() => _cloneManagerForBuildingBlock.Clone(simulationStartValueBuildingBlock)).Returns(_cloneSimulationStartValueBuildingBlock); A.CallTo(() => _simulation.BuildConfiguration.MoleculeStartValues).Returns(simulationStartValueBuildingBlock); }
protected override void Context() { _startValueBuildingBlock = new MoleculeStartValuesBuildingBlock(); _startValue = new MoleculeStartValue { IsPresent = false }; _startValueBuildingBlock.Add(_startValue); _context = A.Fake <IMoBiContext>(); sut = new UpdateMoleculeStartValueIsPresentCommand(_startValueBuildingBlock, _startValue, true); }
private void setMoleculeStartValues(IMoleculeStartValuesBuildingBlock moleculeStartValues) { var organsim_A = moleculeStartValues[_objectPathFactory.CreateObjectPathFrom(ConstantsForSpecs.Organism, "A")]; organsim_A.StartValue = 5; var lung_B = moleculeStartValues[_objectPathFactory.CreateObjectPathFrom(ConstantsForSpecs.Organism, ConstantsForSpecs.Lung, "B")]; lung_B.Formula = null; lung_B.StartValue = 100; }
protected override void Context() { _moleculeStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock(); _changedMoleculeStartValue = A.Fake <IMoleculeStartValue>(); _newFormula = new ExplicitFormula { Id = "newFormulaId" }; _oldFormula = new ExplicitFormula { Id = "oldFormulaId" }; sut = new ChangeStartValueFormulaCommand <IMoleculeStartValue>(_moleculeStartValuesBuildingBlock, _changedMoleculeStartValue, _newFormula, _oldFormula); }
protected override void Context() { _context = A.Fake <IInteractionTaskContext>(); _editTask = A.Fake <IEditTasksForBuildingBlock <IMoleculeStartValuesBuildingBlock> >(); _moleculeStartValuesCreator = A.Fake <IMoleculeStartValuesCreator>(); _cloneManagerForBuildingBlock = A.Fake <ICloneManagerForBuildingBlock>(); _moleculeStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock(); _reactionDimensionRetriever = A.Fake <IReactionDimensionRetriever>(); _moleculeResolver = A.Fake <IMoleculeResolver>(); sut = new MoleculeStartValuesTask(_context, _editTask, _moleculeStartValuesCreator, new ImportedQuantityToMoleculeStartValueMapper(_moleculeStartValuesCreator), A.Fake <IMoleculeStartValueBuildingBlockMergeManager>(), _cloneManagerForBuildingBlock, _reactionDimensionRetriever, A.Fake <IMoBiFormulaTask>(), A.Fake <IMoBiSpatialStructureFactory>(), new MoleculeStartValuePathTask(A.Fake <IFormulaTask>(), _context.Context), _moleculeResolver); }
protected override void Context() { _fakeDimension = A.Fake <IDimension>(); _context = A.Fake <IMoBiContext>(); _buildingBlock = new MoleculeStartValuesBuildingBlock(); _moleculeStartValue = new MoleculeStartValue { Path = new ObjectPath("path1"), Dimension = _fakeDimension, StartValue = -1, DisplayUnit = new Unit("Dimensionless", 1.0, 1) }; sut = new AddMoleculeStartValueToBuildingBlockCommand(_buildingBlock, _moleculeStartValue); A.CallTo(() => _context.Get <IStartValuesBuildingBlock <IMoleculeStartValue> >(A <string> ._)).Returns(_buildingBlock); }
protected override void Context() { base.Context(); _buildingBlock = new MoleculeStartValuesBuildingBlock(); _project = A.Fake <IMoBiProject>(); _options = new SearchOptions() { CaseSensitive = false, Expression = "*", Scope = SearchScope.AllOfSameType, RegEx = true, WholeWord = true }; A.CallTo(() => _context.CurrentProject).Returns(_project); _otherBuildingBlock = new MoleculeStartValuesBuildingBlock(); A.CallTo(() => _project.MoleculeStartValueBlockCollection).Returns(new [] { _buildingBlock, _otherBuildingBlock }); }
protected override void Context() { _spatialStructureFactory = A.Fake <IPKSimSpatialStructureFactory>(); _modelObserverQuery = A.Fake <IModelObserverQuery>(); _modelPassiveTransportQuery = A.Fake <IModelPassiveTransportQuery>(); _parameterStartValueCreator = A.Fake <IPKSimParameterStartValuesCreator>(); _moleculesAndReactionsCreator = A.Fake <IMoleculesAndReactionsCreator>(); _eventBuildingBlockCreator = A.Fake <IEventBuildingBlockCreator>(); _moleculeStartValueCreator = A.Fake <IPKSimMoleculeStartValuesCreator>(); _moleculeCalculationRetriever = A.Fake <IMoleculeCalculationRetriever>(); _distributedTableConverter = A.Fake <IDistributedParameterToTableParameterConverter>(); _parameterDefaultStateUpdater = A.Fake <IParameterDefaultStateUpdater>(); _cm1 = new CoreCalculationMethod(); _cm2 = new CoreCalculationMethod(); _simulation = new IndividualSimulation { Properties = new SimulationProperties() }; _simulation.SimulationSettings = new SimulationSettings(); _simulation.ModelConfiguration = new ModelConfiguration(); _individual = new Individual().WithName("MyIndividuyal"); _compound = A.Fake <Compound>().WithName("MyCompound"); _protocol = new SimpleProtocol().WithName("MyProtocol"); _spatialStructure = A.Fake <ISpatialStructure>(); _passiveTransportBuilingBlock = A.Fake <IPassiveTransportBuildingBlock>(); _observerBuildingBlock = A.Fake <IObserverBuildingBlock>(); _eventBuildingBlock = A.Fake <IEventGroupBuildingBlock>(); _parameterValuesBuildingBlock = A.Fake <IParameterStartValuesBuildingBlock>(); _moleculeStartValueBuildingBlock = A.Fake <IMoleculeStartValuesBuildingBlock>(); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Individual", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Compound", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Protocol", PKSimBuildingBlockType.Protocol) { BuildingBlock = _protocol }); A.CallTo(() => _moleculeCalculationRetriever.AllMoleculeCalculationMethodsUsedBy(_simulation)).Returns(new[] { _cm1, _cm2 }); A.CallTo(() => _spatialStructureFactory.CreateFor(_individual, _simulation)).Returns(_spatialStructure); A.CallTo(() => _modelPassiveTransportQuery.AllPassiveTransportsFor(_simulation)).Returns(_passiveTransportBuilingBlock); A.CallTo(() => _modelObserverQuery.AllObserversFor(A <IMoleculeBuildingBlock> .Ignored, _simulation)).Returns(_observerBuildingBlock); A.CallTo(() => _eventBuildingBlockCreator.CreateFor(_simulation)).Returns(_eventBuildingBlock); A.CallTo(() => _parameterStartValueCreator.CreateFor(A <IBuildConfiguration> .Ignored, A <Simulation> .Ignored)).Returns(_parameterValuesBuildingBlock); A.CallTo(() => _moleculeStartValueCreator.CreateFor(A <IBuildConfiguration> .Ignored, A <Simulation> .Ignored)).Returns(_moleculeStartValueBuildingBlock); sut = new BuildConfigurationTask(_spatialStructureFactory, _modelObserverQuery, _modelPassiveTransportQuery, _parameterStartValueCreator, _moleculesAndReactionsCreator, _eventBuildingBlockCreator, _moleculeStartValueCreator, _moleculeCalculationRetriever, _distributedTableConverter, _parameterDefaultStateUpdater); }
protected override void Context() { _oldScaleDivisor = 0; _startValue = new MoleculeStartValue { Id = "startValueId" }; _buildingBlock = new MoleculeStartValuesBuildingBlock { Id = "id" }; _context = A.Fake <IMoBiContext>(); sut = new UpdateMoleculeStartValueScaleDivisorCommand(_buildingBlock, _startValue, _newScaleDivisor, _oldScaleDivisor); A.CallTo(() => _context.Get <IMoleculeStartValuesBuildingBlock>(_buildingBlock.Id)).Returns(_buildingBlock); }
protected override void Context() { _fakeDimension = A.Fake <IDimension>(); _context = A.Fake <IMoBiContext>(); _buildingBlock = new MoleculeStartValuesBuildingBlock(); _msv = new MoleculeStartValue { Path = new ObjectPath("path1"), Dimension = _fakeDimension, StartValue = -1, DisplayUnit = new Unit("Dimensionless", 1.0, 1) }; _buildingBlock.Add(_msv); sut = new RemoveMoleculeStartValueFromBuildingBlockCommand(_buildingBlock, _msv.Path); A.CallTo(() => _context.Get <IStartValuesBuildingBlock <IMoleculeStartValue> >(_buildingBlock.Id)).Returns(_buildingBlock); }
protected override void Context() { base.Context(); _moleculeStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock { Name = _changedName }; _moleculeStartValue = new MoleculeStartValue(); _path = new ObjectPath(new[] { "A", "B", _changedName }); _moleculeStartValue.Path = _path; _moleculeStartValuesBuildingBlock.Add(_moleculeStartValue); _project.AddBuildingBlock(_moleculeStartValuesBuildingBlock); _moleculeStartValue2 = new MoleculeStartValue(); _path = new ObjectPath(new[] { "A", _changedName, "B" }); _moleculeStartValue2.Path = _path; _moleculeStartValuesBuildingBlock.Add(_moleculeStartValue2); }
protected override void Context() { _fakeDimension = A.Fake <IDimension>(); _context = A.Fake <IMoBiContext>(); _buildingBlock = new MoleculeStartValuesBuildingBlock(); var msv = new MoleculeStartValue { Path = new ObjectPath("path1"), Dimension = _fakeDimension, StartValue = -1, DisplayUnit = new Unit("Dimensionless", 1.0, 1), IsPresent = false }; _buildingBlock.Add(msv); _path = msv.Path; sut = new UpdateMoleculeStartValueInBuildingBlockCommand(_buildingBlock, _path, 1.0, true, 22.0, true); A.CallTo(() => _context.Get <IMoleculeStartValuesBuildingBlock>(_buildingBlock.Id)).Returns(_buildingBlock); }
protected override void Context() { _context = A.Fake <IMoBiContext>(); _liver = new Container().WithName("LIVER"); _simulation = A.Fake <IMoBiSimulation>(); _simulation.Model.Root = new Container().WithContainerType(ContainerType.Simulation); _simulation.Model.Root.Add(_liver); _moleculeStartValues = new MoleculeStartValuesBuildingBlock(); _simulation.BuildConfiguration.MoleculeStartValues = _moleculeStartValues; sut = new ResetMoleculeValuesToDefaultFromStartValuesInSimulationCommand(_simulation); _formulaTask = A.Fake <IMoBiFormulaTask>(); _entityPathResolver = new EntityPathResolver(new ObjectPathFactory(new AliasCreator())); _cloneManagerForModel = A.Fake <ICloneManagerForModel>(); A.CallTo(_formulaTask).WithReturnType <ConstantFormula>().Returns(new ConstantFormula()); A.CallTo(() => _context.Resolve <IMoBiFormulaTask>()).Returns(_formulaTask); A.CallTo(() => _context.Resolve <IEntityPathResolver>()).Returns(_entityPathResolver); A.CallTo(() => _context.Resolve <ICloneManagerForModel>()).Returns(_cloneManagerForModel); }
protected override void Context() { _view = A.Fake <IMoleculeStartValuesView>(); _mapper = A.Fake <IMoleculeStartValueToMoleculeStartValueDTOMapper>(); _context = A.Fake <IMoBiContext>(); _isPresentSelectionPresenter = A.Fake <IMoleculeIsPresentSelectionPresenter>(); _refreshStartValuesPresenter = A.Fake <IRefreshStartValueFromOriginalBuildingBlockPresenter>(); _negativeStartValuesAllowedSelectionPresenter = A.Fake <IMoleculeNegativeValuesAllowedSelectionPresenter>(); _moleculeStartValueTask = A.Fake <IMoleculeStartValuesTask>(); _commandCollector = A.Fake <ICommandCollector>(); _deleteStartValuePresenter = A.Fake <IDeleteStartValuePresenter>(); _legendPresenter = A.Fake <ILegendPresenter>(); _moleculeStartValuesCreator = A.Fake <IMoleculeStartValuesCreator>(); sut = new MoleculeStartValuesPresenter( _view, _mapper, _isPresentSelectionPresenter, _refreshStartValuesPresenter, _negativeStartValuesAllowedSelectionPresenter, _moleculeStartValueTask, _moleculeStartValuesCreator, _context, _legendPresenter, _deleteStartValuePresenter); _moleculeStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock(); sut.InitializeWith(_commandCollector); }
protected override void Context() { _buildConfiguration = new MoBiBuildConfiguration(); _moleculeBuidingBlock = new MoleculeBuildingBlock().WithName("M"); _buildConfiguration.Molecules = _moleculeBuidingBlock; _reactionBuildingBlock = new MoBiReactionBuildingBlock().WithName("R"); _reactionBuildingBlock.Add(new ReactionBuilder().WithName("R1")); _buildConfiguration.Reactions = _reactionBuildingBlock; _passiveTransportBuildingBlock = new PassiveTransportBuildingBlock().WithName("PT"); _passiveTransportBuildingBlock.Add(new TransportBuilder().WithName("PT2")); _passiveTransportBuildingBlock.Add(new TransportBuilder().WithName("PT1")); _buildConfiguration.PassiveTransports = _passiveTransportBuildingBlock; _eventGroupBuildingBlock = new EventGroupBuildingBlock().WithName("EG"); _buildConfiguration.EventGroups = _eventGroupBuildingBlock; _msvBuildingBlock = new MoleculeStartValuesBuildingBlock().WithName("MSV"); _buildConfiguration.MoleculeStartValues = _msvBuildingBlock; _psvBuildingBlock = new ParameterStartValuesBuildingBlock().WithName("PSV"); _buildConfiguration.ParameterStartValues = _psvBuildingBlock; _spatialStructure = new MoBiSpatialStructure().WithName("SPST"); _buildConfiguration.SpatialStructure = _spatialStructure; _observerBuildingBlock = new ObserverBuildingBlock().WithName("O"); _buildConfiguration.Observers = _observerBuildingBlock; _objectPathFactory = new ObjectPathFactory(new AliasCreator()); _entityPathResolver = new EntityPathResolver(_objectPathFactory); sut = new AffectedBuildingBlockRetriever(_entityPathResolver); //common setup _simulation = new MoBiSimulation { BuildConfiguration = _buildConfiguration }; }
private void setStartFormulasForStaticMolecules(IMoleculeStartValuesBuildingBlock defaultStartValues, Simulation simulation, IEnumerable <Compound> compounds) { var modelName = simulation.ModelConfiguration.ModelName; //get the names of molecules that are static (e.g. not enzymes, metabolites, etc.) // (e.g. FcRn in 2pores-model) var staticMoleculeNames = _modelContainerMoleculeRepository.MoleculeNamesIncludingDrug(modelName); var compoundNames = compounds.AllNames().ToList(); foreach (var moleculeStartValue in defaultStartValues) { var dbMoleculeName = getDbMoleculeName(moleculeStartValue.MoleculeName, compoundNames); if (staticMoleculeNames.Contains(dbMoleculeName)) { moleculeStartValue.IsPresent = _modelContainerMoleculeRepository.IsPresent(modelName, moleculeStartValue.ContainerPath, dbMoleculeName); moleculeStartValue.NegativeValuesAllowed = _modelContainerMoleculeRepository.NegativeValuesAllowed(modelName, moleculeStartValue.ContainerPath, dbMoleculeName); } else { moleculeStartValue.IsPresent = false; moleculeStartValue.NegativeValuesAllowed = false; } var moleculeDbPath = moleculeStartValue.ContainerPath.Clone <IObjectPath>(); moleculeDbPath.Add(dbMoleculeName); var rateKey = _moleculeStartFormulaRepository.RateKeyFor(moleculeDbPath, simulation.ModelProperties); if (rateKey == null) { continue; //no start formula available } //set molecule start formula moleculeStartValue.Formula = _formulaFactory.RateFor(rateKey, defaultStartValues.FormulaCache); } }
protected override void Context() { base.Context(); _moleculeStartValues = new MoleculeStartValuesBuildingBlock(); _moleculeStartValues.Add(new MoleculeStartValue { Name = "drug", IsPresent = true }); _moleculeStartValues.Add(new MoleculeStartValue { Name = "molecule", IsPresent = true }); _moleculeStartValues.Add(new MoleculeStartValue { Name = "moleculeThatDoesNotExist", IsPresent = true }); _moleculeStartValues.Add(new MoleculeStartValue { Name = "moleculeThatDoesExistButNotPresent", IsPresent = false }); _drug = new MoleculeBuilder().WithName("drug"); sut.Add(_drug); _molecule = new MoleculeBuilder().WithName("molecule"); sut.Add(_molecule); sut.Add(new MoleculeBuilder().WithName("moleculeThatDoesExistButNotPresent")); }
public void Visit(IMoleculeStartValuesBuildingBlock moleculeStartValuesBuildingBlock) { moleculeStartValuesBuildingBlock.Each(msv => msv.Dimension = _dimensionFactory.Dimension(Constants.Dimension.AMOUNT)); convert(moleculeStartValuesBuildingBlock); _converted = true; }