Package org.sbml.jsbml

Examples of org.sbml.jsbml.Compartment


   */
  private void setRateRuleVariable(RateRule rule, Model model) {
    if (rule.isSetVariable()) {
      String variableID = rule.getVariable();

      Compartment compartment = model.getCompartment(variableID);
      Species species = null;
      SpeciesReference speciesReference = null;
      Parameter parameter = null;

      if (compartment == null) {
View Full Code Here


  private void setReactionCompartment(Reaction reaction, Model model) {

    if (reaction.isSetCompartment()) {
      String compartmentID = reaction.getCompartment();

      Compartment compartment = model.getCompartment(compartmentID);

      if (compartment != null) {
        reaction.setCompartment(compartment);
      } else {
        // TODO : the compartment ID doesn't match a compartment, throw
View Full Code Here

  private void setSpeciesCompartment(Species species, Model model) {

    if (species.isSetCompartment()) {
      String compartmentID = species.getCompartment();

      Compartment compartment = model.getCompartment(compartmentID);

      if (compartment != null) {
        species.setCompartment(compartment);
      } else {
        // TODO : the compartment ID doesn't match a compartment, throw
View Full Code Here

    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);
   
    assertTrue(cell.getSize() == 1);
   
    assertTrue(model.getListOfUnitDefinitions().size() == 3);   
    assertTrue(model.getListOfUnitDefinitions().get(1).getMetaId().equals("metaid_0000004"));
   
    Species pRBp = model.getSpecies("pRBp");
View Full Code Here

   
    /*
     * Compartments
     */
    logger.debug("==== Compartments ====");
    Compartment c1 = model.createCompartment("c1");
    c1.setSize(2d);
    Compartment c2 = model.createCompartment("c2");
    try {
      c2.setId(c1.getId());
      fail();
    } catch (IllegalArgumentException exc) {
      System.err.println(exc.getLocalizedMessage());
      assertTrue(!c2.getId().equals(c1.getId()));
    }
    // remove ListOfCompartments
    ListOf<Compartment> listOfC = model.getListOfCompartments();
    model.unsetListOfCompartments();
    // add ListOfCompartments
    model.setListOfCompartments(listOfC);
    Compartment c3 = new Compartment(level, version);
    c3.setId("c3");
    model.addCompartment(c3);
    c3.setId("c4");
   
    /*
     * Species and Species References
     */
    logger.debug("==== Species ====");
View Full Code Here

        speciesIds = getRelatedSpecies(model, reactsIds, compartmentsIds, speciesIds);
        compartmentsIds = getRelatedCompartments(model, compartmentsIds, speciesIds);

        if (compartmentsIds != null) {
          for (int i = 0; i < compartmentsIds.length; i++) {
            Compartment relatedCompartment = model.getCompartment(compartmentsIds[i]);

            subModel.addCompartment(relatedCompartment.clone());
            processUnitsMap(unitsMap, model, relatedCompartment.getUnits());

            // check compartment type
            if ((relatedCompartment.getCompartmentTypeInstance() != null)
               && (subModel.getCompartmentType(relatedCompartment.getCompartmentType()) == null)) {
              subModel.addCompartmentType(relatedCompartment.getCompartmentTypeInstance().clone());
            }
          }
        }

View Full Code Here

          }
        }
      }
      if (model.isSetListOfCompartments()) {
        for (int i = 0; i < model.getNumCompartments(); i++) {
          Compartment compartment = model.getCompartment(i);
          if (compartment.isSetCompartmentType()
              && !compartment.isSetCompartmentTypeInstance()) {
            log4jLogger.warn("No CompartmentType matches the compartmentTypeID of compartment.");
          }
          if (compartment.isSetOutside()
              && !compartment.isSetOutsideInstance()) {
            log4jLogger.warn("No Compartment matches the outsideID of compartment.");
          }
          if (compartment.isSetUnits()
              && !compartment.isSetUnitsInstance()) {
            log4jLogger.warn("No UnitDefinition matches the unitsID of compartment.");
          }
        }
      }
      if (model.isSetListOfEvents()) {
View Full Code Here

              return unitDefinition;
            } else if (elementName.equals("compartment")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfCompartments)) {
              Compartment compartment = (Compartment) newContextObject;
              compartment.initDefaults();
              model.addCompartment(compartment);

              return compartment;
            } else if (elementName.equals("species")
                && list.getSBaseListType().equals(
View Full Code Here

    Model model = doc.createModel("test_model");
    Parameter p1 = model.createParameter("p1");
    p1.setId("p2");
    model.removeParameter(p1);

    Compartment c = model.createCompartment("c");
    c.setSize(4.3);
    c.setSBOTerm(SBO.getPhysicalCompartment());

    Species s1 = model.createSpecies("s1", c);
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        Qualifier.BQB_IS, "urn:miriam:kegg.compound:C12345"));
    s1.setValue(23.7);
View Full Code Here

        speciesIds = getRelatedSpecies(model, reactsIds, compartmentsIds, speciesIds);
        compartmentsIds = getRelatedCompartments(model, compartmentsIds, speciesIds);

        if (compartmentsIds != null) {
          for (int i = 0; i < compartmentsIds.length; i++) {
            Compartment relatedCompartment = model.getCompartment(compartmentsIds[i]);

            subModel.addCompartment(relatedCompartment.clone());
            processUnitsMap(unitsMap, model, relatedCompartment.getUnits());

            // check compartment type
            if (relatedCompartment.getCompartmentTypeInstance() != null && subModel.getCompartmentType(relatedCompartment.getCompartmentType()) == null) {
              subModel.addCompartmentType(relatedCompartment.getCompartmentTypeInstance().clone());
            }
          }
        }

View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Compartment

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.