Package org.sbml.jsbml

Examples of org.sbml.jsbml.Species


  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());
   
    Reaction r = model.createReaction("r1");
    r.createReactant(s1);
    r.createProduct(s2);
   
View Full Code Here


          }
        }
      }
      if (model.isSetListOfSpecies()) {
        for (int i = 0; i < model.getSpeciesCount(); i++) {
          Species species = model.getSpecies(i);

          if (species.isSetSubstanceUnits()
              && !species.isSetSubstanceUnitsInstance()) {
            log4jLogger.warn("No UnitDefinition matches the subtsanceUnitsID of species.");
          }
          if (species.isSetSpeciesType()
              && !species.isSetSpeciesTypeInstance()) {
            log4jLogger.warn("No SpeciesType matches the speciesTypeID of species.");
          }
          if (species.isSetConversionFactor()
              && !species.isSetConversionFactorInstance()) {
            log4jLogger.warn("No Parameter matches the conversionFactorID of species.");
          }
          if (species.isSetCompartment()
              && !species.isSetCompartmentInstance()) {
            log4jLogger.warn("No Compartment matches the compartmentID of species.");
          }
          if (species.isSetSpatialSizeUnits()
              && !species.isSetSpatialSizeUnitsInstance()) {
            log4jLogger.warn("No UnitDefinition matches the spatialSizeUnitsID of species.");
          }
        }
      }
      if (model.isSetListOfParameters()) {
View Full Code Here

            } else if (elementName.equals("species")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfSpecies)
                && ((model.getLevel() == 1 && model
                    .getVersion() > 1) || model.getLevel() > 1)) {
              Species species = (Species) newContextObject;
              species.initDefaults();
              model.addSpecies(species);

              return species;
            }
            // level 1: species => specie
            else if (elementName.equals("specie")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfSpecies)
                && model.getLevel() == 1
                && model.getVersion() == 1) {
              Species species = (Species) newContextObject;
              species.initDefaults();
              model.addSpecies(species);

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

  /**
   * Test method for {@link org.sbml.jsbml.Model#removeSpecies(java.lang.String)}.
   */
  @Test
  public void testRemoveSpeciesString() {
    Species c = modelL3.createSpecies("s5");
    assertTrue(modelL3.getSpecies(c.getId()) != null);

    modelL3.removeSpecies(c.getId());
    assertTrue(modelL3.getSpecies(c.getId()) == null);
  }
View Full Code Here

   
    // 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"));
    assertTrue(model.getName().equals("Branch"));
   
    Species s1 = model.getSpecies("S1");
   
    assertTrue(s1 != null);
   
    assertTrue(s1.getName().equals("S1"));
    assertTrue(s1.getId().equals("S1")); // changed, was assertTrue(s1.getId().equals("")); cf comment above.
    assertTrue(s1.getCVTermCount() == 0);
   
    assertTrue(s1.getInitialAmount() == 0);
    assertTrue(s1.getBoundaryCondition() == false);
   
    Species x1 = model.getSpecies("X1");
   
    assertTrue(x1 != null);
   
    assertTrue(x1.getName().equals("X1"));
    assertTrue(x1.getInitialAmount() == 0);
    assertTrue(x1.getBoundaryCondition() == true);
   
   
    Reaction r1 = model.getReaction(0);
   
    assertTrue(r1 != null);
View Full Code Here

    assertTrue(model.getLevel() == 1 && model.getVersion() == 1);
   
    assertTrue(model.getId().equals(""));
    assertTrue(model.getName().equals(""));
   
    Species s1 = model.getSpecies("s1");
   
    assertTrue(s1 != null);
   
    assertTrue(s1.getName().equals("s1"));
    assertTrue(s1.getId().equals("s1")); // changed, was:  assertTrue(s1.getId().equals(""));
    assertTrue(s1.getCVTermCount() == 0);
   
    assertTrue(s1.getInitialAmount() == 1);
   
   
    UnitDefinition mls = model.getUnitDefinition(1);
   
    assertTrue(mls != null);
View Full Code Here

  private Species S;

  @Before public void setUp() throws Exception
  {
    S = new  Species(2,4);
    if (S == null);
    {
    }
  }
View Full Code Here

 
  @SuppressWarnings("deprecation")
@Test public void test_Species_setSpatialSizeUnits()
  {
    Species s = new  Species(2,1);
    String units =  "volume";;
    s.setSpatialSizeUnits(units);
    assertTrue(s.getSpatialSizeUnits().equals(units));
    assertEquals( true, s.isSetSpatialSizeUnits() );
    if (s.getSpatialSizeUnits() == units);
    {
    }
    s.setSpatialSizeUnits(s.getSpatialSizeUnits());
    assertTrue(s.getSpatialSizeUnits().equals(units));
    s.setSpatialSizeUnits("");
    assertEquals( false, s.isSetSpatialSizeUnits() );
    if (s.getSpatialSizeUnits() != null);
    {
    }
    s = null;
  }
View Full Code Here

   *
   * @see org.sbml.jsbml.util.Filter#accepts(java.lang.Object)
   */
  public boolean accepts(Object o) {
    if (o instanceof Species) {
      Species s = (Species) o;
      return s.isSetBoundaryCondition() && s.getBoundaryCondition();
    }
    return false;
  }
View Full Code Here

    model = doc.createModel("model");
   
    Compartment comp = model.createCompartment("cell");
    comp.setMetaId("cell");
   
    Species s1 = model.createSpecies("S1", comp);
    s1.setMetaId("S1");
   
    Species s2 = model.createSpecies("S2", comp);
    s2.setMetaId("S2");
   
    Reaction r1 = model.createReaction("R1");
    r1.setMetaId("R1");
   
    SpeciesReference reactant = model.createReactant("SP1");
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Species

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.