本文整理汇总了C#中libsbml.SBMLDocument类的典型用法代码示例。如果您正苦于以下问题:C# SBMLDocument类的具体用法?C# SBMLDocument怎么用?C# SBMLDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SBMLDocument类属于libsbml命名空间,在下文中一共展示了SBMLDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:26,代码来源:TestSBMLConvertStrict.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:11,代码来源:TestSBMLDocument.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:11,代码来源:TestSBMLDocument.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:15,代码来源:TestInternalConsistencyChecks.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:17,代码来源:TestInternalConsistencyChecks.cs
示例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 );
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:17,代码来源:TestSBMLConvert.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:19,代码来源:TestSBMLDocument.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:22,代码来源:TestSBMLConvertStrict.cs
示例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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:36,代码来源:TestSBMLConvert.cs
示例10: getCPtr
internal static HandleRef getCPtr(SBMLDocument obj)
{
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:4,代码来源:SBMLDocument.cs
示例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;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:22,代码来源:libsbml.cs
示例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));
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:15,代码来源:SBMLValidator.cs
示例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);
}
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:36,代码来源:TestRW.cs
示例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);
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:50,代码来源:TestRW.cs
示例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));
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:13,代码来源:SBMLExtensionRegistry.cs
示例16: getCPtrAndDisown
internal static HandleRef getCPtrAndDisown(SBMLDocument obj)
{
HandleRef ptr = new HandleRef(null, IntPtr.Zero);
if (obj != null)
{
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
}
return ptr;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:12,代码来源:SBMLDocument.cs
示例17: SBMLDocument
/**
* Copy constructor; creates a copy of this SBMLDocument.
*/
public SBMLDocument(SBMLDocument rhs)
: this(libsbmlPINVOKE.new_SBMLDocument__SWIG_4(SBMLDocument.getCPtr(rhs)), true)
{
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:8,代码来源:SBMLDocument.cs
示例18: writeSBML
/**
* Writes the given SBML document to the output stream.
*
* @param d the SBML document to be written
*
* @param stream the stream object where the SBML is to be written.
*
* @return @c true on success and @c false if one of the underlying
* parser components fail (rare).
*
* @see setProgramVersion(string version)
* @see setProgramName(string name)
*/
public bool writeSBML(SBMLDocument d, OStream stream)
{
bool ret = libsbmlPINVOKE.SBMLWriter_writeSBML__SWIG_1(swigCPtr, SBMLDocument.getCPtr(d), SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()));
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:19,代码来源:SBMLWriter.cs
示例19: isInUse
/**
* Indicates whether this extension is being used by the given SBMLDocument.
*
* The default implementation returns @c true. This means that when a
* document had this extension enabled, it will not be possible to convert
* it to SBML Level 2 as we cannot make sure that the extension can be
* converted.
*
* @param doc the SBML document to test.
*
* @return a boolean indicating whether the extension is actually being
* used by the document.
*/
public new bool isInUse(SBMLDocument doc)
{
bool ret = libsbmlPINVOKE.SBMLExtension_isInUse(swigCPtr, SBMLDocument.getCPtr(doc));
return ret;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:18,代码来源:SBMLExtension.cs
示例20: writeSBMLToFile
/**
* Writes the given SBML document to filename.
*
* @htmlinclude assuming-compressed-file.html
*
* @param d the SBML document to be written
*
* @param filename the name or full pathname of the file where the SBML
* is to be written.
*
* @return @c true on success and @c false if the filename could not be
* opened for writing.
*
* @note @htmlinclude note-writing-zipped-files.html
*
* @see setProgramVersion(string version)
* @see setProgramName(string name)
*/
public bool writeSBMLToFile(SBMLDocument d, string filename)
{
bool ret = libsbmlPINVOKE.SBMLWriter_writeSBMLToFile(swigCPtr, SBMLDocument.getCPtr(d), filename);
return ret;
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:23,代码来源:SBMLWriter.cs
注:本文中的libsbml.SBMLDocument类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论