Package org.sbml.jsbml

Examples of org.sbml.jsbml.Species


      SBMLDocument doc = new SBMLDocument(2,4);

      Model m = doc.createModel("model1");
      Model m2 = new Model("model1", 2, 4);
     
      Species s1 = m.createSpecies("id1");
     
      Annotation annotation = new Annotation();
      CVTerm cvterm = new CVTerm();
      cvterm.addResource("urn.miriam.obo.go#GO%3A1234567");
      cvterm.setQualifierType(Type.BIOLOGICAL_QUALIFIER);
      cvterm.setBiologicalQualifierType(Qualifier.BQB_IS);
     
      annotation.addCVTerm(cvterm);
     
      System.out.println("The Annotation is still empty as there is no metaid defined on the species !!");
      System.out.println("@" + s1.getAnnotationString() + "@");
     
      s1.setMetaId("meta4");
      s1.setAnnotation(annotation);
     
      System.out.println("After adding a metaid on the species, the Annotation String get generated as it should.");
      System.out.println("@" + s1.getAnnotationString() + "@");
     


      String urn_id = "C00001";
     
      Species specie = m2.createSpecies();
      specie.setId("S2");
      specie.setName("S2");
      // specie.setCompartment(compartment);
      specie.setInitialAmount(1);

      annotation = new Annotation();
      CVTerm cvTerm = new CVTerm(Qualifier.BQB_IS);
      cvTerm.setQualifierType(Type.BIOLOGICAL_QUALIFIER);
     
      if(urn_id.startsWith("C"))
      {
      cvTerm.addResource("urn:miriam:kegg.compound:" + urn_id);
      annotation.addCVTerm(cvTerm);
      annotation.appendNoRDFAnnotation("http://www.genome.jp/dbget-bin/www_bget?cpd:"+urn_id);
      }
     
      if(urn_id.startsWith("G"))
      {
      cvTerm.addResource("urn:miriam:kegg.glycan:" + urn_id);
      annotation.addCVTerm(cvTerm);
      annotation.appendNoRDFAnnotation("<myApp:xxx>http://www.genome.jp/dbget-bin/www_bget?gl:"+urn_id + "</myApp:xxx>");
      }
     
      if (urn_id.contains("."))
      {
      cvTerm.addResource("urn:miriam:ec-code:" + urn_id);
      annotation.addCVTerm(cvTerm);
      annotation.appendNoRDFAnnotation("http://www.genome.jp/dbget-bin/www_bget?ec:"+urn_id);
      }

      System.out.println("The Annotation is still empty as there is no metaid defined on the species !!");
      System.out.println("@" + specie.getAnnotationString() + "@");

      specie.setMetaId("S1");
      specie.setAnnotation(annotation);


      System.out.println("After adding a metaid on the species, the Annotation String get generated as it should.");
      System.out.println("@" + specie.getAnnotationString() + "@");

      // this.sbmlModel.addSpecies(specie);

  }
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

  @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

  public SpeciesAnnotationTest() throws XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(2, 4);
    doc.addTreeNodeChangeListener(this);
    Model model = doc.createModel("model_test");
    Species s1 = model.createSpecies("s1", model.createCompartment("c1"));
    s1.setMetaId("meta_" + s1.getId());
    // Not necessary anymore.
    // s1.getAnnotation().addRDFAnnotationNamespace("bqbiol", "",
    // "http://biomodels.net/biology-qualifiers/");
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        CVTerm.Qualifier.BQB_HAS_PART, "urn:miriam:obo.chebi:CHEBI:15422"));
    System.out.println("==================================");
    new SBMLWriter().write(doc, System.out);
    new JTreeOfSBML(doc);
  }
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();
    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

   
    // At the moment (rev 744), the species can be created and added to the model
    // This should no be possible as the id of the species is the same as the one
    // from the first reaction !!
    Species s1 = m.createSpecies("id1");

    System.out.println("\n\nNB species in the model (Should be 0)          : " + m.getNumSpecies());
    System.out.println(s1.getParent() + " " + s1.getModel());

    if (m.getNumSpecies() > 0) {
      // bug here
      System.out.println("Bug detected :  it should no be possible as the id of the species is the same as the one from the first reaction !!!");     
    }
