本文整理汇总了C#中libsbml.SBMLDocument类的典型用法代码示例。如果您正苦于以下问题:C# SBMLDocument类的具体用法?C# SBMLDocument怎么用?C# SBMLDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SBMLDocument类属于libsbml命名空间,在下文中一共展示了SBMLDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: test_SBMLDocument_setLevelAndVersion
public void test_SBMLDocument_setLevelAndVersion()
{
SBMLDocument d = new SBMLDocument(2,2);
Model m1 = new Model(2,2);
d.setModel(m1);
assertTrue( d.setLevelAndVersion(2,3,false) == true );
assertTrue( d.setLevelAndVersion(2,1,false) == true );
assertTrue( d.setLevelAndVersion(1,2,false) == true );
assertTrue( d.setLevelAndVersion(1,1,false) == false );
d = null;
}
示例3: test_SBMLDocument_createWith
public void test_SBMLDocument_createWith()
{
SBMLDocument d = new SBMLDocument(1,2);
assertTrue( d.getTypeCode() == libsbml.SBML_DOCUMENT );
assertTrue( d.getNotes() == null );
assertTrue( d.getAnnotation() == null );
assertTrue( d.getLevel() == 1 );
assertTrue( d.getVersion() == 2 );
assertTrue( d.getNumErrors() == 0 );
d = null;
}
示例4: test_internal_consistency_check_99902
public void test_internal_consistency_check_99902()
{
SBMLDocument d = new SBMLDocument(2,4);
long errors;
Compartment c = new Compartment(2,4);
d.setLevelAndVersion(1,2,false);
Model m = d.createModel();
c.setCompartmentType("hh");
c.setId("c");
m.addCompartment(c);
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 10103 );
d = null;
}
示例5: test_internal_consistency_check_99903
public void test_internal_consistency_check_99903()
{
SBMLDocument d = new SBMLDocument(2,4);
long errors;
Compartment c = new Compartment(2,4);
d.setLevelAndVersion(1,2,false);
Model m = d.createModel();
c.setConstant(true);
c.setId("c");
m.addCompartment(c);
Rule r = m.createAssignmentRule();
r.setVariable("c");
r.setFormula("2*3");
errors = d.checkInternalConsistency();
assertTrue( errors == 3 );
d = null;
}
示例6: test_SBMLConvert_convertFromL3
public void test_SBMLConvert_convertFromL3()
{
SBMLDocument d = new SBMLDocument(3,1);
Model m = d.createModel();
string sid = "C";
Compartment c = m.createCompartment();
c.setId(sid);
c.setSize(1.2);
c.setUnits( "volume");
assertTrue( d.setLevelAndVersion(1,1,true) == false );
assertTrue( d.setLevelAndVersion(1,2,true) == false );
assertTrue( d.setLevelAndVersion(2,1,true) == false );
assertTrue( d.setLevelAndVersion(2,2,true) == false );
assertTrue( d.setLevelAndVersion(2,3,true) == false );
assertTrue( d.setLevelAndVersion(2,4,true) == false );
assertTrue( d.setLevelAndVersion(3,1,true) == true );
}
示例7: test_SBMLDocument_setLevelAndVersion_Error
public void test_SBMLDocument_setLevelAndVersion_Error()
{
SBMLDocument d = new SBMLDocument();
d.setLevelAndVersion(2,1,true);
Model m1 = new Model(2,1);
Unit u = new Unit(2,1);
u.setKind(libsbml.UnitKind_forName("mole"));
u.setOffset(3.2);
UnitDefinition ud = new UnitDefinition(2,1);
ud.setId( "ud");
ud.addUnit(u);
m1.addUnitDefinition(ud);
d.setModel(m1);
assertTrue( d.setLevelAndVersion(2,2,true) == false );
assertTrue( d.setLevelAndVersion(2,3,true) == false );
assertTrue( d.setLevelAndVersion(1,2,true) == false );
assertTrue( d.setLevelAndVersion(1,1,true) == false );
d = null;
}
示例8: 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;
}
示例9: test_SBMLConvert_addModifiersToReaction
public void test_SBMLConvert_addModifiersToReaction()
{
SBMLDocument d = new SBMLDocument(1,2);
Model m = d.createModel();
Reaction r = m.createReaction();
KineticLaw kl = r.createKineticLaw();
kl.setFormula( "k1*S1*S2*S3*S4*S5");
SimpleSpeciesReference ssr1;
SimpleSpeciesReference ssr2;
Species s1 = m.createSpecies();
s1.setId( "S1" );
Species s2 = m.createSpecies();
s2.setId( "S2");
Species s3 = m.createSpecies();
s3.setId( "S3");
Species s4 = m.createSpecies();
s4.setId( "S4");
Species s5 = m.createSpecies();
s5.setId( "S5");
SpeciesReference sr1 = r.createReactant();
SpeciesReference sr2 = r.createReactant();
SpeciesReference sr3 = r.createProduct();
sr1.setSpecies( "S1");
sr2.setSpecies( "S2");
sr3.setSpecies( "S5");
assertTrue( r.getNumModifiers() == 0 );
assertTrue( d.setLevelAndVersion(2,1,false) == true );
assertTrue( d.getLevel() == 2 );
assertTrue( d.getVersion() == 1 );
assertTrue( m.getReaction(0).getNumModifiers() == 2 );
ssr1 = m.getReaction(0).getModifier(0);
ssr2 = m.getReaction(0).getModifier(1);
assertTrue(( "S3" == ssr1.getSpecies() ));
assertTrue(( "S4" == ssr2.getSpecies() ));
d = null;
}
示例10: getCPtr
internal static HandleRef getCPtr(SBMLDocument obj)
{
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
示例11: writeSBMLToString
/**
* Writes the given SBML document @p d to an in-memory string and
* returns the string.
*
* This is a convenience function that uses the
* SBMLWriter::writeSBMLToString(SBMLDocument d) method internally,
* yet does not require the caller to create an SBMLWriter object first.
*
* @param d an SBMLDocument object to be written out in XML format
*
* @return the string on success and @c null if one of the underlying parser
* components fail.
*
* @if clike @warning Note that the string is owned by the caller and
* should be freed (with the normal string <c>free()</c> C++
* function) after it is no longer [email protected]
*/
public static string writeSBMLToString(SBMLDocument d)
{
string ret = libsbmlPINVOKE.writeSBMLToString(SBMLDocument.getCPtr(d));
return ret;
}
示例12: validate
/**
* Validates the given SBMLDocument object.
*
* This is identical to calling setDocument(@if java SBMLDocument d @endif)
* followed by validate().
*
* @param d the SBML document to validate
*
* @return the number of validation failures that occurred. The objects
* describing the actual failures can be retrieved using getFailures().
*/
public long validate(SBMLDocument d)
{
return (long)libsbmlPINVOKE.SBMLValidator_validate__SWIG_1(swigCPtr, SBMLDocument.getCPtr(d));
}
示例13: testWriteSBML
static void testWriteSBML(SBMLDocument d, string file)
{
try
{
if ( libsbml.writeSBML(d, file) == 0)
{
ERR("[WriteSBML] Error: cannot write " + file);
}
else
{
OK();
}
}
catch (Exception e)
{
ERR("[WriteSBML] (" + file + ") Error: Exception thrown : " + e.Message);
}
try
{
string sbmlstr = libsbml.writeSBMLToString(d);
if ( libsbml.writeSBML(libsbml.readSBMLFromString(sbmlstr), file) == 0)
{
ERR("[WriteSBML] Error: cannot write " + file);
}
else
{
OK();
}
}
catch (Exception e)
{
ERR("[WriteSBML] (" + file + ") Error: Exception thrown : " + e.Message);
}
}
示例14: testCreateSBML
static void testCreateSBML()
{
SBMLDocument d = new SBMLDocument(defLevel,defVersion);
Model m = d.createModel();
m.setId("testmodel");
Compartment c1 = m.createCompartment();
Compartment c2 = m.createCompartment();
c1.setId("c1");
c2.setId("c2");
Species s1 = m.createSpecies();
Species s2 = m.createSpecies();
string id1 = "s1";
string id2 = "s2";
// strings with non-ASCII characters (multibyte characters)
string n1 = "γ-lyase";
string n2 = "β-synthase";
s1.setId(id1);
s1.setName(n1);
s1.setCompartment("c1");
s2.setId(id2);
s2.setName(n2);
s2.setCompartment("c2");
string file = "test2.xml";
try
{
if ( libsbml.writeSBML(d, file) == 0)
{
ERR("[CreateSBML] Error: cannot write " + file);
}
else
{
OK();
}
}
catch (Exception e)
{
ERR("[CreateSBML] (" + file + ") Error: Exception thrown : " + e.Message);
}
testReadSBMLFromFile(file);
}
示例15: disableUnusedPackages
/**
* Disables unused packages.
*
* This method walks through all extensions in the list of plugins of the
* given SBML document @p doc, and disables all that are not being used.
*
* @param doc the SBMLDocument object whose unused package extensions
* should be disabled.
*/
public void disableUnusedPackages(SBMLDocument doc)
{
libsbmlPINVOKE.SBMLExtensionRegistry_disableUnusedPackages(swigCPtr, SBMLDocument.getCPtr(doc));
}