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


Java FBCConstants类代码示例

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


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

示例1: convertSpecies

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
/**
 * Convert species.
 */
public void convertSpecies() {
  List<SpeciesWrapper> swList = mWrapper.getListOfSpeciesWrapper();
  for (SpeciesWrapper sw : swList) {
    if (sw.getCharge() != null) {
      Species s = model.getSpecies(sw.getId());
      FBCSpeciesPlugin speciesPlugin = (FBCSpeciesPlugin) s.getPlugin(FBCConstants.shortLabel);
      speciesPlugin.setCharge(sw.getCharge().intValue());
    }
  }
}
 
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:14,代码来源:FBCConverter.java

示例2: convertReactions

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
/**
 * Convert reactions.
 */
public void convertReactions() {
  List<ReactionWrapper> rwList = mWrapper.getListOfReactionWrapper();
  for (ReactionWrapper rw : rwList) {
    List<Modification> mList = rw.getListOfModification();
    if (mList == null)
      continue;
    for (Modification modification : mList) {
      if (modification.getType().contains("BOOLEAN_LOGIC_GATE")) {
        Reaction reaction = model.getReaction(rw.getId());
        FBCReactionPlugin reactionPlugin = (FBCReactionPlugin) reaction.getPlugin(FBCConstants.shortLabel);
        GeneProductAssociation gpa;
        if (reactionPlugin.isSetGeneProductAssociation())
          gpa = reactionPlugin.getGeneProductAssociation();
        else
          gpa = reactionPlugin.createGeneProductAssociation("ga_"
            + rw.getId());
        String modifiers = modification.getModifiers();
        String[] modifierList = modifiers.split(",");
        for (String m : modifierList) {
          if (fbcPlugin.getListOfGeneProducts().get("gene_" + m) == null) {
            GeneProduct geneProduct = fbcPlugin.createGeneProduct("gene_" + m);
            geneProduct.setLabel(m);
            geneProduct.setAssociatedSpecies(m);
          }
        }
        LogicalOperator lo;
        if (modification.getType().contains("AND")) {
          lo = setAllProductRef(new And(), modifierList, rw.getId());
        } else {
          lo = setAllProductRef(new Or(), modifierList, rw.getId());
        }
        gpa.setAssociation(lo);
      }
    }
  }
}
 
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:40,代码来源:FBCConverter.java

示例3: addExtensionPackageFBC

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的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

