Package org.sbml.jsbml

Examples of org.sbml.jsbml.Model


public class ListenerTest implements TreeNodeChangeListener {

  public ListenerTest() {
    SBMLDocument doc = new SBMLDocument(2, 2);
    doc.addTreeNodeChangeListener(this);
    Model model = doc.createModel("test_model");
    Parameter p1 = model.createParameter("p1");
    p1.setId("p2");
    model.removeParameter(p1);

    Compartment c = model.createCompartment("c");
    c.setSize(4.3);
    c.setSBOTerm(SBO.getPhysicalCompartment());

    Species s1 = model.createSpecies("s1", c);
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        Qualifier.BQB_IS, "urn:miriam:kegg.compound:C12345"));
    s1.setValue(23.7);
    model.removeSpecies(s1);

    try {
      System.out.println();
      new SBMLWriter().write(doc, System.out);
    } catch (Exception exc) {
View Full Code Here


   */
  @SuppressWarnings("deprecation")
  public static void main(String[] args) throws ParseException,
      XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(3, 1);
    Model model = doc.createModel("test_model");
    Parameter p = model.createParameter("p1");
    p.setValue(1d);
    Event e = model.createEvent("e1");
    Priority prior = e.createPriority();
    prior.setMath(new ASTNode(1));
    Trigger t = e.createTrigger();
    t.setFormula("time == 1");
    EventAssignment ea = e.createEventAssignment(p, ASTNode
View Full Code Here

  {

    SBMLDocument sbmlDoc = new SBMLDocument(3, 1);
    sbmlDoc.addDeclaredNamespace("xmlns:html", "http://www.w3.org/1999/xhtml");
    sbmlDoc.addNamespace("ns1", "xmlns", "http://www.test.com");
    Model sbmlModel = sbmlDoc.createModel("test_model");
    sbmlModel.addDeclaredNamespace("html", "http://www.w3.org/1999/xhtml");
    sbmlModel.addDeclaredNamespace("ns1", "http://www.test.com");
    // sbmlModel.addDeclaredNamespace("toto:ns2", "http://www.test.com");
    sbmlModel.addDeclaredNamespace("xmlns:ns3", "http://www.test.com");

    // but it is not working. In the output file written with:
   
    SBMLWriter ttt = new SBMLWriter();
    System.out.println( ttt.writeSBMLToString(sbmlDoc) );
View Full Code Here

public class SpeciesAnnotationTest extends SimpleTreeNodeChangeListener {

  public SpeciesAnnotationTest() throws XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(2, 4);
    doc.addTreeNodeChangeListener(this);
    Model model = doc.createModel("model_test");
    Species s1 = model.createSpecies("s1", model.createCompartment("c1"));
    s1.setMetaId("meta_" + s1.getId());
    // Not necessary anymore.
    // s1.getAnnotation().addRDFAnnotationNamespace("bqbiol", "",
    // "http://biomodels.net/biology-qualifiers/");
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
View Full Code Here

    }
  }

  private SBMLDocument createDefaultDocument() {
    SBMLDocument doc = new SBMLDocument(2, 4);
    Model m = doc.createModel("untitled");
    m.createSpecies("s1");
    return doc;
  }
View Full Code Here

   *
   * @param doc
   */
  private void showGUI(SBMLDocument doc) {
    if (doc.isSetModel()) {
      Model m = doc.getModel();
      String title = "Content of model \"";
      if (m.isSetName()) {
        title += m.getName();
      } else if (m.isSetId()) {
        title += m.getId();
      } else {
        title += "undefined";
      }
      setTitle(title + "\"");
    } else {
View Full Code Here

   * @throws SBMLException
   */
  public EventTest() throws ParseException, XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(3, 1);
    doc.addTreeNodeChangeListener(this);
    Model model = doc.createModel("event_model");
    Compartment c = model.createCompartment("compartment");
    model.createSpecies("s1", c);
    model.createSpecies("s2", c);
    Event ev = model.createEvent();
    Trigger trigger = ev.createTrigger(false, true, ASTNode.parseFormula("3 >= 2"));
    trigger.setMath(ASTNode.geq(new ASTNode(ASTNode.Type.NAME_TIME),
        new ASTNode(10)));
    ev.createPriority(ASTNode.parseFormula("25"));
    ev.createDelay(ASTNode.parseFormula("2"));
View Full Code Here

  private Model M;

  @Before
  public void setUp() throws Exception {
    M = new Model(2, 4);
  }
View Full Code Here

      ClassNotFoundException, InstantiationException,
      IllegalAccessException, UnsupportedLookAndFeelException {

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    Model m = new Model("test", 2, 4);
    m.createFunctionDefinition("f");
    m.createRateRule();
    FormulaParser parser;

    for (int i = 0; i < testCases.length; i++) {
      System.out.printf("%d.\treading:\t%s\n", i, testCases[i]);
      parser = new FormulaParser(new StringReader(testCases[i]));
View Full Code Here

   */
  public MathMLTest() {
    int level = 3;
    int version = 1;
    SBMLDocument doc = new SBMLDocument(level, 1);
    Model m = doc.createModel("id");
    FunctionDefinition fd = m.createFunctionDefinition("fd");
    ASTNode math = new ASTNode(Type.LAMBDA, fd);
    math.addChild(new ASTNode("x", fd));
    ASTNode pieces = ASTNode.piecewise(new ASTNode(3, fd), ASTNode.lt("x",
        ASTNode.abs(Double.NEGATIVE_INFINITY, fd)), ASTNode.times(
        new ASTNode(5.3, fd), ASTNode.log(new ASTNode(8, fd))));
    pieces = ASTNode.times(pieces, ASTNode.root(new ASTNode(2, fd),
        new ASTNode(16, fd)));
    math.addChild(pieces);
    fd.setMath(math);
    System.out.println(math.toMathML());
   
    Species species = m.createSpecies("spec");
    Reaction r = m.createReaction("r");
    r.addReactant(new SpeciesReference(species));
    KineticLaw kl = new KineticLaw(level, version);
    math = new ASTNode(fd, kl);
    math.addChild(new ASTNode(species, kl));
    math = ASTNode.times(math, new ASTNode(3.7, 8, kl));
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Model

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.