Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBMLDocument


    // TODO: make it generic by using reflection on the contextObject

    if (contextObject instanceof SBMLDocument)
    {
      SBMLDocument sbmlDoc = (SBMLDocument) contextObject;
      CompSBMLDocumentPlugin compSBMLDoc = null;

      if (sbmlDoc.getExtension(namespaceURI) != null) {
        compSBMLDoc = (CompSBMLDocumentPlugin) sbmlDoc.getExtension(namespaceURI);
      } else {
        compSBMLDoc = new CompSBMLDocumentPlugin(sbmlDoc);
        sbmlDoc.addExtension(namespaceURI, compSBMLDoc);
      }

      if (elementName.equals(CompConstants.listOfExternalModelDefinitions))
      {
        return compSBMLDoc.getListOfExternalModelDefinitions();
View Full Code Here


  public void test_L3_Groups_read1() throws XMLStreamException,
  InvalidPropertiesFormatException, IOException,
  ClassNotFoundException {
    String fileName = DATA_FOLDER + "/groups/groups1.xml";

    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();

    System.out.println("Model extension objects: "
        + model.getExtension(GROUPS_NAMESPACE));
    GroupsModelPlugin extendedModel = (GroupsModelPlugin) model
        .getExtension(GROUPS_NAMESPACE);
View Full Code Here

  InstantiationException, IllegalAccessException,
  InvalidPropertiesFormatException, IOException,
  ClassNotFoundException, SBMLException, SAXException {
    String fileName = DATA_FOLDER + "/groups/groups1.xml";

    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);

    new SBMLWriter().write(doc, DATA_FOLDER + "/groups/groups1_write.xml");
  }
View Full Code Here

      if (model != null) {
        instance = model.findNamedSBase(idRef);
      }
    } else if (isSetMetaIdRef()) {
      SBMLDocument doc = getSBMLDocument();

      if (doc != null) {
        instance = doc.findSBase(metaIdRef);
      }
    }

    return instance;
  }
View Full Code Here

    {
      DATA_FOLDER = System.getProperty("user.dir") + "/extensions/layout/test/org/sbml/jsbml/xml/test/data";
    }
    String fileName = DATA_FOLDER + "/layout/GlycolysisLayout_small.xml";

    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();

    System.out.println("Model extension objects: " + model.getExtension(LAYOUT_NAMESPACE));
    LayoutModelPlugin extendedModel = (LayoutModelPlugin) model.getExtension(LAYOUT_NAMESPACE);

    System.out.println("Nb Layouts = " + extendedModel.getListOfLayouts().size());
View Full Code Here

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

    SBMLDocument d = new SBMLDocument(3,1);
    Model model = d.createModel("testLayoutWriting");

    LayoutModelPlugin lModel = new LayoutModelPlugin(model);
    Layout layout = lModel.createLayout("layout");

    model.addExtension(LayoutConstants.namespaceURI, lModel);

    ReactionGlyph rg = new ReactionGlyph("react_r1", model.getLevel(), model.getVersion());

    SpeciesReferenceGlyph srg1 = rg.createSpeciesReferenceGlyph("srg_r1_s1", "SPG1");
    SpeciesReferenceGlyph srg2 = rg.createSpeciesReferenceGlyph("srg_r1_s2", "SPG2");
    srg1.setRole(SpeciesReferenceRole.SUBSTRATE);
    srg2.setRole(SpeciesReferenceRole.PRODUCT);

    assert(model.findNamedSBase("srg_r1_s1") == null);

    BoundingBox bbRg = rg.createBoundingBox(10.0, 10.0, 0.0);
    bbRg.setPosition(new Point(100.0, 0.0, 0.0));

    //    Curve c = new Curve(3, 1);
    Curve c = srg1.createCurve();
    //    CurveSegmentImpl cs1 = (CurveSegmentImpl) c.createCurveSegment();
    //    CubicBezier cs1 = new CubicBezier();
    CubicBezier cs1 = c.createCubicBezier();
    cs1.setStart(new Point(35.0, 10.0, 0.0));
    cs1.setEnd(new Point(100.0, 10.0, 0.0));
    cs1.setBasePoint1(new Point(25, 35, 45));
    cs1.setBasePoint2(new Point(55, 65, 75));

    //    ListOf<CurveSegment> csList = new ListOf<CurveSegment>();
    //    csList.add(cs1);
    //    c.setListOfCurveSegments(csList);
    //    srg1.setCurve(c);

    LineSegment cs2 = new LineSegment();
    cs2.createStart(110.0, 10.0, 0.0);
    cs2.createEnd(235.0, 10.0, 0.0);
    Curve c2 = new Curve();
    ListOf<CurveSegment> csList2 = new ListOf<CurveSegment>();
    csList2.add(cs2);
    c2.setListOfCurveSegments(csList2);
    srg2.setCurve(c2);

    BoundingBox bbSrg2 = srg2.createBoundingBox();
    bbSrg2.setPosition(new Point(110.0, 10.0, 0.0));
    bbSrg2.setDimensions(new Dimensions(200.0, 10.0, 0, model.getLevel(), model.getVersion()));

    layout.addReactionGlyph(rg);

    assert(model.findNamedSBase("srg_r1_s1") != null);

    String writtenDocument = JSBML.writeSBMLToString(d);

    System.out.println(writtenDocument);

    SBMLDocument d2 = JSBML.readSBMLFromString(writtenDocument);

    assert(d2.getModel().findNamedSBase("srg_r1_s1") != null);

    SpeciesReferenceGlyph testSRG1 = (SpeciesReferenceGlyph) d2.getModel().findNamedSBase("srg_r1_s1");

    assert(testSRG1.getCurve().getListOfCurveSegments().size() == 1);

    CurveSegment cs1BisCS = testSRG1.getCurve().getListOfCurveSegments().getFirst();
    CubicBezier cs1Bis = (CubicBezier) cs1BisCS;
View Full Code Here

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

    SBMLDocument sbmlDoc = new SBMLDocument(3, 1);
    Model model = sbmlDoc.createModel("m_default_name");

    model.getHistory().addModifiedDate(Calendar.getInstance().getTime());
    model.getAnnotation().addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:obo.go:GO%3A1234567"));

    QualitativeModel qModel = new QualitativeModel(model);
View Full Code Here

          logger.debug("event.isEndElement : sbml element found");
         
          // process the end of the document and return
          // the final SBMLDocument
          if (sbmlElements.peek() instanceof SBMLDocument) {
            SBMLDocument sbmlDocument = (SBMLDocument) sbmlElements.peek();
           
            Iterator<Entry<String, ReadingParser>> iterator = initializedParsers.entrySet().iterator();           
            ArrayList<String> readingParserClasses = new ArrayList<String>();

            // Calling endDocument for all parsers           
View Full Code Here

 
  /**
   *
   */
  @Before public void setUp() {
    doc = new SBMLDocument(2, 4);
    model = doc.createModel("model");
   
    Compartment comp = model.createCompartment("cell");
    comp.setMetaId("cell");
   
View Full Code Here

   * Initialize an object
   */
  @Before
  public void init() {
    int level = 3, version = 1;
    SBMLDocument doc = new SBMLDocument(level, version);
    Model model = doc.createModel("test_model");
    sbase = model.createParameter("test_param");
    kind = Unit.Kind.AMPERE;
    assertTrue(!sbase.isSetUnits());
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.SBMLDocument

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.