Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBMLDocument


    }
  }
   
  private static SBMLDocument writeLayoutOfNetworkViewToSBMLDocument(CyNetworkView view){
    CyNetwork network = view.getNetwork();
    SBMLDocument doc = NavigationPanel.getInstance().getSBMLDocumentForCyNetwork(network);
    if (doc != null){
      int level = 3;
      int version = 1;
      doc.setLevelAndVersion(level, version);
      Model model = doc.getModel();
      model.setLevel(level);
      model.setVersion(version);
     
      // Get LayoutModel
      LayoutModelPlugin layoutModel = LayoutExtension.getOrCreateLayoutModel(doc);
View Full Code Here


 
  public SBMLDocument getCurrentSBMLDocument(){
    return sbmlDocuments.getCurrentDocument();
  }
  public SBMLDocument getSBMLDocumentForCyNetwork(CyNetwork network){
    SBMLDocument doc = null;
    if (network != null){
      String networkId = network.getIdentifier();
      doc = sbmlDocuments.getDocumentForNetworkId(networkId);
    }
    return doc;
View Full Code Here

      updateNavigationTree();
    }
  }
 
  private void updateNavigationTree(){
    SBMLDocument doc = sbmlDocuments.getCurrentDocument();
    if (doc != null){
      navigationTree = new NavigationTree(doc)
    } else{
      navigationTree = new NavigationTree();
    }
View Full Code Here

  }
 
  public void displayReactionsInCurrentSBMLDocument(){
    // Get the current SBML document via Singleton instance of the navigatin panel
    NavigationPanel panel = NavigationPanel.getInstance();
    SBMLDocument doc = panel.getCurrentSBMLDocument();
   
    // Work with the current SBML document
    String text = null;
    if (doc == null){
      text = "No SBML document available for current network";
    }
    else {
      // Access to the SBMLDocument
      Model model = doc.getModel();
      text = String.format("Current SBML document: id=%s", model.getId());
    }
    JOptionPane.showMessageDialog(
        Cytoscape.getDesktop(),
        text,
View Full Code Here

      openValidationPanel();
    }
   
    public void openValidationPanel(){
     
      SBMLDocument doc = NavigationPanel.getInstance().getCurrentSBMLDocument();
      if (doc == null){
        JOptionPane.showMessageDialog(Cytoscape.getDesktop(),
          "<html>SBML network has to be loaded before validation.<br>" +
          "Import network from BioModel or load network from file or URL first.");
      }
View Full Code Here

    return data;
    }

    @Test
  public void isSBMLDocumentGRNTest() throws XMLStreamException, IOException {
    SBMLDocument doc = SBMLReader.read(file);
    boolean isGRN = GeneRegulatoryNetwork.isSBMLDocumentGRN(doc);
    assertTrue(isGRN);
  }
View Full Code Here

   * @throws XMLStreamException
   * @throws SBMLException
   */
  @SuppressWarnings("deprecation")
  public static void main(String args[]) throws ParseException, XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(1, 2);
    Model m = doc.createModel();
    Compartment c = m.createCompartment("c1");
    Species s1 = m.createSpecies("s1", c);
    Species s2 = m.createSpecies("s2", c);
    Reaction r = m.createReaction("r1");
    r.createReactant(null, s1);
View Full Code Here

      System.exit(1);
    }

    String filename       = args[0];
    SBMLReader reader     = new SBMLReader();
    SBMLDocument document;
    long start, stop;

    start    = System.currentTimeMillis();
    document = reader.readSBML(filename);
    stop     = System.currentTimeMillis();

    if (document.getErrorCount() > 0)
    {
      print("Encountered the following errors while reading the SBML file:\n");
      document.printErrors(System.out);
      print("\nFurther consistency checking and validation aborted.\n");
      System.exit(1);
    }
    else
    {
      long errors = document.checkConsistency();
      long size   = new File(filename).length();

      println("            filename: " + filename);
      println("           file size: " + size);
      println("      read time (ms): " + (stop - start));
      println(" validation error(s): " + errors);

      if (errors > 0)
      {
        document.printErrors(System.out);
        System.exit(1);
      }
    }
  }
View Full Code Here

  /**
   * @throws ParseException
   *
   */
  @Test public void checkHashCode() throws ParseException {
    SBMLDocument doc1 = new SBMLDocument(3, 1);
    Model model = doc1.createModel("test_model");
    Compartment c = model.createCompartment("c1");
    Species s = model.createSpecies("s1", c);
    s.addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001"));
    Rule r = model.createAlgebraicRule();
    r.setMath(ASTNode.parseFormula("sin(3) + 1"));
   
    SBMLDocument doc2 = doc1.clone();
    try {
      (new SBMLWriter()).write(doc1, System.out);
      System.out.println("\n==================");
      (new SBMLWriter()).write(doc2, System.out);
    } catch (SBMLException e) {
      e.printStackTrace();
    } catch (XMLStreamException e) {
      e.printStackTrace();
    }
    assertTrue(doc1.hashCode() == doc2.hashCode());
    assertTrue(model.hashCode() != doc2.hashCode());
    assertTrue(s.getCVTerm(0).equals(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001")));
    assertTrue(s.getCVTerm(0).hashCode() == (new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001")).hashCode());
    assertTrue(doc1.equals(doc2));
    assertTrue(doc2.equals(doc1));
  }
View Full Code Here

    String jsbmlWriteFileName = fileName.replaceFirst(".xml", "-jsbml.xml");
   
    System.out.printf("Reading %s and writing %s\n",
      fileName, jsbmlWriteFileName);

    SBMLDocument testDocument;
    long afterRead = 0;
    try {
      testDocument = new SBMLReader().readSBMLFile(fileName);
      System.out.printf("Reading done\n");
      System.out.println(Calendar.getInstance().getTime());
      afterRead = Calendar.getInstance().getTimeInMillis();

      // testDocument.checkConsistency();
     
//      Compartment c = testDocument.getModel().getCompartment("compartment");
//
//      System.out.println("compartment nb child = " + c.getChildCount());
//      System.out.println("compartment child nb child = " + c.getChildAt(0).getChildCount());
//      System.out.println(((List) c.getChildAt(0)).get(1));
     

      System.out.printf("Starting writing\n");
     
      new SBMLWriter().write(testDocument.clone(), jsbmlWriteFileName);
    }
    catch (XMLStreamException e)
    {
      e.printStackTrace();
    }
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.