示例4: getFBCReactionPlugin

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
public static FBCReactionPlugin getFBCReactionPlugin(Reaction r)
{
	if (r.getExtension(FBCConstants.namespaceURI) != null)
	{
		return (FBCReactionPlugin) r.getExtension(FBCConstants.namespaceURI);
	}
	FBCReactionPlugin reac = new FBCReactionPlugin(r);
	r.addExtension(FBCConstants.namespaceURI, reac);
	return reac;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:11,代码来源:SBMLutilities.java

示例5: convertToFBCVersion2

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
private static SBMLDocument convertToFBCVersion2(String filename,SBMLDocument document) throws XMLStreamException, IOException, BioSimException 
{
	if (document.getDeclaredNamespaces().get("xmlns:"+FBCConstants.shortLabel)!=null &&
			document.getDeclaredNamespaces().get("xmlns:"+FBCConstants.shortLabel).endsWith("1")) 
	{
		if (!Executables.libsbmlFound)
		{
		  throw new BioSimException("Unable convert FBC model from Version 1 to Version 2.", "Error Opening File");
		}
		//long numErrors = 0;
		org.sbml.libsbml.SBMLReader reader = new org.sbml.libsbml.SBMLReader();
		org.sbml.libsbml.SBMLDocument doc = reader.readSBML(filename);
		/* create a new conversion properties structure */
		ConversionProperties props = new ConversionProperties(new SBMLNamespaces(3, 1));

		/* add an option that we want to strip a given package */
		boolean strict = false;
		props.addOption("convert fbc v1 to fbc v2", true, "convert fbc v1 to fbc v2");
		props.addOption("strict", strict, "should the model be a strict one (i.e.: all non-specified bounds will be filled)");

		/* perform the conversion */
		if (doc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS)
		{
			System.err.println("Conversion failed!");
			doc.printErrors();
			// System.exit(2);
		}
		org.sbml.libsbml.SBMLWriter writer = new org.sbml.libsbml.SBMLWriter();
		writer.writeSBMLToFile(doc, filename);
		document = SBMLReader.read(new File(filename));
	} else {
		SBMLutilities.getFBCModelPlugin(document.getModel(),true);
	}
	return document;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:36,代码来源:SBMLutilities.java

示例6: convertModel

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
/**
 * Convert model.
 */
public void convertModel() {
  fbcPlugin = (FBCModelPlugin) model.getPlugin(FBCConstants.shortLabel);
  fbcPlugin.setStrict(false);
}
 
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:8,代码来源:FBCConverter.java

示例7: createFBCPlugin

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
public void createFBCPlugin() {
	sbml.enablePackage(FBCConstants.namespaceURI);
	sbmlFBC = SBMLutilities.getFBCModelPlugin(sbml.getModel(),true);
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:5,代码来源:BioModel.java

示例8: createSingleDocument

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
public SBMLDocument createSingleDocument() throws XMLStreamException, IOException, BioSimException {
	ArrayList<String> comps = new ArrayList<String>();
	SBMLDocument document = new SBMLDocument(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
	Model model = new Model(sbml.getModel());
	document.setModel(model);
	document.enablePackage(LayoutConstants.namespaceURI);
	SBMLutilities.getLayoutModelPlugin(document.getModel());
	if (sbmlCompModel.getListOfPorts().size() > 0 || sbmlCompModel.getListOfSubmodels().size() > 0) {
		document.enablePackage(CompConstants.namespaceURI);
	}
	if (sbmlFBC.getListOfObjectives().size() > 0) {
		document.enablePackage(FBCConstants.namespaceURI);
	} else {
		for (int i = 0; i < document.getModel().getNumReactions(); i++) {
			Reaction r = document.getModel().getReaction(i);
			FBCReactionPlugin rBounds = SBMLutilities.getFBCReactionPlugin(r);
			if (rBounds != null) {
				if (rBounds.isSetLowerFluxBound()) {
					document.enablePackage(FBCConstants.namespaceURI);
					break;
				} 
				if (rBounds.isSetUpperFluxBound()) {
					document.enablePackage(FBCConstants.namespaceURI);
					break;
				} 
			}
		}
	}
  
	document.enablePackage(ArraysConstants.namespaceURI);

	if (sbmlCompModel.getListOfSubmodels().size()>0) {
		CompSBMLDocumentPlugin documentComp = SBMLutilities.getCompSBMLDocumentPlugin(document);
		for (int i = 0; i < sbmlCompModel.getListOfSubmodels().size(); i++) {
			String subModelId = sbmlCompModel.getListOfSubmodels().get(i).getId();
			String extModel = sbmlComp.getListOfExternalModelDefinitions().get(sbmlCompModel.getListOfSubmodels().get(subModelId)
					.getModelRef()).getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
			if (!comps.contains(extModel)) {
				comps.add(extModel);
				SBMLDocument subDocument = SBMLutilities.readSBML(path + File.separator + extModel, this, null);
				CompModelPlugin subDocumentCompModel = SBMLutilities.getCompModelPlugin(subDocument.getModel());
				String id = subDocument.getModel().getId();
				// TODO: hack to avoid jsbml scope bug
				LayoutModelPlugin subDocumentLayoutModel = SBMLutilities.getLayoutModelPlugin(subDocument.getModel());
				Layout layout = subDocumentLayoutModel.getListOfLayouts().get("iBioSim");
				layout.setId(id+"__iBioSim");
				ModelDefinition md = new ModelDefinition(subDocument.getModel());
				ArrayList<SBase> elements = SBMLutilities.getListOfAllElements(md);
				for (int j = 0; j < elements.size(); j++) {
					SBase sbase = elements.get(j);
					if (sbase.isSetMetaId()) {
						for (int k = 0; k < subDocumentCompModel.getListOfPorts().size(); k++) {
							Port port = subDocumentCompModel.getListOfPorts().get(k);
							if (port.isSetMetaIdRef() && port.getMetaIdRef().equals(sbase.getMetaId())) {
								port.setMetaIdRef(id+"__"+sbase.getMetaId());
							}
						}
						String newMetaId = id+"__"+sbase.getMetaId();
						while (SBMLutilities.getElementByMetaId(document, newMetaId)!=null) {
							newMetaId += "_";
						}
						while (SBMLutilities.getElementByMetaId(subDocument, newMetaId)!=null) {
							newMetaId += "_";
						}
						while (SBMLutilities.getElementByMetaId(documentComp, newMetaId)!=null) {
							newMetaId += "_";
						}
						sbase.unsetMetaId();
						SBMLutilities.setMetaId(sbase, newMetaId);
					}
				}
				documentComp.addModelDefinition(md);
				recurseExportSingleFile(comps,SBMLutilities.getCompModelPlugin(subDocument.getModel()),
						SBMLutilities.getCompSBMLDocumentPlugin(subDocument),documentComp);
			}
		}
	}
	return document;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:80,代码来源:BioModel.java

示例9: removeUnusedNamespaces

import org.sbml.jsbml.ext.fbc.FBCConstants; //导入依赖的package包/类
/**
 * 
 * @param doc
 */
public static void removeUnusedNamespaces(SBMLDocument doc)
{

	boolean isCompSet = false;
	boolean isArraysSet = false;
	boolean isFbcSet = false;

	LinkedList<SBase> queue = new LinkedList<SBase>();
	queue.add(doc);

	while(!queue.isEmpty())
	{

		SBase sbase = queue.pop();

		if(!isArraysSet)
		{
			isArraysSet = isArraysUsed(sbase);
		}

		if(!isCompSet)
		{
			isCompSet =  isCompUsed(sbase);;
		}

		if(!isFbcSet)
		{
			isFbcSet =  isFbcUsed(sbase);
		}

		for (int i = sbase.getChildCount() - 1; i >= 0; i--) 
		{
			TreeNode node = sbase.getChildAt(i);

			if(node instanceof SBase)
			{
				queue.push((SBase) node);
			}

		}
	}


	if(!isArraysSet)
	{
		doc.disablePackage(ArraysConstants.shortLabel);
	}

	if(!isCompSet)
	{
		doc.disablePackage(CompConstants.shortLabel);
	}

	if(!isFbcSet)
	{
		doc.disablePackage(FBCConstants.shortLabel);
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:63,代码来源:SBMLutilities.java


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