Package org.sbml.jsbml

Examples of org.sbml.jsbml.Species


    Model m = doc.createModel("test_model");
   
    Compartment c = m.createCompartment("default");
    c.setSpatialDimensions(3d);
   
    Species s1 = m.createSpecies("s1", "species1", c);
    Species s2 = m.createSpecies("s2", "species2", c);
    Species s3 = m.createSpecies("s3", "species3", c);
    Species s4 = m.createSpecies("s4", "species4", c);
   
    Reaction r1 = m.createReaction("r1");
    r1.setName("reaction1");
    r1.setCompartment(c);
    SpeciesReference sr1 = r1.createReactant("sr1", s1);
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.getCompartmentCount() == 1);
    c = m.getCompartment(0);
    assertTrue(c.getName().equals("compartmentOne"));
    assertTrue(c.getVolume() == 1);
    ud = c.getDerivedUnitDefinition();
    assertTrue(ud.getUnitCount() == 1);

    // assertTrue(ud.getUnit(0).getKind() == Unit.Kind.LITRE); // getDerivedUnitDefinition not working properly
    assertTrue(m.getSpeciesCount() == 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.getUnitCount() == 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.getReactionCount() == 3);
    r = m.getReaction(0);
    assertTrue(r.getName().equals("reaction_1"));
    assertTrue(r.getReversible() == false);
    assertTrue(r.getFast() == false);
View Full Code Here

        // species and species type
        //

        if (speciesIds != null) {
          for (int i = 0; i < speciesIds.length; i++) {
            Species relatedSpecies = model.getSpecies(speciesIds[i]);
            subModel.addSpecies(relatedSpecies.clone());
            processUnitsMap(unitsMap, model, relatedSpecies.getSubstanceUnits());

            // check species type
            if ((relatedSpecies.getSpeciesTypeInstance() != null)
               && (subModel.getSpeciesType(relatedSpecies.getSpeciesType()) == null)) {
              subModel.addSpeciesType(relatedSpecies.getSpeciesTypeInstance().clone());
            }
          }
        }

