Package org.sbml.jsbml

Examples of org.sbml.jsbml.Species


  public void processAttribute(String elementName, String attributeName,
    String value, String uri, String prefix, boolean isLastAttribute,
    Object contextObject) {

    if (contextObject instanceof Species) {
      Species species = (Species) contextObject;
      SpatialSpeciesPlugin spatialSpecies = null;
      if (species.getExtension(SpatialConstants.namespaceURI) != null) {
        spatialSpecies = (SpatialSpeciesPlugin) species.getExtension(SpatialConstants.namespaceURI);
      } else {
        spatialSpecies = new SpatialSpeciesPlugin(species);
        species.addExtension(SpatialConstants.namespaceURI, spatialSpecies);
      }
      contextObject = spatialSpecies;
    } else if (contextObject instanceof Reaction) {
      Reaction reaction = (Reaction) contextObject;
      SpatialReactionPlugin spatialReaction = null;
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

    } catch (IllegalArgumentException e) {
      assertTrue(true);
      // success
    }

    Species s3 = new Species();
    s3.setId("SP1");
   
    try {
      model.addSpecies(s3);
      fail("We should not be able to register twice the same id.");
    } catch (IllegalArgumentException e) {
      assertTrue(true);
      // success
    }
    assertTrue(model.getSpecies("S3") == null);

    s3.setId("LP1");
   
    try {
      model.addSpecies(s3);
      assertTrue(true);
    } catch (IllegalArgumentException e) {
      fail("We should be able to register an id that is the same as a local parameter id.");
    }

    model.removeSpecies(s3);
    assertTrue(model.getSpecies("S3") == null);
   
    // Testing again after having removed the Species
    try {
      model.addSpecies(s3);
      assertTrue(true);
    } catch (IllegalArgumentException e) {
      fail("We should be able to register an id that is the same as a local parameter id.");
    }

    model.removeSpecies(s3);
    assertTrue(model.getSpecies("S3") == null);
   
    // Setting the same metaid as a SpeciesReference
    try {
      s3.setMetaId("SP1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any metaId to a Species removed from a model.");
    }

    try {
      model.addSpecies(s3);
      fail("We should not be able to register twice the same metaid.");
    } catch (IllegalArgumentException e) {
      assertTrue(true);
      // success
    }

    assertTrue(model.getSpecies("S3") == null);

    try {
      s3.setId("S1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any id to a Species removed from a model.");
    }

    try {
      model.addSpecies(s3);
      fail("We should not be able to register twice the same id.");
    } catch (IllegalArgumentException e) {
      assertTrue(true);
      // success
    }
   
    assertTrue(model.getSpecies("S3") == null);

    // Setting the same metaid as a LocalParameter

    try {
      s3.setMetaId("LP1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any metaId to a Species not linked to a model.");
    }
View Full Code Here

  /**
   *
   */
  @Test public void testRegister2() {
   
    Species s3 = new Species();
    // Setting the same id as a LocalParameter
    s3.setId("LP1");

    // Setting the same metaid as a LocalParameter
    try {
      s3.setMetaId("LP1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any metaId to a Species not linked to a model.");
    }

View Full Code Here

  /**
   *
   */
  @Test public void testRegister6() {
   
    Species s3 = new Species();
    s3.setId("S3");
   
    model.addSpecies(s3);

    // calling the registerChild by hand !!
    model.registerChild(s3);// This call does nothing if the parent of the SBase we try to register is already defined
View Full Code Here

    // assertTrue(model.findNamedSBase("LP1") == null);
    assertTrue(doc.findSBase("SP1") == null);
    assertTrue(doc.findSBase("R1") == null);
    assertTrue(doc.findSBase("LP1") == null);
   
    Species s3 = new Species();
   
    // Setting the same id as a removed SpeciesReference
    s3.setId("SP1");

    // Setting the same metaid as a removed LocalParameter
    try {
      s3.setMetaId("LP1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any metaId to a Species not linked to a model.");
    }
View Full Code Here

    // assertTrue(model.findNamedSBase("LP1") == null);
    assertTrue(doc.findSBase("SP1") == null);
    assertTrue(doc.findSBase("R1") == null);
    assertTrue(doc.findSBase("LP1") == null);
   
    Species s3 = new Species();
   
    // Setting the same id as a removed SpeciesReference
    s3.setId("SP1");

    // Setting the same metaid as a removed LocalParameter
    try {
      s3.setMetaId("LP1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any metaId to a Species not linked to a model.");
    }
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.getNumCVTerms() == 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.getNumCVTerms() == 0);
   
    assertTrue(s1.getInitialAmount() == 1);
   
   
    UnitDefinition mls = model.getUnitDefinition(1);
   
    assertTrue(mls != null);
View Full Code Here

          }
        }
      }
      if (model.isSetListOfSpecies()) {
        for (int i = 0; i < model.getNumSpecies(); 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

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.