getParameter() public method

public getParameter ( long n ) : Parameter
n long
return Parameter
コード例 #1
0
 public void test_Parameter_parent_add()
 {
     Parameter ia = new Parameter(2,4);
       Model m = new Model(2,4);
       ia.setId("p");
       m.addParameter(ia);
       ia = null;
       ListOf lo = m.getListOfParameters();
       assertTrue( lo == m.getParameter(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
コード例 #2
0
 public void test_Parameter_parent_create()
 {
     Model m = new Model(2,4);
       Parameter p = m.createParameter();
       ListOf lo = m.getListOfParameters();
       assertTrue( lo == m.getParameter(0).getParentSBMLObject() );
       assertTrue( lo == p.getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
コード例 #3
0
 public void test_Parameter_ancestor_add()
 {
     Parameter ia = new Parameter(2,4);
       Model m = new Model(2,4);
       ia.setId("p");
       m.addParameter(ia);
       ia = null;
       ListOf lo = m.getListOfParameters();
       Parameter obj = m.getParameter(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
 }
コード例 #4
0
 public void test_Parameter_ancestor_create()
 {
     Model m = new Model(2,4);
       Parameter p = m.createParameter();
       ListOf lo = m.getListOfParameters();
       assertTrue( p.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( p.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( p.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( p.getAncestorOfType(libsbml.SBML_EVENT) == null );
       Parameter obj = m.getParameter(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
 }
コード例 #5
0
ファイル: TestReadSBML.cs プロジェクト: yarden/roadrunner
 public void test_ReadSBML_metaid()
 {
     SBase sb;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
     "  <functionDefinition metaid='fd'/>" +
     "</listOfFunctionDefinitions>" +
     "<listOfUnitDefinitions>" +
     "  <unitDefinition metaid='ud'/>" +
     "</listOfUnitDefinitions>" +
     "<listOfCompartments>" +
     "  <compartment metaid='c'/>" +
     "</listOfCompartments>" +
     "<listOfSpecies>" +
     "  <species metaid='s'/>" +
     "</listOfSpecies>" +
     "<listOfParameters>" +
     "  <parameter metaid='p'/>" +
     "</listOfParameters>" +
     "<listOfRules>" +
     "  <rateRule metaid='rr'/>" +
     "</listOfRules>" +
     "<listOfReactions>" +
     "  <reaction metaid='rx'/>" +
     "</listOfReactions>" +
     "<listOfEvents>" +
     " <event metaid='e'/>" +
     "</listOfEvents>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M != null );
       sb = M.getFunctionDefinition(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "fd" == sb.getMetaId() ));
       sb = M.getUnitDefinition(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "ud" == sb.getMetaId() ));
       sb = M.getCompartment(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "c" == sb.getMetaId() ));
       sb = M.getSpecies(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "s" == sb.getMetaId() ));
       sb = M.getParameter(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "p" == sb.getMetaId() ));
       sb = M.getRule(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "rr" == sb.getMetaId() ));
       sb = M.getReaction(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "rx" == sb.getMetaId() ));
       sb = M.getEvent(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "e" == sb.getMetaId() ));
 }
コード例 #6
0
ファイル: TestReadSBML.cs プロジェクト: yarden/roadrunner
 public void test_ReadSBML_Parameter_L2_defaults()
 {
     Parameter p;
       string s = wrapSBML_L2v1("<listOfParameters> <parameter id='x'/> </listOfParameters>"
     );
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumParameters() == 1 );
       p = M.getParameter(0);
       assertEquals( true, p.isSetId() );
       assertEquals( false, p.isSetName() );
       assertEquals( false, p.isSetValue() );
       assertEquals( false, p.isSetUnits() );
       assertTrue((  "x" == p.getId() ));
       assertTrue( p.getConstant() == true );
 }
コード例 #7
0
ファイル: TestReadSBML.cs プロジェクト: yarden/roadrunner
 public void test_ReadSBML_Parameter_L2()
 {
     Parameter p;
       string s = wrapSBML_L2v1("<listOfParameters>" +
     "  <parameter id='T' value='4.6' units='Celsius' constant='false'/>" +
     "</listOfParameters>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumParameters() == 1 );
       p = M.getParameter(0);
       assertEquals( true, p.isSetId() );
       assertEquals( false, p.isSetName() );
       assertEquals( true, p.isSetValue() );
       assertEquals( true, p.isSetUnits() );
       assertTrue((  "T"        == p.getId() ));
       assertTrue((  "Celsius"  == p.getUnits() ));
       assertTrue( p.getValue() == 4.6 );
       assertTrue( p.getConstant() == false );
 }
コード例 #8
0
ファイル: TestReadSBML.cs プロジェクト: yarden/roadrunner
 public void test_ReadSBML_Parameter()
 {
     Parameter p;
       string s = wrapSBML_L1v2("<listOfParameters>" +
     "  <parameter name='Km1' value='2.3' units='second'/>" +
     "</listOfParameters>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumParameters() == 1 );
       p = M.getParameter(0);
       assertTrue((  "Km1"     == p.getId() ));
       assertTrue((  "second"  == p.getUnits() ));
       assertTrue( p.getValue() == 2.3 );
       assertTrue( p.isSetValue() == true );
 }
コード例 #9
0
ファイル: FluxBalance.cs プロジェクト: fbergmann/FluxBalance
        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()));
              }
            }

            }
        }