An example of creating a model using SBML Level 3 Qualitative Models.
using System.Collections.Generic;
public class qual_example1
{
public static int Main(string[] args)
{
SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1, "qual", 1);
SBMLDocument document = new SBMLDocument(sbmlns);
document.setPackageRequired("qual", true);
Model model = document.createModel();
Compartment compartment = model.createCompartment();
compartment.setId("c");
compartment.setConstant(true);
QualModelPlugin mplugin = (QualModelPlugin)(model.getPlugin("qual"));
QualitativeSpecies qs = mplugin.createQualitativeSpecies();
qs.setId("s1");
qs.setCompartment("c");
qs.setConstant(false);
qs.setInitialLevel(1);
qs.setMaxLevel(4);
qs.setName("sss");
Transition t = mplugin.createTransition();
t.setId("d");
t.setSBOTerm(1);
Input i = t.createInput();
i.setId("RD");
i.setQualitativeSpecies("s1");
i.setTransitionEffect(libsbml.INPUT_TRANSITION_EFFECT_NONE);
i.setSign(libsbml.INPUT_SIGN_NEGATIVE);
i.setThresholdLevel(2);
i.setName("aa");
Output o = t.createOutput();
o.setId("wd");
o.setQualitativeSpecies("s1");
o.setTransitionEffect(libsbml.OUTPUT_TRANSITION_EFFECT_PRODUCTION);
o.setOutputLevel(2);
o.setName("aa");
FunctionTerm ft = t.createFunctionTerm();
ASTNode math = libsbml.parseL3Formula("geq(s1, 2)");
ft.setResultLevel(1);
ft.setMath(math);
DefaultTerm dt = t.createDefaultTerm();
dt.setResultLevel(2);
int result = libsbml.writeSBML(document, "qual_example1.xml");
if (result == 1)
{
Console.WriteLine("Wrote file");
return 0;
}
else
{
Console.WriteLine("Failed to write");
return 1;
}
}
}