当前位置: 首页>>代码示例>>Java>>正文


Java Model.getParameter方法代码示例

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


在下文中一共展示了Model.getParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateComplexCooperativity

import org.sbml.jsbml.Model; //导入方法依赖的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: prependToVariableNodes

import org.sbml.jsbml.Model; //导入方法依赖的package包/类
/**
 * recursively finds all variable nodes and prepends a string to the
 * variable static version
 * 
 * @param node
 * @param toPrepend
 */
private static void prependToVariableNodes(ASTNode node, String toPrepend, Model model)
{

	if (node.isName())
	{

		// only prepend to species and parameters
		if (model.getSpecies(toPrepend + node.getName()) != null)
		{
			node.setVariable(model.getSpecies(toPrepend + node.getName()));
		}
		else if (model.getParameter(toPrepend + node.getName()) != null)
		{
			node.setVariable(model.getParameter(toPrepend + node.getName()));
		}
	}
	else
	{
		for (ASTNode childNode : node.getChildren())
		{
			prependToVariableNodes(childNode, toPrepend, model);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:32,代码来源:Simulator.java

示例3: parseParameterSBOL

import org.sbml.jsbml.Model; //导入方法依赖的package包/类
private void parseParameterSBOL(Model sbmlModel, HashMap<String, AssemblyNode2> idToNode) {
	for (int i = 0; i < sbmlModel.getParameterCount(); i++) {
		Parameter sbmlParameter = sbmlModel.getParameter(i);
		AssemblyNode2 parameterNode = constructNode(sbmlParameter, sbmlParameter.getId());
		if (parameterNode.getURIs().size() > 0)
			containsSBOL = true;
		idToNode.put(sbmlParameter.getId(), parameterNode);
		if (sbmlParameter.getExtensionPackages().containsKey(CompConstants.namespaceURI))
			parsePortMappings(sbmlParameter, parameterNode, idToNode);
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:12,代码来源:AssemblyGraph2.java

示例4: getDimensionSize

import org.sbml.jsbml.Model; //导入方法依赖的package包/类
public static Map<String, Double> getDimensionSize(Model model, Map<String, String> dimNSize)
{
	Map<String, Double> dimensionSizes = new HashMap<String, Double>();
	for (String dimId : dimNSize.keySet())
	{
		String parameterId = dimNSize.get(dimId);
		Parameter param = model.getParameter(parameterId);
		if (param == null)
		{
			return null;
		}
		dimensionSizes.put(dimId, param.getValue());
	}
	return dimensionSizes;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:16,代码来源:SBMLutilities.java

示例5: normalExcecution

import org.sbml.jsbml.Model; //导入方法依赖的package包/类
/**
 * Tests that correct execution produced fitted data that closely matches the function that
 * was sampled to produce the external data.  Here the sine function is used.
 */
@Test
public void normalExcecution() {
    setSinData();
    SBMLDocument doc = new SBMLDocument(3, 1);
    Model model = doc.createModel("test_model");

    SBMLTimeCourseDataHelper.addParameter(
            model, "myParam", _times, _values, new PolynomialInterpolator(new SplineInterpolator()));
    
    // Model must now have a parameter called myParam with specific properties
    assertEquals("Model must have one parameter", 1, model.getParameterCount());
    Parameter param = model.getParameter(0);
    assertEquals("Parameter id: ",         "myParam", param.getId());
    assertEquals("Parameter name: ",       "myParam", param.getName());
    assertEquals("Parameter isConstant: ", false,     param.isConstant());

    // Model must have an assignment rule that is associated with the parameter
    assertEquals("Model must have one rule", 1, model.getRuleCount());
    Rule rule = model.getRule(0);
    assertTrue("Rule must be assignment rule", rule instanceof AssignmentRule);
    AssignmentRule assignmentRule = (AssignmentRule) rule;
    assertEquals("Variable of assignment rule", "myParam", assignmentRule.getVariable());
    
    // Now we can compare data with the fitted data - for the sine function the spline
    // should fit quite well
    for (double t = _times[0]; t<_times[_times.length-1]; t+=0.005) {
        double sin = Math.sin(t);
        double fitted = evaluateMathML(assignmentRule.getMath(), t);
        
        assertTrue(
                "Fitted must be close to actual, t=" + t + " sine="+sin +" fitted=" + fitted + 
                    " diff=" + Math.abs(sin-fitted), 
                Math.abs(sin-fitted) < 0.01);
    }
}
 
开发者ID:allyhume,项目名称:SBMLDataTools,代码行数:40,代码来源:SBMLTimeCourseDataHelperTest.java

示例6: estimate

import org.sbml.jsbml.Model; //导入方法依赖的package包/类
/**
 * This function is used to execute parameter estimation from a given SBML file. The input model serves
 * as a template and the existing parameters in the model will set the bounds to which parameter estimation will use.
 * <p>
 * In addition, the SBML file is used for simulation when estimating the values of the parameters. 
 * 
 * @param SBMLFileName: the input SBML file
 * @param root: the directory where the experimental data is located
 * @param parameterList: the list of parameters that needs to have the value estimated.
 * @param experiments: data object that holds the experimental data.
 * @param speciesCollection: data object that holds the species in the model.
 * @return A new SBMLDocument containing the new parameter values.
 * @throws IOException - when a file cannot be read or written.
 * @throws XMLStreamException - when an SBML file cannot be parsed.
 * @throws BioSimException - when simulation encounters a problem.
 */
public static SBMLDocument estimate(String SBMLFileName, String root, List<String> parameterList, Experiments experiments, SpeciesCollection speciesCollection) throws IOException, XMLStreamException, BioSimException
{

	int numberofparameters = parameterList.size();
	int sp = 0;
	int n = experiments.getExperiments().get(0).size() - 1;
	double ep = experiments.getExperiments().get(0).get(n).get(0);
	double[] lowerbounds = new double[numberofparameters];
	double[] upperbounds = new double[numberofparameters];
	HierarchicalSimulation sim = new HierarchicalODERKSimulator(SBMLFileName, root, 0);
	sim.initialize(randomSeed, 0);

	for (int i = 0; i < numberofparameters; i++)
	{
		lowerbounds[i] = sim.getTopLevelValue(parameterList.get(i)) / 100;
		upperbounds[i] = sim.getTopLevelValue(parameterList.get(i)) * 100;
	}
	Modelsettings M1 = new Modelsettings(experiments.getExperiments().get(0).get(0), speciesCollection.size(), sp, (int) ep, lowerbounds, upperbounds, false);
	// Objective objective1 = new ObjectiveSqureError(M1,0.1);

	EvolutionMethodSetting EMS = new EvolutionMethodSetting();
	ObjectiveSqureError TP = new ObjectiveSqureError(sim, experiments, parameterList, speciesCollection, M1, 0.1);

	SRES sres = new SRES(TP, EMS);
	SRES.Solution solution = sres.run(200).getBestSolution();

	// TODO: report results: take average of error
	// TODO: weight mean square error. Add small value
	SBMLDocument doc = SBMLReader.read(new File(SBMLFileName));
	Model model = doc.getModel();
	
	for(int i = 0; i < parameterList.size(); i++)
	{
	  Parameter parameter = model.getParameter(parameterList.get(i));
	  
	  if(parameter != null)
	  {
	    parameter.setValue(solution.getFeatures()[i]);
	  }
	}
	System.out.println(solution.toString());
	return doc;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:60,代码来源:ParameterEstimator.java


注:本文中的org.sbml.jsbml.Model.getParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。