Package org.sbml.jsbml

Examples of org.sbml.jsbml.Compartment


      InitialAssignment initialAssignment, Model model) {

    if (initialAssignment.isSetVariable()) {
      String variableID = initialAssignment.getVariable();

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

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


   */
  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

   * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(org.sbml.jsbml.CallableSBase)
   */
  public ASTNodeValue compile(CallableSBase variable) {
    if (variable instanceof Species) {
      Species species = (Species) variable;
      Compartment c = species.getCompartmentInstance();
      boolean concentration = !species.getHasOnlySubstanceUnits()
          && (0 < c.getSpatialDimensions());
      StringBuffer value = new StringBuffer();
      if (concentration) {
        value.append('[');
      }
      value.append(getNameOrID(species));
      if (concentration) {
        value.append(']');
      }
      return new ASTNodeValue(value.toString(), this);

    } else if (variable instanceof Compartment) {
      Compartment c = (Compartment) variable;
      return compile(c);
    }
    // TODO: more special cases of names!!! PARAMETER, FUNCTION DEF,
    // REACTION.
    return new ASTNodeValue(mathtt(maskSpecialChars(variable.getId()))
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

    private Compartment C;
    private Event E;

    @Before public void setUp() throws Exception
    {
      C = new  Compartment(2,4);
      E = new  Event(2,4);
    }
View Full Code Here

      XMLNamespaces xmlns = new  XMLNamespaces();
      xmlns.add( "http://www.sbml.org", "testsbml");
      SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
      sbmlns.addNamespaces(xmlns); */
     
       Compartment c = new  Compartment(2,1); // new  Compartment(sbmlns);
//      assertTrue( c.getTypeCode() == libsbml.SBML_COMPARTMENT );
      assertTrue( c.getMetaId().equals("") == true );
//      assertTrue( c.getNotes() == null );
      assertTrue( c.getAnnotation() == null );
      assertTrue( c.getLevel() == 2 );
      assertTrue( c.getVersion() == 1 );
      assertTrue( c.getNamespaces() != null );
//      assertTrue( c.getNamespaces().getLength() == 2 );
      assertTrue( c.getName().equals("") == true );
      assertTrue( c.getSpatialDimensions() == 3d );
      assertTrue( c.getConstant() == true );
      c = null;
    }
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

  public static void main(String[] args) throws IOException, XMLStreamException {
   
    SBMLDocument doc = new SBMLDocument(2, 4);
    Model model = doc.createModel("model_test");
    Compartment c1 = model.createCompartment("c1");
    Species s1 = model.createSpecies("s1", c1);
    s1.setMetaId("meta_" + s1.getId());
   
    Species s2 = model.createSpecies("s2", c1);
    s2.setMetaId("meta_" + s2.getId());
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.