Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBMLDocument


   */
  @SuppressWarnings("deprecation")
  @Test public void readL1V2Branch() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    String fileName = DATA_FOLDER + "/libsbml-test-data/l1v2-branch.xml";
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 1 && doc.getVersion() == 2);
   
    assertTrue(model.getLevel() == 1 && model.getVersion() == 2);
   
    // assertTrue(model.getId().equals("")); // TODO : document. Different behavior than libsbml, we set the id as the name for SBML level 1 models.
    assertTrue(model.getId().equals("Branch"));
View Full Code Here


   * @throws InvalidPropertiesFormatException
   */
  @Test public void readL1V1Units() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    String fileName = DATA_FOLDER + "/libsbml-test-data/l1v1-units.xml";
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 1 && doc.getVersion() == 1);
   
    assertTrue(model.getLevel() == 1 && model.getVersion() == 1);
   
    assertTrue(model.getId().equals(""));
    assertTrue(model.getName().equals(""));
View Full Code Here

   */
  @Test public void readL1V1Rules() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {

    String fileName = DATA_FOLDER + "/libsbml-test-data/l1v1-rules.xml";
   
    SBMLDocument doc = new SBMLReader().readSBMLFile(fileName);
    Model model = doc.getModel();
   
    assertTrue(doc.getLevel() == 1 && doc.getVersion() == 1);
   
    assertTrue(model.getLevel() == 1 && model.getVersion() == 1);
   
    assertTrue(model.getId().equals(""));
    assertTrue(model.getName().equals(""));
View Full Code Here

  @SuppressWarnings("unchecked")
  public ArrayList<Object> getListOfSBMLElementsToWrite(Object sbase) {
    ArrayList<Object> listOfElementsToWrite = null;
    if (sbase instanceof SBase) {
      if (sbase instanceof SBMLDocument) {
        SBMLDocument sbmlDocument = (SBMLDocument) sbase;
        if (sbmlDocument.isSetModel()) {
          listOfElementsToWrite = new ArrayList<Object>();
          listOfElementsToWrite.add(sbmlDocument.getModel());
        }
      } else if (sbase instanceof Model) {

        Model model = (Model) sbase;
        listOfElementsToWrite = new ArrayList<Object>();
View Full Code Here

      String localName, boolean hasAttributes, boolean isLastNamespace,
      Object contextObject)
  {

    if (contextObject instanceof SBMLDocument) {
      SBMLDocument sbmlDocument = (SBMLDocument) contextObject;
      if (!URI.equals(SBMLDocument.URI_NAMESPACE_L3V1Core)) {
        sbmlDocument.addNamespace(localName, prefix, URI);
      }
     
      log4jLogger.debug("processNamespace : " + prefix + " = " + URI);
    }
    else if (contextObject instanceof SBase) {
View Full Code Here

          Annotation annotation = (Annotation) newContextObject;
          sbase.setAnnotation(annotation);

          return annotation;
        } else if (contextObject instanceof SBMLDocument) {
          SBMLDocument sbmlDocument = (SBMLDocument) contextObject;
          if (elementName.equals("model")) {
            Model model = (Model) newContextObject;
            model.setLevel(sbmlDocument.getLevel());
            model.setVersion(sbmlDocument.getVersion());
            model.initDefaults();
            sbmlDocument.setModel(model);

            return model;
          }
        } else if (contextObject instanceof Model) {
View Full Code Here

* @version $Rev: 949 $
*/
public class SBMLWriterTest {

  public static void main(String args[]) {
    SBMLDocument doc = new SBMLDocument(2, 4);
    doc.setNotes("<body>Senseless test commentar</body>");

    Model m = doc.createModel("model");

    CVTerm term = new CVTerm();
    term.setQualifierType(Type.MODEL_QUALIFIER);
    term.setModelQualifierType(Qualifier.BQM_IS);
    term.addResource("urn:miriam:kegg.pathway:hsa00010");
View Full Code Here

      Object sbmlElementToWrite) {
    if (sbmlElementToWrite instanceof SBase) {
      SBase sbase = (SBase) sbmlElementToWrite;

      if (sbase instanceof SBMLDocument) {
        SBMLDocument sbmlDocument = (SBMLDocument) sbmlElementToWrite;

        xmlObject.addAttributes(sbmlDocument
            .getSBMLDocumentNamespaces());
      }

      xmlObject.setPrefix("");
    }
View Full Code Here

   * 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

   * Tries to validate biomodels file with id 025 with all checks on.
   */
  @Test public void checkConsistencyAllChecks() throws IOException, XMLStreamException {
    String fileName = DATA_FOLDER + "/l2v1/BIOMD0000000025.xml";
   
    SBMLDocument doc = new SBMLReader().readSBML(fileName);
   
    doc.setConsistencyChecks(SBMLValidator.CHECK_CATEGORY.UNITS_CONSISTENCY, true);
   
    int nbErrors = doc.checkConsistency();

    System.out.println("Found " + nbErrors + " errors on Biomodels 025 with the unit checking turned on.");
    assertTrue(nbErrors > 0);
   
    assertTrue(doc.getErrorLog().getNumFailsWithSeverity(SEVERITY.ERROR) == 0);
   
    assertTrue(nbErrors == doc.getNumErrors());
    assertTrue(nbErrors == doc.getErrorLog().getValidationErrors().size());
   
  }
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.