Package org.sbml.jsbml

Examples of org.sbml.jsbml.Species


    } 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

  @SuppressWarnings("deprecation")
  public static void main(String args[]) throws ParseException, XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(1, 2);
    Model m = doc.createModel();
    Compartment c = m.createCompartment("c1");
    Species s1 = m.createSpecies("s1", c);
    Species s2 = m.createSpecies("s2", c);
    Reaction r = m.createReaction("r1");
    r.createReactant(null, s1);
    r.createProduct(null, s2);
    KineticLaw kl = r.createKineticLaw();
    kl.setFormula("s1 * 3");
 
View Full Code Here

   */
  @Test public void checkHashCode() throws ParseException {
    SBMLDocument doc1 = new SBMLDocument(3, 1);
    Model model = doc1.createModel("test_model");
    Compartment c = model.createCompartment("c1");
    Species s = model.createSpecies("s1", c);
    s.addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001"));
    Rule r = model.createAlgebraicRule();
    r.setMath(ASTNode.parseFormula("sin(3) + 1"));
   
    SBMLDocument doc2 = doc1.clone();
    try {
      (new SBMLWriter()).write(doc1, System.out);
      System.out.println("\n==================");
      (new SBMLWriter()).write(doc2, System.out);
    } catch (SBMLException e) {
      e.printStackTrace();
    } catch (XMLStreamException e) {
      e.printStackTrace();
    }
    assertTrue(doc1.hashCode() == doc2.hashCode());
    assertTrue(model.hashCode() != doc2.hashCode());
    assertTrue(s.getCVTerm(0).equals(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001")));
    assertTrue(s.getCVTerm(0).hashCode() == (new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001")).hashCode());
    assertTrue(doc1.equals(doc2));
    assertTrue(doc2.equals(doc1));
  }
View Full Code Here

          }
        }
      }
      if (model.isSetListOfSpecies()) {
        for (int i = 0; i < model.getSpeciesCount(); i++) {
          Species species = model.getSpecies(i);
          setSpeciesSubstanceUnits(species, model);
          setSpeciesSpeciesType(species, model);
          setSpeciesConversionFactor(species, model);
          setSpeciesCompartment(species, model);
        }
View Full Code Here

              return compartment;
            } else if (elementName.equals("specie")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfSpecies)) {
              Species species = (Species) newContextObject;
              model.addSpecies(species);

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

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

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

      if (compartment == null) {
        species = model.getSpecies(variableID);
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.