• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java KineticLaw类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.sbml.jsbml.KineticLaw的典型用法代码示例。如果您正苦于以下问题:Java KineticLaw类的具体用法?Java KineticLaw怎么用?Java KineticLaw使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

KineticLaw类属于org.sbml.jsbml包,在下文中一共展示了KineticLaw类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateComplexCooperativity

点赞 3

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public static void updateComplexCooperativity(String reactantId, Reaction react, String CoopStr, Model model) {
	SpeciesReference reactant = react.getReactantForSpecies(reactantId);
	KineticLaw k = react.getKineticLaw();
	LocalParameter p = k.getLocalParameter(GlobalConstants.COOPERATIVITY_STRING+"_"+reactantId);
	if (CoopStr != null) {
		if (p==null) {
			p = k.createLocalParameter();
			p.setId(GlobalConstants.COOPERATIVITY_STRING+"_"+reactantId);
		} 
		double nc = Double.parseDouble(CoopStr);
		p.setValue(nc);
		reactant.setStoichiometry(nc);
	} else {
		if (p != null) {
			k.getListOfLocalParameters().remove(GlobalConstants.COOPERATIVITY_STRING+"_"+reactantId);
		}
		Parameter gp = model.getParameter(GlobalConstants.COOPERATIVITY_STRING);
		reactant.setStoichiometry(gp.getValue());
	}
	react.getKineticLaw().setMath(SBMLutilities.myParseFormula(createComplexKineticLaw(react)));
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:22,
代码来源:BioModel.java

示例2: checkKineticLawUnits

点赞 3

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
/**
 * Check the units of a kinetic law
 */
public boolean checkKineticLawUnits(KineticLaw law) {
	if (Gui.getCheckUndeclared()) {
		if (law.containsUndeclaredUnits()) {
			JOptionPane.showMessageDialog(Gui.frame, "Kinetic law contains literals numbers or parameters with undeclared units.\n"
					+ "Therefore, it is not possible to completely verify the consistency of the units.", "Contains Undeclared Units",
					JOptionPane.WARNING_MESSAGE);
		}
		return false;
	}
	else if (Gui.getCheckUnits()) {
		if (SBMLutilities.checkUnitsInKineticLaw(bioModel.getSBMLDocument(), law)) {
			JOptionPane.showMessageDialog(Gui.frame, "Kinetic law units should be substance / time.", "Units Do Not Match",
					JOptionPane.ERROR_MESSAGE);
			return true;
		}
	}
	return false;
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:22,
代码来源:Reactions.java

示例3: convertKineticLaw

点赞 3

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public DynamicKineticLaw convertKineticLaw(KineticLaw sbmlKineticLaw) {
    if (!sbmlKineticLaw.getMath().toString().equals("NaN")) {
        String unitIdentifier = sbmlKineticLaw.getDerivedUnitDefinition().getId();
        Unit<?> parameterUnit;
        if (unitIdentifier.equalsIgnoreCase("dimensionless") || unitIdentifier.isEmpty()) {
            parameterUnit = ONE;
        } else {
            parameterUnit = units.get(unitIdentifier);
        }
        logger.debug("Creating kinetic law with expression {} ...", sbmlKineticLaw.getMath().toString());
        AppliedExpression appliedExpression = expressionConverter.convertRawExpression(sbmlKineticLaw.getMath(), sbmlKineticLaw.getListOfLocalParameters(), parameterUnit);
        return new DynamicKineticLaw(appliedExpression);
    } else {
        logger.warn("Could not parse a valid expression for this reaction.");
        return null;
    }
}
 

开发者ID:cleberecht,
项目名称:singa,
代码行数:18,
代码来源:SBMLKineticLawConverter.java

示例4: AbstractionEngine

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public AbstractionEngine(HashMap<String, SpeciesInterface> species,
		HashMap<String, ArrayList<Influence>> complexMap,
		HashMap<String, ArrayList<Influence>> partsMap, double RNAP, Reaction r, KineticLaw kl) {
	this.species = species;
	this.complexMap = complexMap;
	this.partsMap = partsMap;
	this.RNAP = RNAP;
	this.r = r;
	this.kl = kl;
	this.sbmlMode = true;
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:12,
代码来源:AbstractionEngine.java

示例5: addDefaultSBOTerm

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
/**
 * Adds the default SBO term.
 *
 * @param node the node
 */
public static void addDefaultSBOTerm(TreeNode node) {
  for (int i = 0; i < node.getChildCount(); i++) {
    addDefaultSBOTerm(node.getChildAt(i));
  }

  if (!(node instanceof SBase) ) {
    return ;
  }

  SBase sbase = (SBase) node;
  if (sbase.isSetSBOTerm()) {
    return;
  }

  if (sbase instanceof Model) {
    sbase.setSBOTerm(intSBOTermForModel);
  } else if (sbase instanceof Species) {
    sbase.setSBOTerm(intSBOTermForGENERIC);
  } else if (sbase instanceof Compartment) {
    sbase.setSBOTerm(intSBOTermForCompartment);
  } else if (sbase instanceof Parameter) {
    sbase.setSBOTerm(intSBOTermForParameter);
  } else if (sbase instanceof Rule) {
    sbase.setSBOTerm(intSBOTermForRateRule);
  } else if (sbase instanceof Compartment) {
    sbase.setSBOTerm(intSBOTermForCompartment);
  } else if (sbase instanceof Reaction) {
    sbase.setSBOTerm(intSBOTermForReaction);
  } else if (sbase instanceof SpeciesReference) {
    Reaction r = (Reaction) ((SpeciesReference) sbase).getParentSBMLObject().getParentSBMLObject();
    if (r.getListOfReactants().contains(sbase)) {
      sbase.setSBOTerm(intSBOTermForReactant);
    } else {
      sbase.setSBOTerm(intSBOTermForProduct);
    }
  } else if (sbase instanceof ModifierSpeciesReference) {
    sbase.setSBOTerm(intSBOTermForModifierSpeciesReference);
  } else if (sbase instanceof KineticLaw) {
    sbase.setSBOTerm(intSBOTermForKineticLaw);
  }
}
 

开发者ID:funasoul,
项目名称:celldesigner-parser,
代码行数:47,
代码来源:SBMLUtil.java

示例6: createComplexReaction

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public Reaction createComplexReaction(String s,String KcStr,boolean onPort) {
	createComplexDefaultParameters();
	Reaction r = getComplexReaction(s);
	if (r==null) {
		r = sbml.getModel().createReaction();
		r.setId(GlobalConstants.COMPLEXATION + "_" + s);
		r.setSBOTerm(GlobalConstants.SBO_ASSOCIATION);
		r.setCompartment(sbml.getModel().getSpecies(s).getCompartment());
		SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(r.getCompartment()),r,"compartment");
		r.setReversible(true);
		//r.setFast(false);
		SpeciesReference product = r.createProduct();
		product.setSpecies(s);
		product.setStoichiometry(1);
		product.setConstant(true);		
		r.createKineticLaw();
	} else {
		KineticLaw k = r.getKineticLaw();
		if (k.getLocalParameter(GlobalConstants.FORWARD_KCOMPLEX_STRING)!=null) {
			k.getListOfLocalParameters().remove(GlobalConstants.FORWARD_KCOMPLEX_STRING);
		}
		if (k.getLocalParameter(GlobalConstants.REVERSE_KCOMPLEX_STRING)!=null) {
			k.getListOfLocalParameters().remove(GlobalConstants.REVERSE_KCOMPLEX_STRING);
		}
	}
	SBMLutilities.cloneDimensions(sbml.getModel().getSpecies(s), r);
	SBMLutilities.copyDimensionsToEdgeIndex(r, sbml.getModel().getSpecies(s), r.getProduct(0), "species");
	updateComplexParameters(r,KcStr);
	r.getKineticLaw().setMath(SBMLutilities.myParseFormula(createComplexKineticLaw(r)));
	Port port = getPortByIdRef(r.getId());
	if (port!=null) {
		if (onPort) {
			port.setId(r.getId());
			port.setIdRef(r.getId());
			SBMLutilities.cloneDimensionAddIndex(r,port,"comp:idRef");
		} else {
			sbmlCompModel.removePort(port);
		}
	} else {
		if (onPort) {
			port = sbmlCompModel.createPort();
			port.setId(r.getId());
			port.setIdRef(r.getId());
			SBMLutilities.cloneDimensionAddIndex(r,port,"comp:idRef");
		}
	}
	return r;
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:49,
代码来源:BioModel.java

示例7: createDegradationReaction

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public Reaction createDegradationReaction(String s,double kd,String sweep,boolean onPort, String[] dimensions) {
	createDegradationDefaultParameters();
	Reaction reaction = getDegradationReaction(s);
	if (reaction==null) {
		reaction = sbml.getModel().createReaction();
		reaction.setId(GlobalConstants.DEGRADATION + "_" + s);
		reaction.setSBOTerm(GlobalConstants.SBO_DEGRADATION);
		reaction.setCompartment(sbml.getModel().getSpecies(s).getCompartment());
		SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(reaction.getCompartment()),reaction,"compartment");
		reaction.setReversible(false);
		//reaction.setFast(false);
		SpeciesReference reactant = reaction.createReactant();
		reactant.setSpecies(s);
		reactant.setStoichiometry(1);
		reactant.setConstant(true);
	} 
	String indexStr = "";
	if (dimensions!=null && dimensions.length>0) {
		String [] dimIds = SBMLutilities.getDimensionIds("",dimensions.length-1);
		SBMLutilities.createDimensions(reaction, dimIds, dimensions);
		SBMLutilities.addIndices(reaction.getReactant(0), "species", dimIds, 0);
		indexStr = SBMLutilities.getIndicesString(reaction.getReactant(0), "species");
	}
	KineticLaw k = reaction.createKineticLaw();
	if (kd > 0 || sweep != null) {
		LocalParameter p = k.createLocalParameter();
		p.setId("kd");
		p.setValue(kd);
		if (sweep != null) {
			AnnotationUtility.setSweepAnnotation(p, sweep);
		} 
	}
	k.setMath(SBMLutilities.myParseFormula("kd*"+s+indexStr));
	Port port = getPortByIdRef(reaction.getId());
	if (port!=null) {
		if (onPort) {
			port.setId(reaction.getId());
			port.setIdRef(reaction.getId());
			SBMLutilities.cloneDimensionAddIndex(reaction,port,"comp:idRef");
		} else {
			sbmlCompModel.removePort(port);
		}
	} else {
		if (onPort) {
			port = sbmlCompModel.createPort();
			port.setId(reaction.getId());
			port.setIdRef(reaction.getId());
			SBMLutilities.cloneDimensionAddIndex(reaction,port,"comp:idRef");
		}
	}
	return reaction;
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:53,
代码来源:BioModel.java

示例8: createGridDegradationReaction

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public void createGridDegradationReaction(Species species) {
	
	String speciesID = species.getId();
	Boolean speciesDegrades = false;			
	//Reaction degradation = BioModel.getDegradationReaction(speciesID, compModel);
	
	//fix the sbo term/annotation stuff if it's not correct
	//if (degradation != null)
		speciesDegrades = true;
	
	//only make grid degradation reactions if the species is degradable
	if (speciesDegrades) {
	
		//create array of grid degradation reactions
		String decayString = GlobalConstants.KECDECAY_STRING;
		double decayRate = sbml.getModel().getParameter("kecd").getValue();
			
		String decayUnitString = "u_1_second_n1";
		
		if (sbml.getModel().getUnitDefinition(decayUnitString) == null) {
			
			UnitDefinition ud = sbml.getModel().createUnitDefinition();
			Unit unit = ud.createUnit();
			unit.setExponent(-1.0);
			unit.setKind(Unit.Kind.valueOf("second".toUpperCase()));
			unit.setScale(0);
			unit.setMultiplier(1);
			ud.setId(decayUnitString);
		}
		
		Reaction r = sbml.getModel().createReaction();
		r.setId(GlobalConstants.DEGRADATION + "_" + speciesID);
		SBMLutilities.setMetaId(r, r.getId());
		r.setCompartment(sbml.getModel().getCompartment(0).getId());
		SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(r.getCompartment()),r,"compartment");
		r.setReversible(false);
		//r.setFast(false);
		r.setSBOTerm(GlobalConstants.SBO_DEGRADATION);
		
		AnnotationUtility.setGridAnnotation(r, gridTable.getNumRows(), gridTable.getNumCols());
		
		KineticLaw kl = r.createKineticLaw();
		
		if (decayRate > 0) {
			
			//this is the mathematical expression for the decay
			String decayExpression = decayString + "* get2DArrayElement(" + speciesID + ", i, j)";				
			
			SpeciesReference reactant = r.createReactant();
			reactant.setSpecies(speciesID);
			reactant.setStoichiometry(1);
			reactant.setConstant(false);
			
			LocalParameter i = kl.createLocalParameter();
			LocalParameter j = kl.createLocalParameter();
			
			AnnotationUtility.setArraySizeAnnotation(i, gridTable.getNumRows());
			AnnotationUtility.setArraySizeAnnotation(j, gridTable.getNumCols());

			i.setId("i");
			j.setId("j");
			
			//parameter: id="kecd" value=(usually 0.005) units="u_1_second_n1" (inverse seconds)
			Utility.Parameter(kl, decayString, decayRate, decayUnitString);
			
			//formula: kecd * species
			kl.setMath(SBMLutilities.myParseFormula(decayExpression));
			
			Utility.addReaction(sbml, r);
		}
	}		
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:73,
代码来源:BioModel.java

示例9: createReaction

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public void createReaction(String id, float x, float y) {
	String compartment = getCompartmentByLocation(x,y, GlobalConstants.DEFAULT_REACTION_WIDTH, 
			GlobalConstants.DEFAULT_REACTION_HEIGHT);
	if (compartment.equals("")) {
		message.setErrorDialog("Compartment Required", "Reactions must be placed within a compartment.");
     this.notifyObservers(message);
		return;
	}
	if (id == null) {
		do {
			creatingReactionID++;
			id = "R" + String.valueOf(creatingReactionID);
		}
		while (SBMLutilities.getElementBySId(sbml, id)!=null);
	}
	Layout layout = getLayout();
	ReactionGlyph reactionGlyph = null;
	if (layout.getReactionGlyph(GlobalConstants.GLYPH+"__"+id)!=null) {
		reactionGlyph = layout.getReactionGlyph(GlobalConstants.GLYPH+"__"+id);
	} else {
		reactionGlyph = layout.createReactionGlyph(GlobalConstants.GLYPH+"__"+id);
		reactionGlyph.createBoundingBox();
		reactionGlyph.getBoundingBox().createDimensions();
		reactionGlyph.getBoundingBox().createPosition();
		reactionGlyph.setReaction(id);
	}
	reactionGlyph.getBoundingBox().getPosition().setX(x);
	reactionGlyph.getBoundingBox().getPosition().setY(y);
	reactionGlyph.getBoundingBox().getDimensions().setWidth(GlobalConstants.DEFAULT_REACTION_WIDTH);
	reactionGlyph.getBoundingBox().getDimensions().setHeight(GlobalConstants.DEFAULT_REACTION_HEIGHT);
	TextGlyph textGlyph = layout.createTextGlyph(GlobalConstants.TEXT_GLYPH+"__"+id);
	textGlyph.createBoundingBox();
	textGlyph.getBoundingBox().createDimensions();
	textGlyph.getBoundingBox().createPosition();
	textGlyph.setGraphicalObject(GlobalConstants.GLYPH+"__"+id);
	textGlyph.setText(SBMLutilities.getArrayId(sbml,id));
	textGlyph.setBoundingBox(reactionGlyph.getBoundingBox().clone());
	Model m = sbml.getModel();
	Reaction r = m.createReaction();
	r.setId(id);
	// Set default reaction metaID
	metaIDIndex = SBMLutilities.setDefaultMetaID(sbml, r, metaIDIndex); 
	r.setCompartment(compartment);
	SBMLutilities.cloneDimensionAddIndex(sbml.getModel().getCompartment(compartment),r,"compartment");
	r.setReversible(false);
	//r.setFast(false);
	KineticLaw k = r.createKineticLaw();
	LocalParameter p = k.createLocalParameter();
	p.setId("kf");
	p.setValue(0.1);
	p = k.createLocalParameter();
	p.setId("kr");
	p.setValue(1.0);
	k.setMath(SBMLutilities.myParseFormula("kf"));
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:56,
代码来源:BioModel.java

示例10: printPromoterBinding

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
/**
 * Prints each promoter binding
 * 
 * @param document
 *            the SBMLDocument to print to
 */
private void printPromoterBinding(SBMLDocument document) {
	for (Promoter p : promoters.values()) {
		// First setup RNAP binding
		if (p.getOutputs().size()==0) continue;
		String compartment = p.getCompartment();
		String rnapName = "RNAP";
		if (!compartment.equals(document.getModel().getCompartment(0).getId()))
			rnapName = compartment + "__RNAP";
		org.sbml.jsbml.Reaction r = new org.sbml.jsbml.Reaction(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
		r.setCompartment(compartment); 
		r.setId("R_" + p.getId() + "_RNAP");
		r.addReactant(Utility.SpeciesReference(rnapName, 1));
		r.addReactant(Utility.SpeciesReference(p.getId(), 1));
		r.addProduct(Utility.SpeciesReference(p.getId() + "_RNAP", 1));
		r.setReversible(true);
		//r.setFast(false);
		KineticLaw kl = r.createKineticLaw();
		double[] Krnap = p.getKrnap();
		if (Krnap[0] >= 0) {
			Utility.Parameter(kl, GlobalConstants.FORWARD_RNAP_BINDING_STRING, Krnap[0], 
					GeneticNetwork.getMoleTimeParameter(2));
			if (Krnap.length == 2) {
				Utility.Parameter(kl,GlobalConstants.REVERSE_RNAP_BINDING_STRING, Krnap[1], 
						GeneticNetwork.getMoleTimeParameter(1));
			} else {
				Utility.Parameter(kl,GlobalConstants.REVERSE_RNAP_BINDING_STRING, 1, GeneticNetwork.getMoleTimeParameter(1));
			}
		}
		kl.setMath(SBMLutilities.myParseFormula(GlobalConstants.FORWARD_RNAP_BINDING_STRING + "*" + rnapName + "*" + p.getId() + "-"+ 
				GlobalConstants.REVERSE_RNAP_BINDING_STRING + "*" + p.getId() + "_RNAP"));
		Utility.addReaction(document, r);

		// Next setup activated binding
		PrintActivatedBindingVisitor v = new PrintActivatedBindingVisitor(
				document, p, species, compartment, complexMap, partsMap);
		v.setComplexAbstraction(complexAbstraction);
		v.run();

		// Next setup repression binding
		PrintRepressionBindingVisitor v2 = new PrintRepressionBindingVisitor(
				document, p, species, complexMap, partsMap);
		v2.setComplexAbstraction(complexAbstraction);
		v2.run();
	}

}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:53,
代码来源:GeneticNetwork.java

示例11: printPromoterProduction

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
/**
 * Prints each promoter production values
 * 
 * @param document
 *            the SBMLDocument to print to
 */
private void printPromoterProduction(SBMLDocument document) {
	for (Promoter p : promoters.values()) {
		if (p.getOutputs().size()==0) continue;
		String compartment = p.getCompartment();
		org.sbml.jsbml.Reaction r = new org.sbml.jsbml.Reaction(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
		r.setCompartment(compartment);
		for (SpeciesInterface species : p.getOutputs()) {
			r.addProduct(Utility.SpeciesReference(species.getId(), p.getStoich()));
		}
		r.setReversible(false);
		//r.setFast(false);
		KineticLaw kl = r.createKineticLaw();
		if (operatorAbstraction) {
			r.setId("R_abstracted_production_" + p.getId());
			double rnap = 30;
			if (properties != null)
				rnap = Double.parseDouble(properties.getParameter(GlobalConstants.RNAP_STRING));
			AbstractionEngine e = new AbstractionEngine(species, complexMap, partsMap, rnap, r, kl);
			kl.setMath(SBMLutilities.myParseFormula(e.abstractOperatorSite(p)));
			Utility.addReaction(document, r);
		} else {
			r.addModifier(Utility.ModifierSpeciesReference(p.getId() + "_RNAP"));
			if (p.getActivators().size() > 0) {
				r.setId("R_basal_production_" + p.getId());
				Utility.Parameter(kl,kBasalString, p.getKbasal(), getMoleTimeParameter(1));
				kl.setMath(SBMLutilities.myParseFormula(kBasalString + "*" + p.getId() + "_RNAP"));
			} else {
				r.setId("R_constitutive_production_" + p.getId());
				Utility.Parameter(kl,kOcString, p.getKoc(), getMoleTimeParameter(1));
				kl.setMath(SBMLutilities.myParseFormula(kOcString + "*" + p.getId() + "_RNAP"));
			}
			Utility.addReaction(document, r);
			if (p.getActivators().size() > 0) {
				PrintActivatedProductionVisitor v = new PrintActivatedProductionVisitor(
						document, p, compartment);
				v.run();
			}
		}
	}
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:47,
代码来源:GeneticNetwork.java

示例12: Parameter

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
public static void Parameter(KineticLaw kl, String id, double value, String units) {
	if (kl.getLocalParameter(id)!=null) return;
	LocalParameter p = kl.createLocalParameter(id);
	p.setValue(value);
	p.setUnits(units);
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:7,
代码来源:Utility.java

示例13: setupReactions

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
private static void setupReactions(HierarchicalSimulation sim, ModelContainer container, VectorWrapper wrapper)
{
  Model model = container.getModel();
  HierarchicalModel modelstate = container.getHierarchicalModel();
  boolean split = modelstate.getModelType() == ModelType.HSSA;
  for (Reaction reaction : model.getListOfReactions())
  {

    ReplacementSetup.setupReplacement(sim, reaction, wrapper, VariableType.REACTION, container);

    ReactionNode reactionNode = (ReactionNode) modelstate.getNode(reaction.getId());

    if(reactionNode == null)
    {
      reactionNode = modelstate.addReaction(reaction.getId());
      reactionNode.createState(sim.getAtomicType(), wrapper);
    }
    if(sim.getInterestingSpecies() == null)
    {

      String printVariable = container.getPrefix() + reaction.getId();
      sim.addPrintVariable(printVariable, reactionNode, modelstate.getIndex(), false);
    }

    if (modelstate.isDeletedBySId(reaction.getId()))
    {
      continue;
    }
    else if (ArraysSetup.checkArray(reaction))
    {
      continue;
    }

    modelstate.insertPropensity(reactionNode);
    reactionNode.setValue(modelstate.getIndex(), 0);
    for (SpeciesReference reactant : reaction.getListOfReactants())
    {
      setupReactant(sim, container, reactionNode, reactant.getSpecies(), reactant, wrapper);
    }
    for (SpeciesReference product : reaction.getListOfProducts())
    {
      setupProduct(sim, container, reactionNode, product.getSpecies(), product, wrapper);
    }
    KineticLaw kineticLaw = reaction.getKineticLaw();
    if (kineticLaw != null)
    {
      for (LocalParameter localParameter : kineticLaw.getListOfLocalParameters())
      {

        String id = localParameter.getId();

        if (localParameter.isSetMetaId() && modelstate.isDeletedByMetaId(localParameter.getMetaId()))
        {
          continue;
        }

        VariableNode node = new VariableNode(id, StateType.SCALAR);
        node.setValue(localParameter.getValue());
        reactionNode.addLocalParameter(id, node);
      }
      if (kineticLaw.isSetMath())
      {
        ASTNode reactionFormula = kineticLaw.getMath();

        if (reaction.isReversible() && split)
        {
          setupSingleRevReaction(sim, modelstate, reactionNode, reactionFormula, model);
        }
        else
        {
          setupSingleNonRevReaction(sim, modelstate, reactionNode, reactionFormula, model);
        }
      }
    }
  }

}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:78,
代码来源:CoreSetup.java

示例14: setupLocalParameters

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
/**
 * sets up the local parameters in a single kinetic law
 * 
 * @param kineticLaw
 * @param reactionID
 */
private void setupLocalParameters(KineticLaw kineticLaw, Reaction reaction)
{

	String reactionID = reaction.getId();
	reactionID = reactionID.replace("_negative_", "-");

	for (int i = 0; i < kineticLaw.getLocalParameterCount(); i++)
	{

		LocalParameter localParameter = kineticLaw.getLocalParameter(i);

		String parameterID = "";

		// the parameters don't get reset after each run, so don't re-do
		// this prepending
		if (localParameter.getId().contains(reactionID + "_") == false)
		{
			parameterID = reactionID + "_" + localParameter.getId();
		}
		else
		{
			parameterID = localParameter.getId();
			// System.out.println("Before: " + localParameter.getId() +
			// " after: " + parameterID);
		}

		String oldParameterID = localParameter.getId();
		variableToValueMap.put(parameterID, localParameter.getValue());

		// alter the local parameter ID so that it goes to the local and not
		// global value
		if (localParameter.getId() != parameterID)
		{
			localParameter.setId(parameterID);
			SBMLutilities.setMetaId(localParameter, parameterID);
		}
		// System.out.println("After: " + localParameter.getId());

		// for some reason, changing the local parameter sometimes changes
		// the kinetic law instances
		// of that parameter id (and sometimes doesn't), so those ones are
		// fine and ignore them
		// if (kineticLaw.getMath().toFormula().contains(parameterID) ==
		// false) {

		alterLocalParameter(kineticLaw.getMath(), reaction, oldParameterID, parameterID);
		// }
	}
	// System.out.println(kineticLaw.getMath().toFormula());
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:57,
代码来源:Simulator.java

示例15: setupParameters

点赞 2

import org.sbml.jsbml.KineticLaw; //导入依赖的package包/类
/**
 * puts parameter-related information into data structures
 */
protected void setupParameters()
{

	// add local parameters
	for (Reaction reaction : model.getListOfReactions())
	{

		if (!reaction.isSetKineticLaw())
		{
			continue;
		}
		KineticLaw kineticLaw = reaction.getKineticLaw();
		setupLocalParameters(kineticLaw, reaction);
	}

	// add values to hashmap for easy access to global parameter values
	// NOTE: the IDs for the parameters and species must be unique, so
	// putting them in the
	// same hashmap is okay
	for (Parameter parameter : model.getListOfParameters())
	{

		setupSingleParameter(parameter);
	}

	// add compartment sizes in
	for (Compartment compartment : model.getListOfCompartments())
	{

		String compartmentID = compartment.getId();

		compartmentIDSet.add(compartmentID);
		variableToValueMap.put(compartmentID, compartment.getSize());

		if (Double.isNaN(compartment.getSize()))
		{
			variableToValueMap.put(compartmentID, 1.0);
		}

		variableToIsConstantMap.put(compartmentID, compartment.getConstant());

		if (numRules > 0)
		{
			variableToIsInAssignmentRuleMap.put(compartmentID, false);
		}

		if (numConstraints > 0)
		{
			variableToIsInConstraintMap.put(compartmentID, false);
		}
	}
}
 

开发者ID:MyersResearchGroup,
项目名称:iBioSim,
代码行数:56,
代码来源:Simulator.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)