本文整理汇总了C#中libsbml.SBMLDocument.getModel方法的典型用法代码示例。如果您正苦于以下问题:C# SBMLDocument.getModel方法的具体用法?C# SBMLDocument.getModel怎么用?C# SBMLDocument.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.SBMLDocument
的用法示例。
在下文中一共展示了SBMLDocument.getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setUp
public void setUp()
{
string filename = "../../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_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 );
}
示例5: 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;
}
示例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_SBMLConvert_convertToL3_stoichiometryMath
public void test_SBMLConvert_convertToL3_stoichiometryMath()
{
SBMLDocument d = new SBMLDocument(2,1);
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");
StoichiometryMath sm = sr.createStoichiometryMath();
ASTNode ast = libsbml.parseFormula("c*2");
sm.setMath(ast);
assertTrue( m.getNumRules() == 0 );
assertTrue( sr.isSetId() == false );
assertTrue( d.setLevelAndVersion(3,1,false) == true );
m = d.getModel();
r = m.getReaction(0);
sr = r.getReactant(0);
assertTrue( m.getNumRules() == 1 );
assertTrue( sr.isSetId() == true );
Rule rule = m.getRule(0);
assertTrue( sr.getId() == rule.getVariable() );
d = null;
}
示例8: test_SBMLConvert_convertToL2v4_DuplicateAnnotations_model
public void test_SBMLConvert_convertToL2v4_DuplicateAnnotations_model()
{
SBMLDocument d = new SBMLDocument(2,1);
Model m = d.createModel();
string annotation = "<rdf/>\n<rdf/>";
int i = (m).setAnnotation(annotation);
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 1 );
assertTrue( (m).getAnnotation().getNumChildren() == 2 );
assertTrue( d.setLevelAndVersion(2,4,true) == true );
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 4 );
m = d.getModel();
assertTrue( (m).getAnnotation().getNumChildren() == 1 );
d = null;
}
示例9: test_SBMLDocument_setModel3
public void test_SBMLDocument_setModel3()
{
SBMLDocument d = new SBMLDocument(2,2);
Model m1 = new Model(2,2);
int i = d.setModel(m1);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( d.getModel() != null );
d = null;
}
示例10: test_SBMLDocument_setModel
public void test_SBMLDocument_setModel()
{
SBMLDocument d = new SBMLDocument(2,4);
Model m1 = new Model(2,4);
Model m2 = new Model(2,4);
Model mout;
assertTrue( d.getModel() == null );
int i = d.setModel(m1);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
mout = d.getModel();
assertTrue( mout != null );
assertTrue( mout != m1 );
i = d.setModel(d.getModel());
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
mout = d.getModel();
assertTrue( mout != null );
assertTrue( mout != m1 );
i = d.setModel(m2);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
mout = d.getModel();
assertTrue( mout != null );
assertTrue( mout != m2 );
d = null;
}
示例11: test_Model_parent_add
public void test_Model_parent_add()
{
SBMLDocument d = new SBMLDocument(2,4);
Model m = new Model(2,4);
d.setModel(m);
assertTrue( d == d.getModel().getParentSBMLObject() );
d = null;
}
示例12: test_ReadSBML_Model
public void test_ReadSBML_Model()
{
string s = wrapXML("<sbml level='1' version='1'>" +
" <model name='testModel'></model>" +
"</sbml>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue(( "testModel" == M.getId() ));
}
示例13: test_ReadSBML_Model_L2
public void test_ReadSBML_Model_L2()
{
string s = wrapXML("<sbml level='2' version='1'>" +
" <model id='testModel'> </model>" +
"</sbml>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertEquals( true, M.isSetId() );
assertEquals( false, M.isSetName() );
assertTrue(( "testModel" == M.getId() ));
}
示例14: test_ReadSBML_metaid_Unit
public void test_ReadSBML_metaid_Unit()
{
SBase sb;
UnitDefinition ud;
string s = wrapSBML_L2v1("<listOfUnitDefinitions>" +
" <unitDefinition metaid='ud'>" +
" <listOfUnits metaid='lou'>" +
" <unit metaid='u'/>" +
" </listOfUnits>" +
" </unitDefinition>" +
"</listOfUnitDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M != null );
ud = M.getUnitDefinition(0);
sb = ud;
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "ud" == sb.getMetaId() ));
sb = ud.getListOfUnits();
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "lou" == sb.getMetaId() ));
sb = ud.getUnit(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "u" == sb.getMetaId() ));
}
示例15: 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() ));
}