本文整理汇总了Java中org.sbml.jsbml.Model类的典型用法代码示例。如果您正苦于以下问题:Java Model类的具体用法?Java Model怎么用?Java Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Model类属于org.sbml.jsbml包,在下文中一共展示了Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: constructGraph
import org.sbml.jsbml.Model; //导入依赖的package包/类
private void constructGraph(SBMLDocument sbmlDoc, HashMap<String, AssemblyNode2> idToNode) {
Model sbmlModel = sbmlDoc.getModel();
// Creates assembly nodes for species and maps their metaIDs to the nodes
parseSpeciesSBOL(sbmlModel, idToNode);
// Creates assembly nodes for global parameters and maps their metaIDs to the nodes
parseParameterSBOL(sbmlModel, idToNode);
// Creates assembly nodes for reactions and connects them to nodes for species
// Maps reaction parameters to reactions
parseReactionSBOL(sbmlModel, idToNode);
// Creates assembly nodes for rules and connects them to nodes for reactions and rules
// on the basis of shared parameters
parseRuleSBOL(sbmlModel, idToNode);
parseEventSBOL(sbmlModel, idToNode);
constructReverseEdges();
selectStartNodes();
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:23,代码来源:AssemblyGraph2.java
示例2: parseRuleSBOL
import org.sbml.jsbml.Model; //导入依赖的package包/类
private void parseRuleSBOL(Model sbmlModel, HashMap<String, AssemblyNode2> idToNode) {
for (int i = 0; i < sbmlModel.getRuleCount(); i++) {
Rule sbmlRule = sbmlModel.getRule(i);
// Creates assembly node for rule
if (sbmlRule.isAssignment() || sbmlRule.isRate()) {
AssemblyNode2 ruleNode = constructNode(sbmlRule);
if (ruleNode.getURIs().size() > 0)
containsSBOL = true;
// Connects assembly nodes for input species, reaction rates, and parameters to node for rule
parseMath(sbmlRule, ruleNode, idToNode);
// Connects assembly node for rule to node for its output species or parameter
String output = SBMLutilities.getVariable(sbmlRule);
if (output != null && idToNode.containsKey(output)) {
AssemblyNode2 outputNode = idToNode.get(output);
constructEdge(ruleNode, outputNode);
}
if (sbmlRule.getExtensionPackages().containsKey(CompConstants.namespaceURI))
parsePortMappings(sbmlRule, ruleNode, idToNode);
}
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:22,代码来源:AssemblyGraph2.java
示例3: parseEventSBOL
import org.sbml.jsbml.Model; //导入依赖的package包/类
private void parseEventSBOL(Model sbmlModel, HashMap<String, AssemblyNode2> idToNode) {
for (int i = 0; i < sbmlModel.getEventCount(); i++) {
Event sbmlEvent = sbmlModel.getListOfEvents().get(i);
AssemblyNode2 eventNode = constructNode(sbmlEvent, sbmlEvent.getId());
if (eventNode.getURIs().size() > 0)
containsSBOL = true;
idToNode.put(sbmlEvent.getId(), eventNode);
if (sbmlEvent.getTrigger() != null)
parseMath(sbmlEvent.getTrigger(), eventNode, idToNode);
if (sbmlEvent.getDelay() != null)
parseMath(sbmlEvent.getDelay(), eventNode, idToNode);
if (sbmlEvent.getPriority() != null)
parseMath(sbmlEvent.getPriority(), eventNode, idToNode);
for (int j = 0; j < sbmlEvent.getEventAssignmentCount(); j++) {
parseMath(sbmlEvent.getEventAssignment(j), eventNode, idToNode);
String output = sbmlEvent.getEventAssignment(j).getVariable();
if (output != null && idToNode.containsKey(output)) {
AssemblyNode2 outputNode = idToNode.get(output);
constructEdge(eventNode, outputNode);
}
}
if (sbmlEvent.getExtensionPackages().containsKey(CompConstants.namespaceURI))
parsePortMappings(sbmlEvent, eventNode, idToNode);
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:AssemblyGraph2.java
示例4: constructGraph
import org.sbml.jsbml.Model; //导入依赖的package包/类
private Set<SynthesisNode> constructGraph(Model sbmlModel, SBOLFileManager fileManager) throws SBOLException {
HashMap<String, SynthesisNode> idToNode = new HashMap<String, SynthesisNode>();
edges = new HashMap<SynthesisNode, List<SynthesisNode>>();
nucleotideCount = 0;
compURIs = new HashSet<URI>();
signals = new HashSet<String>();
for (int i = 0; i < sbmlModel.getReactionCount(); i++)
{
Reaction sbmlReaction = sbmlModel.getReaction(i);
if (sbmlReaction.getProductCount() > 0)
if (BioModel.isProductionReaction(sbmlReaction))
{
constructTranscriptionMotif(sbmlReaction, idToNode, sbmlModel, fileManager);
}
else if ((BioModel.isComplexReaction(sbmlReaction)))
{
constructComplexationMotif(sbmlReaction, idToNode, sbmlModel, fileManager);
}
}
//TODO: why return the value of idToNode and ignore the key?
//NOTE: create a table of all the values in idToNode which contains transcription and complex formation reaction
return new HashSet<SynthesisNode>(idToNode.values());
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:24,代码来源:SynthesisGraph.java
示例5: constructComplexationMotif
import org.sbml.jsbml.Model; //导入依赖的package包/类
private void constructComplexationMotif(Reaction sbmlReaction, HashMap<String, SynthesisNode> idToNode,
Model sbmlModel, SBOLFileManager fileManager) throws SBOLException {
//TODO: complexationMotif = complex formation ?
// complex formation always has only 1 product?
//NOTE: create nodes for products and reactants and add to edges table to represent complex formation
SpeciesReference sbmlProduct = sbmlReaction.getProduct(0);
SynthesisNode complexNode = constructNode("x", sbmlModel.getSpecies(sbmlProduct.getSpecies()),
idToNode, fileManager);
//TODO: why don't we want to check if complexNode already exist in edges before adding?
edges.put(complexNode, new LinkedList<SynthesisNode>());
for (int j = 0; j < sbmlReaction.getReactantCount(); j++)
{
SpeciesReference sbmlReactant = sbmlReaction.getReactant(j);
SynthesisNode speciesNode = constructNode("v", sbmlModel.getSpecies(sbmlReactant.getSpecies()),
idToNode, fileManager);
edges.get(complexNode).add(speciesNode);
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:19,代码来源:SynthesisGraph.java
示例6: performModelChanges
import org.sbml.jsbml.Model; //导入依赖的package包/类
public void performModelChanges(SEDMLDocument sedmlDoc, String taskId, String stem, String filename) {
SedML sedml = sedmlDoc.getSedMLModel();
if (stem != null && !stem.equals("")) {
taskId = taskId + "__" + stem;
}
AbstractTask task = sedml.getTaskWithId(taskId);
if (task == null) return;
org.jlibsedml.Model model = sedml.getModelWithId(task.getModelReference());
SBMLWriter Xwriter = new SBMLWriter();
try {
if (model.getListOfChanges().size() == 0) return;
Xwriter.write(applyChanges(sedmlDoc, sbml, model), filename);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:BioModel.java
示例7: 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
示例8: getDegradationReaction
import org.sbml.jsbml.Model; //导入依赖的package包/类
public static Reaction getDegradationReaction(String speciesId, Model sbmlModel) {
String componentId = "";
String shortSpeciesId = speciesId;
if (speciesId.contains("__")) {
componentId = speciesId.substring(0,speciesId.lastIndexOf("__")+2);
shortSpeciesId = speciesId.substring(speciesId.lastIndexOf("__")+2);
}
Reaction degradation = sbmlModel.getReaction(componentId + GlobalConstants.DEGRADATION + "_" + shortSpeciesId);
if (degradation == null) {
for (int i = 0; i < sbmlModel.getReactionCount(); i++) {
Reaction r = sbmlModel.getReaction(i);
if (BioModel.isDegradationReaction(r) && r.hasReactant(new Species(speciesId)))
return r;
}
} else if (BioModel.isDegradationReaction(degradation))
return degradation;
return null;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:19,代码来源:BioModel.java
示例9: getProductionReaction
import org.sbml.jsbml.Model; //导入依赖的package包/类
public static Reaction getProductionReaction(String promoterId, Model sbmlModel) {
String componentId = "";
String shortPromoterId = promoterId;
if (promoterId.contains("__")) {
componentId = promoterId.substring(0, promoterId.lastIndexOf("__") + 2);
shortPromoterId = promoterId.substring(promoterId.lastIndexOf("__") + 2);
}
Reaction production = sbmlModel.getReaction(componentId + GlobalConstants.PRODUCTION + "_" + shortPromoterId);
if (production == null)
for (int i = 0; i < sbmlModel.getReactionCount(); i++) {
Reaction r = sbmlModel.getReaction(i);
if (BioModel.isProductionReaction(r) && r.hasModifier(new Species(promoterId)))
return r;
}
else if (BioModel.isProductionReaction(production))
return production;
return null;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:19,代码来源:BioModel.java
示例10: getDiffusionReaction
import org.sbml.jsbml.Model; //导入依赖的package包/类
public static Reaction getDiffusionReaction(String speciesId, Model sbmlModel) {
Reaction diffusion = sbmlModel.getReaction("MembraneDiffusion_"+speciesId);
if (diffusion == null) {
diffusion = sbmlModel.getReaction("Diffusion_"+speciesId);
if (diffusion != null) {
diffusion.setId("MembraneDiffusion_"+speciesId);
}
}
if (diffusion != null) {
if (diffusion.isSetSBOTerm()) {
if (diffusion.getSBOTerm()==GlobalConstants.SBO_DIFFUSION) return diffusion;
} else if (AnnotationUtility.checkObsoleteAnnotation(diffusion,"Diffusion")) {
diffusion.setSBOTerm(GlobalConstants.SBO_DIFFUSION);
AnnotationUtility.removeObsoleteAnnotation(diffusion);
return diffusion;
}
}
return null;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:20,代码来源:BioModel.java
示例11: getComplexReaction
import org.sbml.jsbml.Model; //导入依赖的package包/类
public static Reaction getComplexReaction(String speciesId, Model sbmlModel) {
String componentId = "";
String shortSpeciesId = speciesId;
if (speciesId.contains("__")) {
componentId = speciesId.substring(0,speciesId.lastIndexOf("__")+2);
shortSpeciesId = speciesId.substring(speciesId.lastIndexOf("__")+2);
}
Reaction complexation = sbmlModel.getReaction(componentId + GlobalConstants.COMPLEXATION
+ "_" + shortSpeciesId);
if (complexation == null) {
for (int i = 0; i < sbmlModel.getReactionCount(); i++) {
Reaction r = sbmlModel.getReaction(i);
if (BioModel.isComplexReaction(r) && r.hasProduct(new Species(speciesId)))
return r;
}
} else if (BioModel.isComplexReaction(complexation))
return complexation;
return null;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:20,代码来源:BioModel.java
示例12: functionInUse
import org.sbml.jsbml.Model; //导入依赖的package包/类
/**
* Check if a function is in use.
* @param document
* @param id
* @param zeroDim
* @param checkReactions
* @param observable TODO
* @param observer TODO
* @return
*/
public static boolean functionInUse(SBMLDocument document, String id, boolean zeroDim, boolean checkReactions, BioObservable observable, BioObserver observer)
{
if (variableInUse(document,id,zeroDim,checkReactions, observable, observer)) {
return true;
}
Model model = document.getModel();
for (int i = 0; i < model.getFunctionDefinitionCount(); i++)
{
FunctionDefinition funcDefn = model.getFunctionDefinition(i);
String funcDefnStr = SBMLutilities.myFormulaToString(funcDefn.getMath());
String[] vars = funcDefnStr.split(" |\\(|\\)|\\,");
for (int j = 0; j < vars.length; j++)
{
if (vars[j].equals(id))
{
return true;
}
}
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:33,代码来源:SBMLutilities.java
示例13: addRandomFunctions
import org.sbml.jsbml.Model; //导入依赖的package包/类
public static void addRandomFunctions(SBMLDocument document)
{
Model model = document.getModel();
createFunction(model, "uniform", "Uniform distribution", "lambda(a,b,(a+b)/2)");
createFunction(model, "normal", "Normal distribution", "lambda(m,s,m)");
createFunction(model, "exponential", "Exponential distribution", "lambda(l,1/l)");
createFunction(model, "gamma", "Gamma distribution", "lambda(a,b,a*b)");
createFunction(model, "poisson", "Poisson distribution", "lambda(mu,mu)");
createFunction(model, "lognormal", "Lognormal distribution", "lambda(z,s,exp(z+s^2/2))");
createFunction(model, "chisq", "Chi-squared distribution", "lambda(nu,nu)");
createFunction(model, "laplace", "Laplace distribution", "lambda(a,0)");
createFunction(model, "cauchy", "Cauchy distribution", "lambda(a,a)");
createFunction(model, "rayleigh", "Rayleigh distribution", "lambda(s,s*sqrt(pi/2))");
createFunction(model, "binomial", "Binomial distribution", "lambda(p,n,p*n)");
createFunction(model, "bernoulli", "Bernoulli distribution", "lambda(p,p)");
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:17,代码来源:SBMLutilities.java
示例14: convertIndex
import org.sbml.jsbml.Model; //导入依赖的package包/类
private static HierarchicalNode convertIndex(HierarchicalModel modelstate, ModelContainer container, ArrayNode arrayNode, String referencedNode, ArraysSBasePlugin plugin, String attribute)
{
Model model = container.getModel();
int maxIndex = getMaxArrayDim(plugin, attribute);
HierarchicalNode selector = new HierarchicalNode(Type.FUNCTION_SELECTOR);
selector.addChild(modelstate.getNode(referencedNode));
for (int i = maxIndex; i >= 0; i--)
{
Index index = plugin.getIndex(i, attribute);
HierarchicalNode indexMath = MathInterpreter.parseASTNode(index.getMath(), modelstate.getVariableToNodeMap(), arrayNode.getDimensionMap(), InterpreterType.OTHER);
selector.addChild(indexMath);
}
return selector;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:ArraysSetup.java
示例15: setupSingleRevReaction
import org.sbml.jsbml.Model; //导入依赖的package包/类
private static void setupSingleRevReaction(HierarchicalSimulation sim, HierarchicalModel modelstate, ReactionNode reactionNode, ASTNode reactionFormula, Model model)
{
ASTNode[] splitMath = HierarchicalUtilities.splitMath(reactionFormula);
if (splitMath == null)
{
HierarchicalNode math = MathInterpreter.parseASTNode(reactionFormula, null, modelstate.getVariableToNodeMap(), reactionNode.getLocalParameters(), reactionNode, InterpreterType.RATE);
reactionNode.setForwardRate(math);
}
else
{
HierarchicalNode forwardRate = MathInterpreter.parseASTNode(splitMath[0], null, modelstate.getVariableToNodeMap(), reactionNode.getLocalParameters(), reactionNode, InterpreterType.RATE);
reactionNode.setForwardRate(forwardRate);
HierarchicalNode reverseRate = MathInterpreter.parseASTNode(splitMath[1], null, modelstate.getVariableToNodeMap(), reactionNode.getLocalParameters(), reactionNode, InterpreterType.RATE);
reactionNode.setReverseRate(reverseRate);
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:CoreSetup.java
示例16: ModelContainer
import org.sbml.jsbml.Model; //导入依赖的package包/类
public ModelContainer(Model model, HierarchicalModel hierarchicalModel, ModelContainer parent, ModelType type)
{
this.model = model;
this.hierarchicalModel = hierarchicalModel;
this.compModel = (CompModelPlugin) model.getPlugin(CompConstants.namespaceURI);
if(model.getSBMLDocument() != null)
{
compDoc = (CompSBMLDocumentPlugin) model.getSBMLDocument().getPlugin(CompConstants.namespaceURI);
}
this.parent = parent;
setPrefix();
addChild();
setModelType(hierarchicalModel, model, type);
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:17,代码来源:ModelContainer.java
示例17: 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
示例18: refreshConstraintsPanel
import org.sbml.jsbml.Model; //导入依赖的package包/类
/**
* Refresh constraints panel
*/
public void refreshConstraintsPanel() {
Model model = bioModel.getSBMLDocument().getModel();
ListOf<Constraint> listOfConstraints = model.getListOfConstraints();
String[] cons = new String[model.getConstraintCount()];
for (int i = 0; i < model.getConstraintCount(); i++) {
Constraint constraint = listOfConstraints.get(i);
if (!constraint.isSetMetaId()) {
String constraintId = "c0";
int cn = 0;
while (bioModel.isSIdInUse(constraintId)) {
cn++;
constraintId = "c" + cn;
}
SBMLutilities.setMetaId(constraint, constraintId);
}
cons[i] = constraint.getMetaId() + SBMLutilities.getDimensionString(constraint);
}
edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility.sort(cons);
constraints.setListData(cons);
constraints.setSelectedIndex(0);
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:25,代码来源:Constraints.java
示例19: refreshInitialAssignmentPanel
import org.sbml.jsbml.Model; //导入依赖的package包/类
/**
* Refresh initial assingment panel
*/
public void refreshInitialAssignmentPanel(BioModel gcm) {
Model model = gcm.getSBMLDocument().getModel();
if (model.getInitialAssignmentCount() > 0) {
String[] inits = new String[model.getInitialAssignmentCount()];
for (int i = 0; i < model.getInitialAssignmentCount(); i++) {
InitialAssignment init = model.getListOfInitialAssignments().get(i);
inits[i] = init.getVariable() + " = " + SBMLutilities.myFormulaToString(init.getMath());
}
try {
inits = sortInitRules(inits);
if (SBMLutilities.checkCycles(gcm.getSBMLDocument())) {
JOptionPane.showMessageDialog(Gui.frame, "Cycle detected within initial assignments, assignment rules, and rate laws.",
"Cycle Detected", JOptionPane.ERROR_MESSAGE);
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(Gui.frame, "Cycle detected in assignments.", "Cycle Detected", JOptionPane.ERROR_MESSAGE);
}
initAssigns.setListData(inits);
initAssigns.setSelectedIndex(0);
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:InitialAssignments.java
示例20: addParameter
import org.sbml.jsbml.Model; //导入依赖的package包/类
/**
* Adds the given time course data as a parameter to the SBML model.
* <p>
* The sizes of the time and values lists must be equal.
* <p>
* The time values must be sorted in ascending order.
*
* @param sbmlModel SBML model to which the parameter is to be added
* @param parameterName name of the parameter to add
* @param times time values for time course data
* @param values data values for time course data
* @param interpolator interpolation strategy to use
*/
public static void addParameter(
Model sbmlModel, String parameterName, List<Double> times, List<Double> values,
Interpolator interpolator) {
// Basic parameter checking. As this is an library best to give users errors that relate
// to their usage rather than library internals.
if (sbmlModel == null)
throw new IllegalArgumentException("sbmlModel parameter cannot be null");
if (parameterName == null)
throw new IllegalArgumentException("parameterName parameter cannot be null");
if (parameterName.length() == 0)
throw new IllegalArgumentException("parameterName parameter cannot be empty string");
if (times == null)
throw new IllegalArgumentException("times parameter cannot be null");
if (values == null)
throw new IllegalArgumentException("values parameter cannot be null");
addParameter(
sbmlModel, parameterName, toPrimitiveArray(times), toPrimitiveArray(values),
interpolator);
}
开发者ID:allyhume,项目名称:SBMLDataTools,代码行数:35,代码来源:SBMLTimeCourseDataHelper.java
注:本文中的org.sbml.jsbml.Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论