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


Java SBMLException类代码示例

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


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

示例1: definitionToXml

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
private static String definitionToXml(UnitDefinition definition) {
	if (definition.getUnitCount() == 0) {
		return NO_UNIT;
	}

	SBMLDocument doc = new SBMLDocument(LEVEL, VERSION);
	Model model = doc.createModel("ID");

	model.addUnitDefinition(definition.clone());

	ByteArrayOutputStream out = new ByteArrayOutputStream();

	try {
		SBMLWriter.write(doc, out, "test", "1.0", ' ', (short) 0);

		String xml = out.toString(StandardCharsets.UTF_8.name());
		String from = "<listOfUnitDefinitions>";
		String to = "</listOfUnitDefinitions>";

		return xml.substring(xml.indexOf(from) + from.length(), xml.indexOf(to)).replace("\n", "");
	} catch (SBMLException | XMLStreamException | UnsupportedEncodingException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:26,代码来源:PmmUnit.java

示例2: save

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
/**
 * Save.
 */
public void save() {
  try {
    TidySBMLWriter.write(document, new File(outputFileName), ' ', (short) 2);
  } catch (SBMLException | XMLStreamException | IOException e) {
    e.printStackTrace();
  }
}
 
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:11,代码来源:BaseLayoutConverter.java

示例3: applyChanges

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
public SBMLDocument applyChanges(SEDMLDocument sedmlDoc, SBMLDocument sbmlDoc, org.jlibsedml.Model model)
		throws SBMLException, XPathExpressionException, XMLStreamException, XMLException {
	SedML sedml = sedmlDoc.getSedMLModel();
	if (sedml.getModelWithId(model.getSource()) != null) {
		sbmlDoc = applyChanges(sedmlDoc, sbmlDoc, sedml.getModelWithId(model.getSource()));
	}
	SBMLWriter Xwriter = new SBMLWriter();
	SBMLReader Xreader = new SBMLReader();
	sbmlDoc = Xreader
			.readSBMLFromString(sedmlDoc.getChangedModel(model.getId(), Xwriter.writeSBMLToString(sbmlDoc)));
	return sbmlDoc;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:13,代码来源:BioModel.java

示例4: applyChanges

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
private SBMLDocument applyChanges(SEDMLDocument sedmlDoc, SBMLDocument sbmlDoc, org.jlibsedml.Model model)
    throws SBMLException, XPathExpressionException, XMLStreamException, XMLException {
  SedML sedml = sedmlDoc.getSedMLModel();
  if (sedml.getModelWithId(model.getSource()) != null) {
    sbmlDoc = applyChanges(sedmlDoc, sbmlDoc, sedml.getModelWithId(model.getSource()));
  }
  SBMLWriter Xwriter = new SBMLWriter();
  SBMLReader Xreader = new SBMLReader();
  sbmlDoc = Xreader
      .readSBMLFromString(sedmlDoc.getChangedModel(model.getId(), Xwriter.writeSBMLToString(sbmlDoc)));
  return sbmlDoc;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:13,代码来源:Analysis.java

示例5: applyChanges

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
public SBMLDocument applyChanges(SEDMLDocument sedmlDoc, SBMLDocument sbmlDoc, Model model)
		throws SBMLException, XPathExpressionException, XMLStreamException, XMLException {
	SedML sedml = sedmlDoc.getSedMLModel();
	if (sedml.getModelWithId(model.getSource()) != null) {
		sbmlDoc = applyChanges(sedmlDoc, sbmlDoc, sedml.getModelWithId(model.getSource()));
	}
	SBMLWriter Xwriter = new SBMLWriter();
	SBMLReader Xreader = new SBMLReader();
	sbmlDoc = Xreader
			.readSBMLFromString(sedmlDoc.getChangedModel(model.getId(), Xwriter.writeSBMLToString(sbmlDoc)));
	return sbmlDoc;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:13,代码来源:ModelEditor.java

示例6: applyChanges

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
private SBMLDocument applyChanges(SEDMLDocument sedmlDoc, SBMLDocument sbmlDoc, org.jlibsedml.Model model)
		throws SBMLException, XPathExpressionException, XMLStreamException, XMLException {
	SedML sedml = sedmlDoc.getSedMLModel();
	if (sedml.getModelWithId(model.getSource()) != null) {
		sbmlDoc = applyChanges(sedmlDoc, sbmlDoc, sedml.getModelWithId(model.getSource()));
	}
	SBMLWriter Xwriter = new SBMLWriter();
	SBMLReader Xreader = new SBMLReader();
	sbmlDoc = Xreader
			.readSBMLFromString(sedmlDoc.getChangedModel(model.getId(), Xwriter.writeSBMLToString(sbmlDoc)));
	return sbmlDoc;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:13,代码来源:Gui.java

示例7: copyDirectory

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
private void copyDirectory(String srcDir, String destDir, String copyName)
		throws SBMLException, XMLStreamException, IOException, BioSimException {
	new File(destDir).mkdir();
	String[] files = new File(srcDir).list();
	for (String file : files) {
		if (file.endsWith(".sbml") || file.equals(".xml")) {
			SBMLDocument document = SBMLutilities.readSBML(srcDir + File.separator + file, null, this);
			SBMLWriter writer = new SBMLWriter();
			writer.writeSBMLToFile(document, destDir + File.separator + file);
		} else if (new File(srcDir + File.separator + file).isFile()) {
			FileOutputStream out = new FileOutputStream(new File(destDir + File.separator + file));
			if (file.endsWith(".sim") || file.endsWith(".grf") || file.endsWith(".prb") || file.endsWith(".lrn")) {
				String ext = file.substring(file.lastIndexOf("."));
				out = new FileOutputStream(new File(destDir + File.separator + copyName + ext));
			}
			FileInputStream in = new FileInputStream(new File(srcDir + File.separator + file));
			int read = in.read();
			while (read != -1) {
				out.write(read);
				read = in.read();
			}
			in.close();
			out.close();
		} else if (new File(srcDir + File.separator + file).isDirectory()) {
			copyDirectory(srcDir + File.separator + file, destDir + File.separator + file,
					copyName + "__" + file);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:30,代码来源:Gui.java

示例8: factorial

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue factorial(ASTNode value) throws SBMLException {
	double v = toDouble(value);
	double roundedV = FastMath.round(v);

	if (v != roundedV) {
		throw new IllegalArgumentException("factorial cannot be computed from floating point number: " + v);
	}

	return new ASTNodeValue(CombinatoricsUtils.factorialDouble((int) roundedV), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:12,代码来源:Parser.java

示例9: exportSBMLModels

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
/**
 * The user has the option to :
 * 1. Export a list of BioModels to multiple SBML files 
 * 2. Export a list of BioModels to one SBML file
 * 3. Print to console.
 *  
 * @param models - The list of BioModels
 * @param outputDir - The output directory to save the BioModels in
 * @param outputFileName - The output file name if there was only one BioModel to export
 * @param noOutput - True if no output file is to be produced. False otherwise. 
 * @param sbmlOut - True if the user want to write the BioModel to an SBML file. False otherwise.
 * @param singleSBMLOutput - True if the user want to the list of BioModels into one SBML file rather than multiple files. False otherwise.
 * @throws XMLStreamException Invalid XML file
 * @throws SBMLException SBML Exception occurred when exporting BioModels to an SBML file
 * @throws IOException Unable to write file to SBML.
 * @throws BioSimException - if sbml model is invalid.
 */
public static void exportSBMLModels(List<BioModel> models, String outputDir, String outputFileName, 
		boolean noOutput, boolean sbmlOut, boolean singleSBMLOutput) throws SBMLException, XMLStreamException, IOException, BioSimException
{
	// Note: Since SBOL2SBML converter encase the result of SBML model in BioModels, the last biomodel 
	// given from the converter is the top level model. All submodels belonging to the top level models are nested in side this last biomodel
	BioModel target = models.get(models.size() - 1);

	if(noOutput)
	{
		printSBMLModel(target);
	}
	else if(sbmlOut)
	{
		if(outputFileName.isEmpty())
		{
			printSBMLModel(target);
		}
		else
		{
			//Note: In order to export multiple BioModels into one single SBML file, we must first
			//generate each submodel and then collapse all models into one file. This is necessary because
			//the top level SBML models are using external ModelDefinitions.
			ArrayList<String> submodels = exportMultSBMLFile(models, outputDir);
			if(singleSBMLOutput)
			{
				//delete 
				target.exportSingleFile(outputDir + File.separator + outputFileName + ".xml"); 
				File fileDir = new File(outputDir);
				
				File[] files = fileDir.listFiles();
				for(File f : files)
				{
					if(f.isFile())
					{
						String fileName = f.getName();
						if(submodels.contains(outputFileName+".xml") && !fileName.equals(outputFileName + ".xml"))
						{
							f.delete();
						}
					}
				}
				
			}
		}
	}

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

示例10: abs

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue abs(ASTNode value) throws SBMLException {
	return new ASTNodeValue(FastMath.abs(toDouble(value)), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:Parser.java

示例11: and

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue and(List<ASTNode> values) throws SBMLException {
	return new ASTNodeValue(toDouble(values.get(0)) != 0.0 && toDouble(values.get(1)) != 0.0 ? 1.0 : 0.0, this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:Parser.java

示例12: arccos

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue arccos(ASTNode value) throws SBMLException {
	return new ASTNodeValue(FastMath.acos(toDouble(value)), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:Parser.java

示例13: arccosh

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue arccosh(ASTNode value) throws SBMLException {
	return new ASTNodeValue(FastMath.acosh(toDouble(value)), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:Parser.java

示例14: arccot

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue arccot(ASTNode value) throws SBMLException {
	return new ASTNodeValue(FastMath.PI / 2.0 - FastMath.atan(toDouble(value)), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:Parser.java

示例15: arccoth

import org.sbml.jsbml.SBMLException; //导入依赖的package包/类
@Override
public ASTNodeValue arccoth(ASTNode value) throws SBMLException {
	return new ASTNodeValue(FastMath.atanh(1.0 / toDouble(value)), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:Parser.java


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