private void addReactionPartnerTo(PKSimReaction reaction, FlatReactionPartner flatReactionPartner)
        {
            if (flatReactionPartner.Direction.Equals(CoreConstants.ORM.PROCESS_MOLECULE_DIRECTION_MODIFIER))
            {
                //---- not Educt/Product, just a modifier
                reaction.AddModifier(flatReactionPartner.Molecule);
                return;
            }

            //---- from now on, must be educt/product
            var reactionPartner = new ReactionPartnerBuilder()
            {
                MoleculeName = flatReactionPartner.Molecule,
                StoichiometricCoefficient = flatReactionPartner.StoichCoeff
            };

            if (flatReactionPartner.Direction.Equals(CoreConstants.ORM.PROCESS_MOLECULE_DIRECTION_IN))
            {
                reaction.AddEduct(reactionPartner);
                return;
            }

            if (flatReactionPartner.Direction.Equals(CoreConstants.ORM.PROCESS_MOLECULE_DIRECTION_OUT))
            {
                reaction.AddProduct(reactionPartner);
                return;
            }

            //invalid direction (should never happen)
            throw new ArgumentOutOfRangeException(flatReactionPartner.Direction);
        }
        private void addReactionPartnersTo(PKSimReaction reaction, string reactionName)
        {
            var allPartners = (from rp in _reactionPartnerRepository.All()
                               where rp.Reaction.Equals(reactionName)
                               select rp).ToList();

            foreach (var flatReactionPartner in allPartners)
            {
                addReactionPartnerTo(reaction, flatReactionPartner);
            }
        }
Beispiel #3
0
        protected override void Context()
        {
            base.Context();
            _process = new EnzymaticProcess().WithName("P1");
            _process.InternalName = "internalNAme";
            _drug         = new MoleculeBuilder().WithName("drug");
            _metabolite   = new MoleculeBuilder().WithName("metabolite");
            _enzymeName   = "P1";
            _formulaCache = new FormulaCache();
            _kinetic      = new ExplicitFormula().WithId("trala");
            _kinetic.AddObjectPath(new FormulaUsablePath(new[] { "Organism", CoreConstants.KeyWords.Molecule }));
            _kinetic.AddObjectPath(new FormulaUsablePath(new[] { "Organism", CoreConstants.KeyWords.Protein }));
            _parameterFormula = new ExplicitFormula();
            _parameterFormula.AddObjectPath(new FormulaUsablePath(new[] { "Liver", CoreConstants.KeyWords.Molecule }));

            var pkSimReaction = new PKSimReaction().WithName("template");

            A.CallTo(() => _simulationActiveProcessRepository.ProcessFor <PKSimReaction>(_process.InternalName)).Returns(pkSimReaction);
            pkSimReaction.Formula = _kinetic;
            A.CallTo(() => _cloneManager.Clone(pkSimReaction)).Returns(pkSimReaction);
        }
Beispiel #4
0
        protected override void Context()
        {
            base.Context();
            _formulaCache = new FormulaCache();
            _protein      = new MoleculeBuilder().WithName("CYP3A4");

            _interactionProcess = new InductionProcess().WithName("Induction");
            _interactionProcess.InternalName = "AA";

            _compound = new Compound().WithName("Inhibitor");
            _compound.AddProcess(_interactionProcess);

            _template = new PKSimReaction();
            A.CallTo(() => _simulationActiveProcessRepository.ProcessFor <PKSimReaction>(_interactionProcess.InternalName)).Returns(_template);

            var reaction = new PKSimReaction {
                Formula = new ExplicitFormula().WithName("ABC")
            };

            reaction.Formula.AddObjectPath(new FormulaUsablePath(CoreConstants.KeyWords.Protein, "P1").WithAlias("P1"));
            reaction.Formula.AddObjectPath(new FormulaUsablePath(CoreConstants.KeyWords.Reaction, "R1").WithAlias("R1"));
            reaction.Formula.AddObjectPath(new FormulaUsablePath(CoreConstants.KeyWords.Molecule, "M11").WithAlias("M1"));
            A.CallTo(() => _cloneManager.Clone <IReactionBuilder>(_template)).Returns(reaction);
        }
 protected override void Because()
 {
     _reaction = sut.All().FirstOrDefault(r => r.Name.Equals(_reactionName1));
 }