Examples of KineticLaw


Examples of org.sbml.jsbml.KineticLaw

              setSpeciesReferenceSpecies(
                  modifierSpeciesReference, model);
            }
          }
          if (reaction.isSetKineticLaw()) {
            KineticLaw kineticLaw = reaction.getKineticLaw();
            if (kineticLaw.isSetListOfLocalParameters()) {
              for (int j = 0; j < kineticLaw.getLocalParameterCount(); j++) {
                LocalParameter parameter = kineticLaw
                    .getLocalParameter(j);
                setParameterUnits(parameter, model);
              }
            }
          }
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

              }
            } else {
              // TODO: SBML syntax error, throw an exception?
            }
          } else if (list.getParentSBMLObject() instanceof KineticLaw) {
            KineticLaw kineticLaw = (KineticLaw) list
                .getParentSBMLObject();

            if (elementName.equals("parameter")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfParameters)) {
              LocalParameter localParameter = (LocalParameter) newContextObject;
              kineticLaw.addLocalParameter(localParameter);

              return localParameter;
            } else {
              // TODO: SBML syntax error, throw an exception?
            }
          } else {
            // TODO: SBML syntax error, throw an exception?
          }
        } else if (contextObject instanceof UnitDefinition) {
          UnitDefinition unitDefinition = (UnitDefinition) contextObject;

          if (elementName.equals("listOfUnits")) {
            ListOf<Unit> listOfUnits = (ListOf<Unit>) newContextObject;
            unitDefinition.setListOfUnits(listOfUnits);

            return listOfUnits;
          }
        } else if (contextObject instanceof Reaction) {
          Reaction reaction = (Reaction) contextObject;

          if (elementName.equals("listOfReactants")) {
            ListOf listOfReactants = (ListOf) newContextObject;
            reaction.setListOfReactants(listOfReactants);
            listOfReactants
                .setSBaseListType(ListOf.Type.listOfReactants);

            return listOfReactants;
          } else if (elementName.equals("listOfProducts")) {
            ListOf listOfProducts = (ListOf) newContextObject;
            reaction.setListOfProducts(listOfProducts);
            listOfProducts
                .setSBaseListType(ListOf.Type.listOfProducts);

            return listOfProducts;
          } else if (elementName.equals("kineticLaw")) {
            KineticLaw kineticLaw = (KineticLaw) newContextObject;
            reaction.setKineticLaw(kineticLaw);

            return kineticLaw;
          } else {
            // TODO: SBML syntax error, throw an exception?
          }
        } else if (contextObject instanceof KineticLaw) {
          KineticLaw kineticLaw = (KineticLaw) contextObject;

          if (elementName.equals("listOfParameters")) {
            ListOf listOfLocalParameters = (ListOf) newContextObject;
            kineticLaw
                .setListOfLocalParameters(listOfLocalParameters);
            listOfLocalParameters
                .setSBaseListType(ListOf.Type.listOfParameters);

            return listOfLocalParameters;
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

    System.out.println(math.toMathML());
   
    Species species = m.createSpecies("spec");
    Reaction r = m.createReaction("r");
    r.addReactant(new SpeciesReference(species));
    KineticLaw kl = new KineticLaw(level, version);
    math = new ASTNode(fd, kl);
    math.addChild(new ASTNode(species, kl));
    math = ASTNode.times(math, new ASTNode(3.7, 8, kl));
    kl.setMath(math);
    r.setKineticLaw(kl);
   
    System.out.println(math.toMathML());

    try {
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

   
    assertTrue(rdClk.getListOfReactants().get(0).getSpecies().equals("EmptySet"));
    assertTrue(rdClk.getListOfProducts().get(0).getSpecies().equals("dClk"));
    assertTrue(rdClk.getListOfModifiers().get(0).getSpecies().equals("dClkF"));
   
    KineticLaw rdClkKL = rdClk.getKineticLaw();
   
    assertTrue(rdClkKL.getListOfParameters().size() == 3);
    assertTrue(rdClkKL.getListOfParameters().get(2).getId().equals("parameter_0000009"));
    assertTrue(rdClkKL.getListOfParameters().get(2).getName().equals("tau2"));
    assertTrue(rdClkKL.getListOfParameters().get(2).getValue() == 10);
   
    Event event = model.getEvent(0);
   
    assertTrue(event.getMetaId().equals("metaid_0000015"));
    assertTrue(event.getEventAssignmentCount() == 1);
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

    r.createReactant(s1);
    r.createProduct(s2);
   
    model.createParameter("k");
   
    KineticLaw kl = r.createKineticLaw();
    kl.createLocalParameter("k");
    ASTNode node = ASTNode.readMathMLFromString("<math xmlns=\"http://www.w3.org/1998/Math/MathML\"> <apply><times/><ci> k </ci><ci> S1 </ci></apply></math>");
    kl.setMath(node);
   
    if (!(kl.getMath().getChild(0).getVariable() instanceof LocalParameter)) {
      System.out.println("The local parameter k is not found!");
    }
   
   
    doc = new SBMLReader().readSBML("core/files/test-models/00733-sbml-l2v4.xml");
    r = doc.getModel().getReaction("reaction1");
    kl = r.getKineticLaw();
    if (!(kl.getMath().getChild(1).getVariable() instanceof LocalParameter)) {
      System.out.println("The local parameter k is not found!");
    }
  }
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

          logger.warn("The reaction element '" + reaction.getId() + "' has an invalid rdf:about inside his annotation.");
          setRDFAbout(reaction);
        }

        if (reaction.isSetKineticLaw()) {
          KineticLaw kineticLaw = reaction.getKineticLaw();

          if (!kineticLaw.hasValidAnnotation()) {
            logger.warn("The kineticLaw element '" + kineticLaw.getMetaId() + "' has an invalid rdf:about inside his annotation.");
            setRDFAbout(kineticLaw);
          }

          if (kineticLaw.isSetListOfLocalParameters()) {
            for (LocalParameter parameter : kineticLaw.getListOfLocalParameters()) {
              if (!parameter.hasValidAnnotation()) {
                logger.warn("The local parameter element '" + parameter.getId() + "' has an invalid rdf:about inside his annotation.");
                setRDFAbout(parameter);
              }
            }
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

    HashSet<Reaction> reactionSet = new HashSet<Reaction>();
   
    reactionSet.add(r2);
    reactionSet.add(r3);
   
    KineticLaw kl = r2.createKineticLaw();
    kl.createLocalParameter("LP1");
   
    reactionSet.remove(r2); // unsuccessful as the hashCode of r2 has changed since we added it to the HashSet !!
    // The javadoc is misleading on this case as it just says that the equals method will be used
    // They probably use the hashcode as the key for the underlying HashMap.
   
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

    // Creating a new reaction without id
    Reaction r2 = model.createReaction();

    assertTrue(model.getReactionCount() == 2);

    KineticLaw k = r2.createKineticLaw();
   
    // Creating a new local parameter without id
    LocalParameter lp = k.createLocalParameter();
   
    lp.setMetaId("LP1_2");
    lp.setName("LP1_2");
    lp.setId("LP1");
   
    assertTrue(k.getLocalParameterCount() == 1);
   
    assertTrue(doc.findSBase("LP1_2") != null);

    assertTrue(k.getLocalParameter("LP1") != null);
    assertTrue(model.findLocalParameters("LP1").size() == 2);
    assertTrue(model.findReactionsForLocalParameter("LP1").size() == 1); // because r2 has no ID yet !!
   
    lp.setId("LP1_2"); // changing the id of the localParameter !!
   
    assertTrue(k.getLocalParameter("LP1") == null);
    assertTrue(k.getLocalParameter("LP1_2") != null);
   
    assertTrue(model.findLocalParameters("LP1_2").size() == 1);
   
    assertTrue(model.findLocalParameters("LP1").size() == 1);
   
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

   */
  @Test public void testRegister8() {
   
    Reaction r2 = model.createReaction("R2");
   
    KineticLaw kl = r2.createKineticLaw();

    ListOf<LocalParameter> listOfLP = new ListOf<LocalParameter>(2, 4);
    listOfLP.add(new LocalParameter("LP1"));
    listOfLP.add(new LocalParameter("LP2"));
    listOfLP.add(new LocalParameter("LP3"));
    listOfLP.add(new LocalParameter("LP1"));
   
    try {
     
      kl.setListOfLocalParameters(listOfLP);
     
      fail("We should not be able to register twice the same local parameter id.");
    } catch(IllegalArgumentException e) {
      // success
    }
   
    assertTrue(kl.getLocalParameterCount() == 0);
    assertTrue(model.findLocalParameters("LP1").size() == 1);
    assertTrue(model.findLocalParameters("LP2").size() == 0);
       
    // listOfLP.remove(3); // TODO: at the moment the list of local parameter is emptied if there is an error !! Should we clone the listOf
    // when using the setListOf methods ??

    listOfLP.clear();
    listOfLP.add(new LocalParameter("LP1"));
    listOfLP.add(new LocalParameter("LP2"));
    listOfLP.add(new LocalParameter("LP3"));

    try {
     
      kl.setListOfLocalParameters(listOfLP);
     
    } catch(IllegalArgumentException e) {
      fail("We should be able to set a valid list of local parameters.");
    }

    assertTrue(kl.getLocalParameterCount() == 3);
    assertTrue(model.findLocalParameters("LP1").size() == 2);
    assertTrue(model.findLocalParameters("LP2").size() == 1);
 
    kl.removeLocalParameter("LP2");
    kl.removeLocalParameter(1);
   
    assertTrue(kl.getLocalParameterCount() == 1);   
    assertTrue(model.findLocalParameters("LP2").size() == 0);   
    assertTrue(model.findLocalParameters("LP3").size() == 0);
   
    kl.createLocalParameter("LP2");

    assertTrue(kl.getLocalParameterCount() == 2);   
    assertTrue(model.findLocalParameters("LP2").size() == 1);
  }
View Full Code Here

Examples of org.sbml.jsbml.KineticLaw

    assertTrue(r1.getReversible() == false);
   
    assertTrue(r1.getListOfReactants().get(0).getSpecies().equals("X0"));
    assertTrue(r1.getListOfProducts().get(0).getSpecies().equals("S1"));
   
    KineticLaw rdClkKL = r1.getKineticLaw();

    assertTrue(rdClkKL != null);
    assertTrue(rdClkKL.getListOfLocalParameters().size() == 1);
    assertTrue(rdClkKL.getListOfLocalParameters().get(0).getName().equals("k1"));
   
    System.out.println("L1V2 formula = " + rdClkKL.getFormula());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.