Ejemplo n.º 1
0
        private void InitializeFromFbcV2(Model model, FbcModelPlugin plugin)
        {
            if (!plugin.getStrict())
              {
            Warnings.Add(
              "Encountered non-strict model, this software does not support any of the dynamic features of FBC V2, only the static features of the model are imported. ");
              }

              var numConstraints = plugin.getNumFluxBounds();
              for (int i = 0; i < numConstraints; i++)
              {
            var constraint = plugin.getFluxBound(i);
            Constraints.Add(new LPsolveConstraint(constraint.getReaction(), GetOperator(constraint.getOperation()),
              constraint.getValue()));
              }

              var activeObjective = plugin.getActiveObjective();
              if (activeObjective == null && plugin.getNumObjectives() > 0)
            activeObjective = plugin.getObjective(0);
              if (activeObjective == null) return;
              var numObjectives = (int)activeObjective.getNumFluxObjectives();
              for (int i = 0; i < numObjectives; i++)
              {
            var objective = activeObjective.getFluxObjective(i);
            Objectives.Add(new LPsolveObjective(objective.getReaction(), objective.getCoefficient()));
              }

              if (activeObjective.getType() == "minimize" || activeObjective.getType() == "minimise") Mode = FBA_Mode.minimize;
              else Mode = FBA_Mode.maximize;
              ActiveObjective = activeObjective.getId();

              for (int i = 0; i < model.getNumReactions(); i++)
              {
            var reaction = model.getReaction(i);
            ReversibilityMap[reaction.getId()] = reaction.getReversible();

            var rplug = (FbcReactionPlugin) reaction.getPlugin("fbc");
            if (rplug == null) continue;

            if (rplug.isSetLowerFluxBound())
            {
              var param = model.getParameter(rplug.getLowerFluxBound());
              if (param != null)
              {
            Constraints.Add(new LPsolveConstraint(reaction.getId(), lpsolve_constr_types.GE,
              param.getValue()));
              }
            }

            if (rplug.isSetUpperFluxBound())
            {
              var param = model.getParameter(rplug.getUpperFluxBound());
              if (param != null)
              {
            Constraints.Add(new LPsolveConstraint(reaction.getId(), lpsolve_constr_types.LE,
              param.getValue()));
              }
            }

            }
        }
Ejemplo n.º 2
0
        private void InitializeFromFbcV1(Model model, FbcModelPlugin plugin)
        {
            var numConstraints = plugin.getNumFluxBounds();
              for (int i = 0; i < numConstraints; i++)
              {
            var constraint = plugin.getFluxBound(i);
            Constraints.Add(new LPsolveConstraint(constraint.getReaction(), GetOperator(constraint.getOperation()),
              constraint.getValue()));
              }
              var activeObjective = plugin.getActiveObjective();
              if (activeObjective == null && plugin.getNumObjectives() > 0)
            activeObjective = plugin.getObjective(0);
              if (activeObjective == null) return;
              var numObjectives = (int)activeObjective.getNumFluxObjectives();
              for (int i = 0; i < numObjectives; i++)
              {
            var objective = activeObjective.getFluxObjective(i);
            Objectives.Add(new LPsolveObjective(objective.getReaction(), objective.getCoefficient()));
              }

              if (activeObjective.getType() == "minimize" || activeObjective.getType() == "minimise") Mode = FBA_Mode.minimize;
              else Mode = FBA_Mode.maximize;
              ActiveObjective = activeObjective.getId();

              for (int i = 0; i < model.getNumReactions(); i++)
              {
            var reaction = model.getReaction(i);
            ReversibilityMap[reaction.getId()] = reaction.getReversible();
              }
        }