public void UpdateModifiers(IReactionBuilder reaction, string moleculeName, string compoundName, Simulation simulation)
 {
     AllInteractionProcessesFor(moleculeName, compoundName, simulation).Each((process, i) =>
     {
         var inhibitor = process.ParentCompound;
         if (!reaction.ModifierNames.Contains(inhibitor.Name))
         {
             reaction.AddModifier(inhibitor.Name);
         }
     });
 }
        protected override void ExecuteWith(IMoBiContext context)
        {
            base.ExecuteWith(context);
            _reaction.RemoveModifier(_oldModifier);
            _reaction.AddModifier(_newModifier);
            var reactionDiagramManager = _buildingBlock.DiagramManager.DowncastTo <IMoBiReactionDiagramManager>();

            if (reactionDiagramManager.IsInitialized)
            {
                reactionDiagramManager.RenameMolecule(_reaction, _oldModifier, _newModifier);
            }

            context.PublishEvent(new RemovedReactionModifierEvent(_reaction, _oldModifier));
            context.PublishEvent(new AddedReactionModifierEvent(_reaction, _newModifier));
        }
Example #3
0
        protected override void Context()
        {
            base.Context();

            var formula = new ExplicitFormula().WithFormulaString("123").WithName("TOTO");

            formula.AddObjectPath(new FormulaUsablePath(new[] { "Organism", CoreConstants.KeyWords.Molecule }));
            formula.AddObjectPath(new FormulaUsablePath(new[] { "Organism", CoreConstants.Molecule.DrugFcRnComplexTemplate }));
            _reaction = new PKSimReaction().WithName("xx").WithId("xx").WithFormula(formula);
            _reaction.AddEduct(new ReactionPartnerBuilder(CoreConstants.KeyWords.Molecule, 1));
            _reaction.AddEduct(new ReactionPartnerBuilder("XY", 1));
            _reaction.AddProduct(new ReactionPartnerBuilder(CoreConstants.Molecule.DrugFcRnComplexTemplate, 1));
            _reaction.AddModifier(CoreConstants.KeyWords.Molecule);
            _formulaCache = new BuildingBlockFormulaCache();

            A.CallTo(() => _cloneManager.Clone(_reaction)).Returns(_reaction);
        }
Example #4
0
        /// <summary>
        ///     Imports the SBML Modifiers to MoBi Modifiers.
        /// </summary>
        private void CreateModifiers(Reaction sbmlReaction, IReactionBuilder reactionBuilder, string reactionCompartment, Model model)
        {
            for (long i = 0; i < sbmlReaction.getNumModifiers(); i++)
            {
                var modifier = sbmlReaction.getModifier(i);
                if (ModifierInDifferentCompartment(reactionCompartment, modifier, model))
                {
                    continue;
                }

                var modifierMolecule = _sbmlInformation.GetMoleculeBySBMLId(modifier.getSpecies());
                if (modifierMolecule != null)
                {
                    reactionBuilder.AddModifier(modifierMolecule.Name);
                }
            }
        }
Example #5
0
        private void replaceKeywordsInProcess(IReactionBuilder reactionBuilder, string[] keywords, string[] replacementValues)
        {
            replaceFormulaKeywords(reactionBuilder, keywords, replacementValues);
            reactionBuilder.Parameters.Each(p => replaceFormulaKeywords(p, keywords, replacementValues));

            foreach (var reactionPartner in reactionBuilder.Educts.Union(reactionBuilder.Products))
            {
                reactionPartner.MoleculeName = reactionPartner.MoleculeName.ReplaceKeywords(keywords, replacementValues);
            }

            var replacedModifiers = new List <string>();

            foreach (var modifier in reactionBuilder.ModifierNames)
            {
                replacedModifiers.Add(modifier.ReplaceKeywords(keywords, replacementValues));
            }
            reactionBuilder.ClearModifiers();
            foreach (var replacedModifier in replacedModifiers)
            {
                reactionBuilder.AddModifier(replacedModifier);
            }
        }
Example #6
0
 protected override void Context()
 {
     base.Context();
     _reaction = new ReactionBuilder();
     _reaction.AddModifier(_compound1.Name);
 }