Examples of SBMLDocument


Examples of org.sbml.jsbml.SBMLDocument

   */
  @SuppressWarnings("deprecation")
@Test public void test_read_l2v1_assignment()
  {
    SBMLReader reader = new SBMLReader();
    SBMLDocument d = null;
    Model m;
    Compartment c;
    Species s;
    Parameter gp;
    LocalParameter lp;
    AssignmentRule ar;
    Reaction r;
    SpeciesReference sr;
    KineticLaw kl;
    UnitDefinition ud;
    Reaction r1;
    ListOf<Compartment> loc;
    Compartment c1;
    ListOf<Rule> lor;
    AssignmentRule ar1;
    ListOf<Parameter> lop;
    Parameter p1;
    ListOf<Species> los;
    Species s1;
    String filename = new String( DATA_FOLDER + "/libsbml-test-data/" );
    filename += "l2v1-assignment.xml";
    try {
    d = reader.readSBML(filename);
  } catch (IOException e) {
    e.printStackTrace();
    assert(false);
  } catch (XMLStreamException e) {
    e.printStackTrace();
    assert(false);
  }

  System.out.println(" TestReadFromFile 5: reading done.");
 
  assertTrue( d.getLevel() == 2 );
    assertTrue( d.getVersion() == 1 );
    m = d.getModel();
    assertTrue( m != null );
    assertTrue( m.getCompartmentCount() == 1 );
    c = m.getCompartment(0);
    assertTrue( c != null );
    assertTrue( c.getId().equals( "cell") );
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

   * Tries to use getNotesString on a model without a notes element.
   */
  @Test public void getNotesStringOnModel() throws IOException, XMLStreamException {
    String fileName = DATA_FOLDER + "/libsbml-test-data/l1v1-minimal.xml";
   
    SBMLDocument doc = new SBMLReader().readSBML(fileName);
        assertNotNull(doc.getModel().getNotesString());
    assertTrue(doc.getModel().getNotesString() == "");
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

* @version $Rev: 1524 $
*/
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");
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

   * @throws XMLStreamException
   */
  @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));
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

   * @throws SBMLException
   */
  public static void main(String[] args) throws SBMLException, XMLStreamException
  {

    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");

View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

* @version $Rev: 1524 $
*/
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/");
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

   *            The path to an SBML file.
   */
  public JTreeOfSBML(String fileName) {
    super();
    try {
      SBMLDocument doc = new SBMLReader().readSBML(fileName);
      showGUI(doc);
    } catch (Exception exc) {
      exc.printStackTrace();
      JOptionPane.showMessageDialog(this, exc.getMessage(), exc
          .getClass().getSimpleName(), JOptionPane.ERROR_MESSAGE);
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

      dispose();
    }
  }

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

Examples of org.sbml.jsbml.SBMLDocument

   * @throws ParseException
   * @throws XMLStreamException
   * @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"));
    ev.createEventAssignment("s1", ASTNode.parseFormula("s2"));
    System.out.println("==================================");
    new SBMLWriter().write(doc, System.out);
    System.out.println("\n==================================");
    doc.setLevelAndVersion(2, 4);
    System.out.println("==================================");
    new SBMLWriter().write(doc, System.out);
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLDocument

   * Tries to validate biomodels file with id 228.
   */
  @Test public void checkConsistency() throws IOException, XMLStreamException {
    String fileName = DATA_FOLDER + "/l2v4/BIOMD0000000228.xml";
   
    SBMLDocument doc = new SBMLReader().readSBML(fileName);

    int nbErrors = doc.checkConsistency();

    System.out.println("Found " + nbErrors + " errors on Biomodels 228 with the unit checking turned off.");
   
    // assertTrue(nbErrors > 0); // not sure what is happening with this model and the online validator !!!
    assertTrue(nbErrors == 0); // sometimes there is an error, sometimes no errors !
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.