View Full Code Here

              }
            }

            if (!thisCompartmentSelected && (speciesIds != null)) {
              for (int j = 0; (j < speciesIds.length) && !thisCompartmentSelected; j++) {
                Species species = model.getSpecies(speciesIds[j]);
                thisCompartmentSelected = species.getCompartment().equals(compartmentId);
              }
            }

            if (thisCompartmentSelected) {
              relatedCompartmentsList.add(compartmentId);
View Full Code Here

          }

          if (!thisReactionSelected && (speciesIds != null)) {
            for (int j = 0; (j < speciesIds.length) && !thisReactionSelected; j++) {

              Species species = model.getSpecies(speciesIds[j]);

              // debugLogger.debug("getRelatedReactions: speciesId = " + speciesIds[j]);
              // debugLogger.debug("getRelatedReactions: reactant = " + Arrays.toString(reaction.getReactants().toArray()));
              // debugLogger.debug("getRelatedReactions: product = " + Arrays.toString(reaction.getProducts().toArray()));
              // debugLogger.debug("getRelatedReactions: modifier = " + Arrays.toString(reaction.getModifiers().toArray()));
View Full Code Here

   
    // asserTrue(model.getHistory().getCreatedDate());
   
    assertTrue(model.getUnitDefinition("substance").getName().equals("nanomole (new default)"));
   
    Species dClk = model.getSpecies("dClk");
   
    assertTrue(dClk.getCompartment().equals("CELL"));
    dClk.unsetCompartment();
    assertTrue(dClk.getCompartment().length() == 0);
   
    assertTrue(dClk != null);
   
    assertTrue(dClk.getName().length() == 0);
    assertTrue(dClk.getCVTermCount() == 1);
   
    assertTrue(dClk.getInitialAmount() == Double.parseDouble("1e-16"));
   
    Species dClkF = model.getSpecies("dClkF");
   
    assertTrue(dClkF != null);
   
    assertTrue(dClkF.getName().equals("free dClk"));
   
    Reaction rdClk = model.getReaction("rdClk");
   
    assertTrue(rdClk != null);
   
View Full Code Here

    assertTrue(cell.getSize() == 1);
   
    assertTrue(model.getListOfUnitDefinitions().size() == 3);   
    assertTrue(model.getListOfUnitDefinitions().get(1).getMetaId().equals("metaid_0000004"));
   
    Species pRBp = model.getSpecies("pRBp");
    pRBp.setHasOnlySubstanceUnits(false);
   
    assertTrue(pRBp != null);
    System.out.println("pRBp notes: " + pRBp.getNotesString()); // namespace lost, should probably here.

    // TODO: add more complex test for Notes !! assertTrue(pRBp.getNotesString().contains(JSBML.URI_XHTML_DEFINITION));

    System.out.println("pRBp annotation: " + pRBp.getAnnotation().getNonRDFannotation());
    System.out.println("pRBp annotation: " + pRBp.getCVTerm(0).toString());
   
    assertTrue(model.getListOfParameters().size() == 40);
   
    //org.sbml.libsbml.SBMLReader libSBMlReader = new org.sbml.libsbml.SBMLReader();
    //org.sbml.libsbml.SBMLDocument libsbmlDoc = libSBMlReader.readSBML(fileName);
View Full Code Here

  {
    SBMLReader reader = new SBMLReader();
    SBMLDocument d = null;
    Model m;
    Compartment c;
    Species s;
    Parameter gp;
    LocalParameter lp;
    AssignmentRule ar;
    Reaction r;
    SpeciesReference sr;
    KineticLaw kl;
    UnitDefinition ud;
    Reaction r1;
    ListOf<Compartment> loc;
    Compartment c1;
    ListOf<Rule> lor;
    AssignmentRule ar1;
    ListOf<Parameter> lop;
    Parameter p1;
    ListOf<Species> los;
    Species s1;
    String filename = new String( DATA_FOLDER + "/libsbml-test-data/" );
    filename += "l2v1-assignment.xml";
    try {
    d = reader.readSBML(filename);
  } catch (IOException e) {
    e.printStackTrace();
    assert(false);
  } catch (XMLStreamException e) {
    e.printStackTrace();
    assert(false);
  }

  System.out.println(" TestReadFromFile 5: reading done.");
 
  assertTrue( d.getLevel() == 2 );
    assertTrue( d.getVersion() == 1 );
    m = d.getModel();
    assertTrue( m != null );
    assertTrue( m.getCompartmentCount() == 1 );
    c = m.getCompartment(0);
    assertTrue( c != null );
    assertTrue( c.getId().equals( "cell") );
/*    ud = c.getDerivedUnitDefinition();
    assertTrue( ud.getUnitCount() == 1 );
    assertTrue( ud.getUnit(0).getKind() == Kind.LITRE );
    */
    loc = m.getListOfCompartments();
    c1 = loc.get(0);
    assertTrue( c1.equals(c) );
    c1 = loc.get("cell");
    assertTrue( c1.equals(c) );
    assertTrue( m.getSpeciesCount() == 5 );
    s = m.getSpecies(0);
    assertTrue( s != null );
    assertTrue( s.getId().equals( "X0"  ) );
    assertTrue( s.getCompartment().equals( "cell") );
    assertTrue( s.getInitialConcentration() == 1.0 );
    los = m.getListOfSpecies();
    s1 = los.get(0);
    assertTrue( s1.equals(s) );
    s1 = los.get("X0");
    assertTrue( s1.equals(s) );
    s = m.getSpecies(1);
    assertTrue( s != null );
    assertTrue( s.getId().equals( "X1"  ) );
    assertTrue( s.getCompartment().equals( "cell") );
    assertTrue( s.getInitialConcentration() == 0.0 );
View Full Code Here

    assertTrue(model.getHistory().getCreator(1).getGivenName().equals("Lan"));
    assertTrue(model.getHistory().getCreator(1).getEmail().equals("lma@jhu.edu"));
    assertTrue(model.getHistory().getCreator(0).getOrganisation().equals("EMBL-EBI"));
    assertTrue(model.getCVTermCount() == 5);
   
    Species erk2 = model.getSpecies("ERK2");
   
    assertTrue(erk2 != null);
    assertTrue(erk2.getSBOTermID().equals("SBO:0000014"));
    assertTrue(erk2.getSBOTerm() == 14);
    assertTrue(erk2.isSetInitialAmount() == false);
    assertTrue(erk2.isSetInitialConcentration() == true);
    assertTrue(erk2.getInitialConcentration() == 1.13);
    assertTrue(erk2.getCVTerm(0).getResourceCount() == 2);
    assertTrue(erk2.getCompartment().equals("compartment"));
    assertTrue(erk2.getCompartmentInstance().getId().equals("compartment"));
  }
View Full Code Here

    Compartment c = model.createCompartment("c");
    c.setSize(4.3);
    c.setSBOTerm(SBO.getPhysicalCompartment());

    Species s1 = model.createSpecies("s1", c);
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        Qualifier.BQB_IS, "urn:miriam:kegg.compound:C12345"));
    s1.setValue(23.7);
    model.removeSpecies(s1);

    try {
      System.out.println();
      new SBMLWriter().write(doc, System.out);
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.