Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBMLDocument


   * @param args
   * @throws IOException
   * @throws XMLStreamException
   */
  public static void main(String[] args) throws XMLStreamException, IOException {
    SBMLDocument doc = SBMLReader.read(new File(args[0]));
    Filter filter = new NameFilter(args[1]);
    System.out.println(doc.filter(filter));
  }
View Full Code Here


  /**
   * @throws java.lang.Exception
   */
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    doc = new SBMLDocument(3, 1);
    Model m = doc.createModel("test_model");
   
    Compartment c = m.createCompartment("default");
    c.setSpatialDimensions(3d);
   
View Full Code Here

   * @throws InvalidPropertiesFormatException
   */
  @SuppressWarnings("deprecation")
  @Test
  public void test_read_l1v1_branch() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    SBMLDocument d;
    Model m;
    Compartment c;
    KineticLaw kl;
    LocalParameter p;
    Reaction r;
    Species s;
    SpeciesReference sr;
    UnitDefinition ud;
    String filename = DATA_FOLDER + "/libsbml-test-data/l1v1-branch.xml";
    d = new SBMLReader().readSBML(filename);
    if (d == null)
      ;
    {
    }
    assertTrue(d.getLevel() == 1);
    assertTrue(d.getVersion() == 1);
    m = d.getModel();
    assertTrue(m.getName().equals("Branch"));
    assertTrue(m.getCompartmentCount() == 1);
    c = m.getCompartment(0);
    assertTrue(c.getName().equals("compartmentOne"));
    assertTrue(c.getVolume() == 1);
View Full Code Here

  @SuppressWarnings("deprecation")
  @Test public void read1() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    // URL fileUrl = this.getClass().getResource("./data/BIOMD0000000025.xml");
    String fileName = DATA_FOLDER + "/l2v1/BIOMD0000000025.xml";
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 2 && doc.getVersion() == 1);
   
    // TODO: assertTrue(model.getLevel() == 2 && model.getVersion() == 1);
   
    assertTrue(model.getId().equals("Smolen2002"));
    assertTrue(model.getName().equals("Smolen2002_CircClock"));
View Full Code Here

        int modelLevel = model.getLevel();
        int modelVersion = model.getVersion();

        // SBMLDocument object for submodel
        SBMLDocument subModelSbmlDocument = new SBMLDocument(modelLevel, modelVersion);
        SBMLDocument originalDocument = model.getSBMLDocument();
       
        if (originalDocument != null) {
         
          // Copying namespaces
          if (originalDocument.getSBMLDocumentNamespaces() != null && originalDocument.getSBMLDocumentNamespaces().size() > 0)
          {
            for (String prefix : originalDocument.getSBMLDocumentNamespaces().keySet()) {
              String namespaceURI = originalDocument.getSBMLDocumentNamespaces().get(prefix);
             
              subModelSbmlDocument.addNamespace(prefix, null, namespaceURI);
            }
          }
         
          // Copying attributes
          if (originalDocument.getSBMLDocumentAttributes() != null && originalDocument.getSBMLDocumentAttributes().size() > 0)
          {
            for (String attributeName : originalDocument.getSBMLDocumentAttributes().keySet()) {
              String attributeValue = originalDocument.getSBMLDocumentAttributes().get(attributeName);
             
              subModelSbmlDocument.readAttribute(attributeName, null, attributeValue);
            }
          }
        }
View Full Code Here

   * @throws InvalidPropertiesFormatException
   */
  @Test public void read3() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    String fileName = DATA_FOLDER + "/l2v4/BIOMD0000000228.xml"; // l2v4
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 2 && doc.getVersion() == 4);
   
    assertTrue(model.getId().equals(""));
    assertTrue(model.getName().equals("Swat2004_Mammalian_G1_S_Transition"));

    Compartment cell = model.getCompartment(0);
View Full Code Here

    // If the namespaces are declared in the sbml node, we need to add the
    // namespace to
    // the 'SBMLDocumentNamespaces' map of the SBMLDocument instance.
    else if (elementName.equals("sbml")
        && contextObject instanceof SBMLDocument) {
      SBMLDocument sbmlDocument = (SBMLDocument) contextObject;
      sbmlDocument.addNamespace(localName, prefix, URI);
    }
  }
View Full Code Here

   * @throws InvalidPropertiesFormatException
   */
  @Test public void read4() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    String fileName = DATA_FOLDER + "/l2v4/BIOMD0000000229.xml"; // l2v4
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 2 && doc.getVersion() == 4);
   
    assertTrue(model.getId().equals("Ma2002_cAMP_oscillations"));
    assertTrue(model.getName().equals("Ma2202_cAMP_oscillations"));
   
    System.out.println(" Create date, read: " + model.getHistory().getCreatedDate() + ", from file: 2009-08-18T15:45:28Z");
View Full Code Here

   * @throws InvalidPropertiesFormatException
   */
  @Test public void read5() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    String fileName = DATA_FOLDER + "/l2v3/BIOMD0000000191.xml"; // l2v3
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 2 && doc.getVersion() == 3);
   
    assertTrue(model.getUnitDefinitionCount() == 4);
   
    UnitDefinition microM = model.getUnitDefinition(2);
    UnitDefinition microMById = model.getUnitDefinition("microM");
View Full Code Here

   * @throws SAXException
   */
  @Test public void write1() throws XMLStreamException, InstantiationException, IllegalAccessException, InvalidPropertiesFormatException, IOException, ClassNotFoundException, SBMLException, SAXException{
    String fileName = DATA_FOLDER + "/l2v1/BIOMD0000000025.xml";
 
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
   
    String resultFileName = "biomd-025.xml";
   
    new SBMLWriter().write(doc, resultFileName);
  }
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.