本文整理汇总了Java中org.sbml.jsbml.SBMLDocument类的典型用法代码示例。如果您正苦于以下问题:Java SBMLDocument类的具体用法?Java SBMLDocument怎么用?Java SBMLDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SBMLDocument类属于org.sbml.jsbml包,在下文中一共展示了SBMLDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isSetSBOTerm
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Checks if is sets the SBO term.
*
* @param document the document
* @return boolean
* TODO
*/
public static boolean isSetSBOTerm(SBMLDocument document) {
boolean species = checkSBOTermFromList(document.getModel().getListOfSpecies());
boolean compartment = checkSBOTermFromList(document.getModel().getListOfCompartments());
boolean reaction = checkSBOTermFromList(document.getModel().getListOfReactions());
ListOf<Reaction> lor = document.getModel().getListOfReactions();
boolean reactant = true;
boolean product = true;
boolean modifier = true;
for (Reaction r: lor) {
if (!checkSBOTermFromList(r.getListOfReactants())) {
reactant = false;
}
if (!checkSBOTermFromList(r.getListOfProducts())) {
product = false;
}
if (!checkSBOTermFromList(r.getListOfModifiers())) {
modifier = false;
}
}
return species && compartment && reaction && reactant && product && modifier;
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:31,代码来源:SBMLUtil.java
示例2: AssemblyGraph2
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
public AssemblyGraph2(BioModel biomodel) throws XMLStreamException, IOException, BioSimException {
assemblyNodes = new HashSet<AssemblyNode2>(); // Initialize map of SBML element meta IDs to assembly nodes they identify
assemblyEdges = new HashMap<AssemblyNode2, Set<AssemblyNode2>>(); // Initialize map of assembly node IDs to sets of node IDs (node IDs are SBML meta IDs)
SBMLDocument sbmlDoc = biomodel.getSBMLDocument();
HashMap<String, AssemblyNode2> idToNode = new HashMap<String, AssemblyNode2>();
// Creates assembly nodes for submodels and connect them to nodes for species
if (parseSubModelSBOL(sbmlDoc, biomodel.getPath(), idToNode)) {
// Creates flattened assembly graph in case hierarchy of SBOL can't be preserved
SBMLDocument flatDoc;
try {
flatDoc = biomodel.flattenModel(true);
} catch (Exception e){
e.printStackTrace();
flatDoc = null;
}
// TODO: Hack to prevent null returned by flattenModel to crash assembly code
if (flatDoc==null) {
flatDoc = sbmlDoc;
}
flatAssemblyGraph = new AssemblyGraph2(flatDoc);
}
constructGraph(sbmlDoc, idToNode);
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:24,代码来源:AssemblyGraph2.java
示例3: constructGraph
import org.sbml.jsbml.SBMLDocument; //导入依赖的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
示例4: usedInReaction
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Create check if species used in reaction
*/
public static boolean usedInReaction(SBMLDocument document, String id)
{
for (int i = 0; i < document.getModel().getReactionCount(); i++)
{
for (int j = 0; j < document.getModel().getReaction(i).getReactantCount(); j++)
{
if (document.getModel().getReaction(i).getReactant(j).getSpecies().equals(id))
{
return true;
}
}
for (int j = 0; j < document.getModel().getReaction(i).getProductCount(); j++)
{
if (document.getModel().getReaction(i).getProduct(j).getSpecies().equals(id))
{
return true;
}
}
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:25,代码来源:Utils.java
示例5: printRNAP
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Prints the RNAP molecule to the document
*
* @param document
* the SBML document
*/
private void printRNAP(SBMLDocument document) {
double rnap = 30;
if (properties != null) {
rnap = Double.parseDouble(properties.getParameter(GlobalConstants.RNAP_STRING));
}
Species s = Utility.makeSpecies("RNAP", document.getModel().getCompartment(0).getId(), rnap, -1);
s.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, s);
//Adds RNA polymerase for compartments other than default
this.compartments = new HashMap<String,Properties>();
for (int i=0; i < document.getModel().getCompartmentCount(); i++) {
compartments.put(document.getModel().getCompartment(i).getId(), null);
}
for (String compartment : compartments.keySet()) {
Properties prop = compartments.get(compartment);
if (prop != null && prop.containsKey(GlobalConstants.RNAP_STRING)) {
rnap = Double.parseDouble((String)prop.get(GlobalConstants.RNAP_STRING));
}
Species sc = Utility.makeSpecies(compartment + "__RNAP", compartment, rnap, -1);
sc.setHasOnlySubstanceUnits(true);
Utility.addSpecies(document, sc);
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:30,代码来源:GeneticNetwork.java
示例6: updatePortDimensionsIndices
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
public static void updatePortDimensionsIndices(Submodel submodel, Port port, SBaseRef sbaseRef, Port subPort,
SBMLDocument subDocument,SBMLDocument document)
{
ArraysSBasePlugin sBasePlugin = getArraysSBasePlugin(submodel);
ArraysSBasePlugin sBasePluginPort = getArraysSBasePlugin(port);
ArraysSBasePlugin sBasePluginSBaseRef = getArraysSBasePlugin(sbaseRef);
ArraysSBasePlugin sBasePluginSubPort = getArraysSBasePlugin(subPort);
for (Dimension dim : sBasePluginSubPort.getListOfDimensions()) {
Dimension dimClone = dim.clone();
dimClone.setArrayDimension(dim.getArrayDimension()+sBasePlugin.getListOfDimensions().size());
dimClone.setId("d"+dimClone.getArrayDimension());
sBasePluginPort.addDimension(dimClone);
Parameter p = subDocument.getModel().getParameter(dim.getSize()).clone();
p.setId(submodel.getId()+"__"+p.getId());
p.setMetaId(submodel.getId()+"__"+p.getMetaId());
if (document.getModel().getParameter(p.getId())==null) {
document.getModel().addParameter(p);
}
dimClone.setSize(p.getId());
Index index = sBasePluginSBaseRef.createIndex();
index.setArrayDimension(dim.getArrayDimension());
index.setReferencedAttribute("comp:portRef");
index.setMath(SBMLutilities.myParseFormula(dimClone.getId()));
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例7: usedInNonDegradationReaction
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Checks if species is a reactant in a non-degradation reaction
*/
public static boolean usedInNonDegradationReaction(SBMLDocument document, String id)
{
for (int i = 0; i < document.getModel().getReactionCount(); i++)
{
for (int j = 0; j < document.getModel().getReaction(i).getReactantCount(); j++)
{
if (document.getModel().getReaction(i).getReactant(j).getSpecies().equals(id)
&& (document.getModel().getReaction(i).getProductCount() > 0 || document.getModel().getReaction(i).getReactantCount() > 1))
{
return true;
}
}
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:19,代码来源:SBMLutilities.java
示例8: functionInUse
import org.sbml.jsbml.SBMLDocument; //导入依赖的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
示例9: checkUnitsInAssignmentRule
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
public static boolean checkUnitsInAssignmentRule(SBMLDocument document, Rule rule)
{
UnitDefinition unitDef = rule.getDerivedUnitDefinition();
UnitDefinition unitDefVar;
Species species = document.getModel().getSpecies(getVariable(rule));
Compartment compartment = document.getModel().getCompartment(getVariable(rule));
Parameter parameter = document.getModel().getParameter(getVariable(rule));
if (species != null)
{
unitDefVar = species.getDerivedUnitDefinition();
}
else if (compartment != null)
{
unitDefVar = compartment.getDerivedUnitDefinition();
}
else
{
unitDefVar = parameter.getDerivedUnitDefinition();
}
if (!UnitDefinition.areEquivalent(unitDef, unitDefVar))
{
return true;
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例10: checkUnitsInInitialAssignment
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
public static boolean checkUnitsInInitialAssignment(SBMLDocument document, InitialAssignment init)
{
UnitDefinition unitDef = init.getDerivedUnitDefinition();
UnitDefinition unitDefVar;
Species species = document.getModel().getSpecies(init.getVariable());
Compartment compartment = document.getModel().getCompartment(init.getVariable());
Parameter parameter = document.getModel().getParameter(init.getVariable());
if (species != null)
{
unitDefVar = species.getDerivedUnitDefinition();
}
else if (compartment != null)
{
unitDefVar = compartment.getDerivedUnitDefinition();
}
else
{
unitDefVar = parameter.getDerivedUnitDefinition();
}
if (!UnitDefinition.areEquivalent(unitDef, unitDefVar))
{
return true;
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例11: checkUnitsInEventAssignment
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
public static boolean checkUnitsInEventAssignment(SBMLDocument document, EventAssignment assign)
{
UnitDefinition unitDef = assign.getDerivedUnitDefinition();
UnitDefinition unitDefVar;
Species species = document.getModel().getSpecies(assign.getVariable());
Compartment compartment = document.getModel().getCompartment(assign.getVariable());
Parameter parameter = document.getModel().getParameter(assign.getVariable());
if (species != null)
{
unitDefVar = species.getDerivedUnitDefinition();
}
else if (compartment != null)
{
unitDefVar = compartment.getDerivedUnitDefinition();
}
else
{
unitDefVar = parameter.getDerivedUnitDefinition();
}
if (unitDef != null && unitDefVar != null && !UnitDefinition.areEquivalent(unitDef, unitDefVar))
{
return true;
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例12: addRandomFunctions
import org.sbml.jsbml.SBMLDocument; //导入依赖的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
示例13: checkFluxBound
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
private static boolean checkFluxBound(SBMLDocument document,String boundStr, String attribute,
String[] dimensionIds,String[] idDims)
{
if (boundStr.contains("[")) {
String id = boundStr.substring(0,boundStr.indexOf("["));
if (document.getModel().getParameter(id)==null) return false;
String index = boundStr.substring(boundStr.indexOf("["));
SBase variable = SBMLutilities.getElementBySId(document, id);
String[] dex = Utils.checkIndices(index, variable, document, dimensionIds, attribute,
idDims, null, null);
if (dex==null) return false;
} else {
return (document.getModel().getParameter(boundStr)!=null);
}
return true;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:17,代码来源:Reactions.java
示例14: getDocument
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Gets the document.
*
* @return the document
* @throws NullPointerException the null pointer exception
* @throws XMLStreamException the XML stream exception
*/
protected SBMLDocument getDocument() throws NullPointerException, XMLStreamException{
JFileChooser chooser = new JFileChooser(OpenDialog.getLastDirectory());
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setMultiSelectionEnabled(false);
chooser.setFileFilter(new FileNameExtensionFilter("SBML File(*.xml)", "xml"));
int returnVal = chooser.showOpenDialog(null);
if (returnVal != JFileChooser.APPROVE_OPTION)
throw new NullPointerException();
File f = chooser.getSelectedFile();
return SBMLReader.read(f.getAbsolutePath());
}
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:20,代码来源:MainSBaseSpatial.java
示例15: checkSBMLDocument
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Check SBML document.
*
* @param document the document
*/
public void checkSBMLDocument(SBMLDocument document){
if(document == null || document.getModel() == null)
throw new IllegalArgumentException("Non-supported format file");
model = document.getModel();
checkLevelAndVersion();
checkExtension();
}
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:13,代码来源:MainSBaseSpatial.java
示例16: SpatialSBMLExporter
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Instantiates a new spatial SBML exporter.
*/
public SpatialSBMLExporter() {
document = new SBMLDocument(3,1);
document.setPackageRequired(SpatialConstants.namespaceURI, true);
document.addDeclaredNamespace(PluginConstants.TAG_CELLDESIGNER_PREFIX, PluginConstants.CDNAMESPACE);
model = document.createModel();
SBasePlugin basePlugin = (model.getPlugin(SpatialConstants.namespaceURI));
spatialplugin = (SpatialModelPlugin) basePlugin;
if (spatialplugin == null) {
System.exit(1);
}
}
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:16,代码来源:SpatialSBMLExporter.java
示例17: upgrade
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Upgrade.
*
* @param document
* the document
* @return SBMLDocument
* TODO
*/
public static SBMLDocument upgrade(SBMLDocument document) {
if (document.getLevel() != SBMLUtil.DEFAULT_SBML_LEVEL
|| document.getVersion() != SBMLUtil.DEFAULT_SBML_VERSION) {
document.setLevelAndVersion(SBMLUtil.DEFAULT_SBML_LEVEL,
SBMLUtil.DEFAULT_SBML_VERSION);
}
document = SBMLModelCompleter.autoCompleteRequiredAttributes(document);
return document;
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:18,代码来源:SBMLLevelandVersionHandler.java
示例18: downgrade
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Downgrade.
*
* @param document
* the document
* @return the SBML document
*/
public static SBMLDocument downgrade(SBMLDocument document) {
if (document.getLevel() > SBMLUtil.DEFAULT_CELLDESIGNER_SBML_LEVEL
|| document.getVersion() != SBMLUtil.DEFAULT_CELLDESIGNER_SBML_VERSION) {
document.setLevelAndVersion(SBMLUtil.DEFAULT_CELLDESIGNER_SBML_LEVEL,
SBMLUtil.DEFAULT_CELLDESIGNER_SBML_VERSION);
}
document = SBMLModelCompleter.autoCompleteRequiredAttributes(document);
return document;
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:17,代码来源:SBMLLevelandVersionHandler.java
示例19: addExtensionPackageLayout
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Adds the extension package layout.
*
* @param document the document
* @return the SBML document
*/
public static SBMLDocument addExtensionPackageLayout(SBMLDocument document) {
document.enablePackage(LayoutConstants.getNamespaceURI(SBMLUtil.DEFAULT_SBML_LEVEL, SBMLUtil.DEFAULT_SBML_VERSION), true);
document.setPackageRequired(LayoutConstants.getNamespaceURI(SBMLUtil.DEFAULT_SBML_LEVEL, SBMLUtil.DEFAULT_SBML_VERSION), true);
return document;
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:13,代码来源:SBMLUtil.java
示例20: addExtensionPackageFBC
import org.sbml.jsbml.SBMLDocument; //导入依赖的package包/类
/**
* Adds the extension package fbc.
*
* @param document the document
* @return the SBML document
*/
public static SBMLDocument addExtensionPackageFBC(SBMLDocument document) {
document.enablePackage(FBCConstants.getNamespaceURI(SBMLUtil.DEFAULT_SBML_LEVEL, SBMLUtil.DEFAULT_SBML_VERSION), true);
document.setPackageRequired(FBCConstants.getNamespaceURI(SBMLUtil.DEFAULT_SBML_LEVEL, SBMLUtil.DEFAULT_SBML_VERSION), false);
return document;
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:13,代码来源:SBMLUtil.java
注:本文中的org.sbml.jsbml.SBMLDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论