本文整理汇总了C#中libsbmlcs.SBMLDocument.getModel方法的典型用法代码示例。如果您正苦于以下问题:C# SBMLDocument.getModel方法的具体用法?C# SBMLDocument.getModel怎么用?C# SBMLDocument.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.SBMLDocument
的用法示例。
在下文中一共展示了SBMLDocument.getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setUp
public void setUp()
{
string filename = "../../sbml/annotation/test/test-data/annotationL3.xml";
d = libsbml.readSBML(filename);
m = d.getModel();
c = m.getCompartment(0);
}
示例2: test_SBMLConvertStrict_convertNonStrictSBO
public void test_SBMLConvertStrict_convertNonStrictSBO()
{
SBMLDocument d = new SBMLDocument(2,4);
Model m = d.createModel();
Compartment c = m.createCompartment();
c.setId( "c");
c.setConstant(false);
(c).setSBOTerm(64);
assertTrue( d.setLevelAndVersion(2,3,true) == false );
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 4 );
assertTrue( d.setLevelAndVersion(2,2,true) == false );
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 4 );
assertTrue( d.setLevelAndVersion(2,1,true) == true );
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 1 );
Compartment c1 = d.getModel().getCompartment(0);
assertTrue( (c1).getSBOTerm() == -1 );
assertTrue( d.setLevelAndVersion(1,2,true) == true );
assertTrue( d.getLevel() == 1 );
assertTrue( d.getVersion() == 2 );
Compartment c2 = d.getModel().getCompartment(0);
assertTrue( (c2).getSBOTerm() == -1 );
d = null;
}
示例3: test_SBMLConvertStrict_convertL1ParamRule
public void test_SBMLConvertStrict_convertL1ParamRule()
{
SBMLDocument d = new SBMLDocument(1,2);
Model m = d.createModel();
Compartment c = m.createCompartment();
c.setId( "c");
Parameter p = m.createParameter();
p.setId( "p");
Parameter p1 = m.createParameter();
p1.setId( "p1");
ASTNode math = libsbml.parseFormula("p");
Rule ar = m.createAssignmentRule();
ar.setVariable( "p1");
ar.setMath(math);
ar.setUnits( "mole");
assertTrue( d.setLevelAndVersion(2,1,true) == true );
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 1 );
Rule r1 = d.getModel().getRule(0);
assertTrue( r1.getUnits() == "" );
d = null;
}
示例4: test_ReadSBML_FunctionDefinition
public void test_ReadSBML_FunctionDefinition()
{
FunctionDefinition fd;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
" <functionDefinition id='pow3' name='cubed'>" +
" <math>" +
" <lambda>" +
" <bvar><ci> x </ci></bvar>" +
" <apply>" +
" <power/>" +
" <ci> x </ci>" +
" <cn> 3 </cn>" +
" </apply>" +
" </lambda>" +
" </math>" +
" </functionDefinition>" +
"</listOfFunctionDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumFunctionDefinitions() == 1 );
fd = M.getFunctionDefinition(0);
assertTrue( fd != null );
assertEquals( true, fd.isSetId() );
assertEquals( true, fd.isSetName() );
assertTrue(( "pow3" == fd.getId() ));
assertTrue(( "cubed" == fd.getName() ));
assertEquals( true, fd.isSetMath() );
math = fd.getMath();
formula = libsbml.formulaToString(math);
assertTrue( formula != null );
assertTrue(( "lambda(x, pow(x, 3))" == formula ));
}
示例5: test_SBMLConvertStrict_convertToL1
public void test_SBMLConvertStrict_convertToL1()
{
SBMLDocument d = new SBMLDocument(2,4);
Model m = d.createModel();
(m).setMetaId( "_m");
Compartment c = m.createCompartment();
c.setId( "c");
(c).setSBOTerm(240);
Species s = m.createSpecies();
s.setId( "s");
s.setCompartment( "c");
assertTrue( d.setLevelAndVersion(1,2,true) == true );
assertTrue( d.getLevel() == 1 );
assertTrue( d.getVersion() == 2 );
Model m1 = d.getModel();
assertTrue( (m1).getMetaId() == "" );
Compartment c1 = m1.getCompartment(0);
assertTrue( (c1).getSBOTerm() == -1 );
Species s1 = m1.getSpecies(0);
assertTrue( s1.getHasOnlySubstanceUnits() == false );
d = null;
}
示例6: test_SBMLConvert_convertToL3_localParameters
public void test_SBMLConvert_convertToL3_localParameters()
{
SBMLDocument d = new SBMLDocument(1,2);
Model m = d.createModel();
Compartment c = m.createCompartment();
c.setId( "c" );
Species s = m.createSpecies();
s.setId( "s");
s.setCompartment( "c");
Reaction r = m.createReaction();
SpeciesReference sr = r.createReactant();
sr.setSpecies( "s");
KineticLaw kl = r.createKineticLaw();
kl.setFormula( "s*k");
Parameter p = kl.createParameter();
p.setId( "k");
assertTrue( kl.getNumLocalParameters() == 0 );
assertTrue( d.setLevelAndVersion(3,1,false) == true );
m = d.getModel();
r = m.getReaction(0);
kl = r.getKineticLaw();
assertTrue( kl.getNumLocalParameters() == 1 );
LocalParameter lp = kl.getLocalParameter(0);
d = null;
}
示例7: test_SBMLConvert_convertFromL3_modelUnits
public void test_SBMLConvert_convertFromL3_modelUnits()
{
UnitDefinition ud;
SBMLDocument d = new SBMLDocument(3,1);
Model m = d.createModel();
m.setVolumeUnits( "litre");
assertTrue( m.getNumUnitDefinitions() == 0 );
assertTrue( d.setLevelAndVersion(1,2,false) == true );
m = d.getModel();
assertTrue( m.getNumUnitDefinitions() == 1 );
ud = m.getUnitDefinition(0);
assertTrue(( "volume" == ud.getId() ));
assertTrue( ud.getNumUnits() == 1 );
assertTrue( ud.getUnit(0).getKind() == libsbml.UNIT_KIND_LITRE );
}
示例8: test_Model_ancestor_create
public void test_Model_ancestor_create()
{
SBMLDocument d = new SBMLDocument();
Model m = d.createModel();
assertTrue( m.getAncestorOfType(libsbml.SBML_DOCUMENT) == d );
Model obj = d.getModel();
assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == d );
d = null;
}
示例9: 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() ));
}
示例10: 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);
}
示例11: test_ReadSBML_KineticLaw_Parameter
public void test_ReadSBML_KineticLaw_Parameter()
{
Reaction r;
KineticLaw kl;
Parameter p;
string s = wrapSBML_L1v2("<listOfReactions>" +
" <reaction name='J1'>" +
" <kineticLaw formula='k1*X0'>" +
" <listOfParameters>" +
" <parameter name='k1' value='0'/>" +
" </listOfParameters>" +
" </kineticLaw>" +
" </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() ));
assertTrue( kl.getNumParameters() == 1 );
p = kl.getParameter(0);
assertTrue(( "k1" == p.getId() ));
assertTrue( p.getValue() == 0 );
}
示例12: 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 ));
}
示例13: 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() ));
}
示例14: test_ReadSBML_FunctionDefinition_OnlyBVars
public void test_ReadSBML_FunctionDefinition_OnlyBVars()
{
FunctionDefinition fd;
SBMLError error;
int numErrors;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
" <functionDefinition id='invalid'>" +
" <math xmlns='http://www.w3.org/1998/Math/MathML'>" +
" <lambda>" +
" <bvar><ci> x </ci></bvar>" +
" <bvar><ci> y </ci></bvar>" +
" <bvar><ci> z </ci></bvar>" +
" </lambda>" +
" </math>" +
" </functionDefinition>" +
"</listOfFunctionDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
D.checkInternalConsistency();
D.checkConsistency();
numErrors = (int)D.getNumErrors();
assertTrue( numErrors == 1 );
error = D.getError(0);
int errorId = (int)error.getErrorId();
assertTrue( errorId == libsbml.NoBodyInFunctionDef );
assertTrue( M.getNumFunctionDefinitions() == 1 );
fd = M.getFunctionDefinition(0);
assertTrue( fd != null );
assertEquals( true, fd.isSetId() );
assertEquals( false, fd.isSetName() );
assertTrue(( "invalid" == fd.getId() ));
assertTrue( fd.getBody() == null );
assertEquals( true, fd.isSetMath() );
math = fd.getMath();
formula = libsbml.formulaToString(math);
assertTrue( formula != null );
assertTrue(( "lambda(x, y, z)" == formula ));
}
示例15: test_ReadSBML_FunctionDefinition_MathReturnsCN
public void test_ReadSBML_FunctionDefinition_MathReturnsCN()
{
FunctionDefinition fd;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
" <functionDefinition id='getNumber'>" +
" <math>" +
" <lambda>" +
" <bvar><ci> x </ci></bvar>" +
" <cn> 42 </cn>" +
" </lambda>" +
" </math>" +
" </functionDefinition>" +
"</listOfFunctionDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumFunctionDefinitions() == 1 );
fd = M.getFunctionDefinition(0);
assertTrue( fd != null );
assertEquals( true, fd.isSetId() );
assertEquals( false, fd.isSetName() );
assertTrue(( "getNumber" == fd.getId() ));
assertEquals( true, fd.isSetMath() );
math = fd.getMath();
formula = libsbml.formulaToString(math);
assertTrue( formula != null );
assertTrue(( "lambda(x, 42)" == formula ));
}