本文整理汇总了C#中libsbmlcs.Model.getReaction方法的典型用法代码示例。如果您正苦于以下问题:C# Model.getReaction方法的具体用法?C# Model.getReaction怎么用?C# Model.getReaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.Model
的用法示例。
在下文中一共展示了Model.getReaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_ReadSBML_notes
public void test_ReadSBML_notes()
{
Reaction r;
KineticLaw kl;
string s = wrapSBML_L2v3("<listOfReactions>" +
"<reaction name='J1'>" +
" <kineticLaw formula='k1*X0'>" +
" <notes>This is a test note.</notes>" +
" <listOfParameters>" +
" <parameter name='k1' value='0'/>" +
" </listOfParameters>" +
" </kineticLaw>" +
"</reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
r = M.getReaction(0);
kl = r.getKineticLaw();
assertTrue( kl.getNotes() != null );
string notes = kl.getNotes().getChild(0).getCharacters();
assertTrue( ( "This is a test note." != notes ) == false );
}
示例2: test_Reaction_ancestor_add
public void test_Reaction_ancestor_add()
{
Reaction ia = new Reaction(2,4);
Model m = new Model(2,4);
ia.setId("k");
m.addReaction(ia);
ia = null;
ListOf lo = m.getListOfReactions();
Reaction obj = m.getReaction(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 );
}
示例3: test_ReadSBML_metaid
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() ));
}
示例4: test_ReadSBML_metaid_Reaction
public void test_ReadSBML_metaid_Reaction()
{
SBase sb;
Reaction r;
string s = wrapSBML_L2v1("<listOfReactions>" +
" <reaction metaid='r'>" +
" <listOfReactants metaid='lor'>" +
" <speciesReference metaid='sr1'/>" +
" </listOfReactants>" +
" <listOfProducts metaid='lop'>" +
" <speciesReference metaid='sr2'/>" +
" </listOfProducts>" +
" <listOfModifiers metaid='lom'>" +
" <modifierSpeciesReference metaid='msr'/>" +
" </listOfModifiers>" +
" <kineticLaw metaid='kl'/>" +
" </reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M != null );
r = M.getReaction(0);
sb = r;
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "r" == sb.getMetaId() ));
sb = r.getListOfReactants();
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "lor" == sb.getMetaId() ));
sb = r.getReactant(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "sr1" == sb.getMetaId() ));
sb = r.getListOfProducts();
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "lop" == sb.getMetaId() ));
sb = r.getProduct(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "sr2" == sb.getMetaId() ));
sb = r.getListOfModifiers();
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "lom" == sb.getMetaId() ));
sb = r.getModifier(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "msr" == sb.getMetaId() ));
sb = r.getKineticLaw();
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "kl" == sb.getMetaId() ));
}
示例5: InitializeFromFbcV2
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()));
}
}
}
}
示例6: test_ReadSBML_line_col_numbers
public void test_ReadSBML_line_col_numbers()
{
//setXMLParser();
SBase sb;
string s = "<?xml version='1.0' encoding='UTF-8'?>\n" +
"<sbml xmlns='http://www.sbml.org/sbml/level2' level='2' version='1'>\n" +
" <model id='testModel' name='testModel'>\n" +
" <listOfReactions> <reaction/> </listOfReactions>\n" +
" </model>\n" +
"</sbml>\n";
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M != null );
sb = M;
sb = M.getListOfReactions();
sb = M.getReaction(0);
}
示例7: test_ReadSBML_KineticLaw
public void test_ReadSBML_KineticLaw()
{
Reaction r;
KineticLaw kl;
string s = wrapSBML_L1v2("<listOfReactions>" +
" <reaction name='J1'>" +
" <kineticLaw formula='k1*X0'/>" +
" </reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
kl = r.getKineticLaw();
assertTrue(( "k1*X0" == kl.getFormula() ));
}
示例8: test_Reaction_parent_create
public void test_Reaction_parent_create()
{
Model m = new Model(2,4);
Reaction r = m.createReaction();
ListOf lo = m.getListOfReactions();
assertTrue( lo == m.getReaction(0).getParentSBMLObject() );
assertTrue( lo == r.getParentSBMLObject() );
assertTrue( m == lo.getParentSBMLObject() );
}
示例9: test_ReadSBML_SpeciesReference_StoichiometryMath_1
public void test_ReadSBML_SpeciesReference_StoichiometryMath_1()
{
Reaction r;
SpeciesReference sr;
StoichiometryMath math;
string formula;
string s = wrapSBML_L2v1("<listOfReactions>" +
" <reaction name='r1'>" +
" <listOfReactants>" +
" <speciesReference species='X0'>" +
" <stoichiometryMath>" +
" <math> <ci> x </ci> </math>" +
" </stoichiometryMath>" +
" </speciesReference>" +
" </listOfReactants>" +
" </reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
assertTrue( r != null );
assertTrue( r.getNumReactants() == 1 );
sr = r.getReactant(0);
assertTrue( sr != null );
assertEquals( true, sr.isSetStoichiometryMath() );
math = sr.getStoichiometryMath();
formula = libsbml.formulaToString(math.getMath());
assertTrue( formula != null );
assertTrue(( "x" == formula ));
}
示例10: test_ReadSBML_SpeciesReference_StoichiometryMath_2
public void test_ReadSBML_SpeciesReference_StoichiometryMath_2()
{
Reaction r;
SpeciesReference sr;
string s = wrapSBML_L2v1("<listOfReactions>" +
" <reaction name='r1'>" +
" <listOfReactants>" +
" <speciesReference species='X0'>" +
" <stoichiometryMath>" +
" <math> <cn type='rational'> 3 <sep/> 2 </cn> </math>" +
" </stoichiometryMath>" +
" </speciesReference>" +
" </listOfReactants>" +
" </reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
assertTrue( r != null );
assertTrue( r.getNumReactants() == 1 );
sr = r.getReactant(0);
assertTrue( sr != null );
assertEquals( false, sr.isSetStoichiometryMath() );
assertTrue( sr.getStoichiometry() == 3 );
assertTrue( sr.getDenominator() == 2 );
}
示例11: test_ReadSBML_SpeciesReference_defaults
public void test_ReadSBML_SpeciesReference_defaults()
{
Reaction r;
SpeciesReference sr;
string s = wrapSBML_L1v2("<listOfReactions>" +
" <reaction name='reaction_1' reversible='false'>" +
" <listOfReactants>" +
" <speciesReference species='X0'/>" +
" </listOfReactants>" +
" </reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
assertTrue(( "reaction_1" == r.getId() ));
assertTrue( r.getReversible() == false );
assertTrue( r.getNumReactants() == 1 );
sr = r.getReactant(0);
assertTrue(( "X0" == sr.getSpecies() ));
assertTrue( sr.getStoichiometry() == 1 );
assertTrue( sr.getDenominator() == 1 );
}
示例12: test_ReadSBML_Reaction_L2_defaults
public void test_ReadSBML_Reaction_L2_defaults()
{
Reaction r;
string s = wrapSBML_L2v1("<listOfReactions> <reaction id='r1'/> </listOfReactions>"
);
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
assertEquals( true, r.isSetId() );
assertEquals( false, r.isSetName() );
assertEquals( false, r.isSetFast() );
assertTrue(( "r1" == r.getId() ));
assertTrue( r.getReversible() == true );
}
示例13: test_ReadSBML_Reaction_defaults
public void test_ReadSBML_Reaction_defaults()
{
Reaction r;
string s = wrapSBML_L1v2("<listOfReactions>" +
" <reaction name='reaction_1'/>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
assertTrue(( "reaction_1" == r.getId() ));
assertTrue( r.getReversible() != false );
assertTrue( r.getFast() == false );
}
示例14: test_Reaction_ancestor_create
public void test_Reaction_ancestor_create()
{
Model m = new Model(2,4);
Reaction r = m.createReaction();
ListOf lo = m.getListOfReactions();
assertTrue( r.getAncestorOfType(libsbml.SBML_MODEL) == m );
assertTrue( r.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
assertTrue( r.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
assertTrue( r.getAncestorOfType(libsbml.SBML_EVENT) == null );
Reaction obj = m.getReaction(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 );
}
示例15: test_ReadSBML_KineticLaw_L2
public void test_ReadSBML_KineticLaw_L2()
{
Reaction r;
KineticLaw kl;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfReactions>" +
" <reaction id='J1'>" +
" <kineticLaw>" +
" <math>" +
" <apply>" +
" <times/>" +
" <ci> k </ci>" +
" <ci> S2 </ci>" +
" <ci> X0 </ci>" +
" </apply>" +
" </math>" +
" </kineticLaw>" +
" </reaction>" +
"</listOfReactions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumReactions() == 1 );
r = M.getReaction(0);
assertTrue( r != null );
kl = r.getKineticLaw();
assertTrue( kl != null );
assertEquals( true, kl.isSetMath() );
math = kl.getMath();
formula = kl.getFormula();
assertTrue( formula != null );
assertTrue(( "k * S2 * X0" == formula ));
}