View Full Code Here

    Model m;
    Compartment c;
    KineticLaw kl;
    LocalParameter p;
    Reaction r;
    Species s;
    SpeciesReference sr;
    UnitDefinition ud;
    String filename = DATA_FOLDER + "/libsbml-test-data/l1v1-branch.xml";
    d = new SBMLReader().readSBML(filename);
    if (d == null)
      ;
    {
    }
    assertTrue(d.getLevel() == 1);
    assertTrue(d.getVersion() == 1);
    m = d.getModel();
    assertTrue(m.getName().equals("Branch"));
    assertTrue(m.getNumCompartments() == 1);
    c = m.getCompartment(0);
    assertTrue(c.getName().equals("compartmentOne"));
    assertTrue(c.getVolume() == 1);
    ud = c.getDerivedUnitDefinition();
    assertTrue(ud.getNumUnits() == 1);

    // assertTrue(ud.getUnit(0).getKind() == Unit.Kind.LITRE); // getDerivedUnitDefinition not working properly
    assertTrue(m.getNumSpecies() == 4);
    s = m.getSpecies(0);
    assertTrue(s.getName().equals("S1"));
    assertTrue(s.getCompartment().equals("compartmentOne"));
    assertTrue(s.getInitialAmount() == 0);
    assertTrue(s.getBoundaryCondition() == false);

    //    ud = s.getDerivedUnitDefinition(); // getDerivedUnitDefinition not working properly
//    assertTrue(ud.getNumUnits() == 2);
//    assertTrue(ud.getUnit(0).getKind() == Unit.Kind.MOLE);
//    assertTrue(ud.getUnit(0).getExponent() == 1);
//    assertTrue(ud.getUnit(1).getKind() == Unit.Kind.LITRE);
//    assertTrue(ud.getUnit(1).getExponent() == -1);
   
    s = m.getSpecies(1);
    assertTrue(s.getName().equals("X0"));
    assertTrue(s.getCompartment().equals("compartmentOne"));
    assertTrue(s.getInitialAmount() == 0);
    assertTrue(s.getBoundaryCondition() == true);
    s = m.getSpecies(2);
    assertTrue(s.getName().equals("X1"));
    assertTrue(s.getCompartment().equals("compartmentOne"));
    assertTrue(s.getInitialAmount() == 0);
    assertTrue(s.getBoundaryCondition() == true);
    s = m.getSpecies(3);
    assertTrue(s.getName().equals("X2"));
    assertTrue(s.getCompartment().equals("compartmentOne"));
    assertTrue(s.getInitialAmount() == 0);
    assertTrue(s.getBoundaryCondition() == true);
    assertTrue(m.getNumReactions() == 3);
    r = m.getReaction(0);
    assertTrue(r.getName().equals("reaction_1"));
    assertTrue(r.getReversible() == false);
    assertTrue(r.getFast() == false);
View Full Code Here

    Object contextObject)
  {
    logger.debug("processAttribute -> " + prefix + ":" + attributeName + " = " + value + " (" + contextObject.getClass().getName() + ")");

    if (contextObject instanceof Species) {
      Species species = (Species) contextObject;
      FBCSpeciesPlugin fbcSpecies = null;

      if (species.getExtension(FBCConstants.namespaceURI) != null) {
        fbcSpecies = (FBCSpeciesPlugin) species.getExtension(FBCConstants.namespaceURI);
      } else {
        fbcSpecies = new FBCSpeciesPlugin(species);
        species.addExtension(FBCConstants.namespaceURI, fbcSpecies);
      }

      contextObject = fbcSpecies;
    }
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

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.