use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.
the class DataSetControllerImpl method getChomboFiles.
public ChomboFiles getChomboFiles(VCDataIdentifier vcdataID) throws DataAccessException, IOException {
VCMongoMessage.sendTrace("DataSetControllerImpl.getChomboFiles(" + vcdataID.getID() + ") <<EXIT>>");
if (lg.isTraceEnabled())
lg.trace("DataSetControllerImpl.getChomboFiles(" + vcdataID.getOwner().getName() + "," + vcdataID.getID() + ")");
VCData simData = getVCData(vcdataID);
try {
return simData.getChomboFiles();
} catch (XmlParseException e) {
e.printStackTrace();
throw new DataAccessException("failed to getChomboFiles(): " + e.getMessage(), e);
} catch (ExpressionException e) {
e.printStackTrace();
throw new DataAccessException("failed to getChomboFiles(): " + e.getMessage(), e);
}
}
use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.
the class ProfileLikelihood method main.
// main
public static void main(String[] args) {
try {
File newXML = new File(args[0]);
XMLSource source = new XMLSource(newXML);
BioModel biomodel = XmlHelper.XMLToBioModel(source);
SimulationContext app = biomodel.getSimulationContext("Deterministic");
AnalysisTask[] task = app.getAnalysisTasks();
// ParestRun.bFakeOptimization = true;
final ProfileLikelihoodCallback callback = new ProfileLikelihoodCallback() {
@Override
public void report(String msg) {
System.out.println(msg);
}
};
ProfileLikelihood pl = new ProfileLikelihood(callback);
pl.run((ParameterEstimationTask) task[0]);
} catch (XmlParseException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.
the class SBMLStandaloneImporter method attemptImport.
private BioModel attemptImport(File sbmlFile) throws ExecutableException, IOException, ClassNotFoundException, XmlParseException {
if (subProcess == null || subProcess.getStatus() != LiveProcessStatus.RUNNING) {
subProcess = createProcess();
}
toChildProcess.writeObject(sbmlFile);
Object back = fromChildProcess.readObject();
if (back instanceof String) {
String xml = (String) back;
if (lg.isDebugEnabled()) {
try (FileWriter fw = new FileWriter(sbmlFile.getAbsolutePath() + ".dump")) {
fw.append(xml);
}
}
XMLSource source = new XMLSource(xml);
return XmlHelper.XMLToBioModel(source);
}
if (back instanceof Exception) {
try {
throw (Exception) back;
} catch (SBMLImportException sie) {
throw sie;
} catch (Exception e) {
throw new ExecutableException("child process exception", e);
}
}
throw new ExecutableException("unexpected object from child process: " + back.getClass().getName() + " " + back.toString());
}
use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.
the class SEDMLExporter method main.
public static void main(String[] args) {
// if (args.length != 1) {
// System.out.println("Usage:\n\t path_of_vcml_file\n" );
// System.exit(1);
// }
// String pathName = args[0];
String pathName = "c:\\dan\\SEDML\\SEDML2.vcml";
try {
String biomodelXmlStr = XmlUtil.getXMLString(pathName);
BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(biomodelXmlStr.toString()));
bioModel.refreshDependencies();
// invoke the SEDMLEXporter
SEDMLExporter sedmlExporter = new SEDMLExporter(bioModel, 1, 1);
String absolutePath = "c:\\dan\\SEDML";
String sedmlStr = sedmlExporter.getSEDMLFile(absolutePath);
// String absolutePath = ResourceUtil.getUserHomeDir().getAbsolutePath();
String outputName = absolutePath + "\\" + TokenMangler.mangleToSName(bioModel.getName()) + ".sedml";
XmlUtil.writeXMLStringToFile(sedmlStr, outputName, true);
} catch (IOException e) {
e.printStackTrace(System.out);
throw new RuntimeException("Unable to read VCML file '" + pathName + "' into string.");
} catch (XmlParseException e) {
e.printStackTrace(System.out);
throw new RuntimeException("Unable to convert VCML file '" + pathName + "' to a biomodel.");
}
}
use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.
the class SimulationServiceImpl method getSBML.
public String getSBML(String vcml, String applicationName) throws ThriftDataAccessException, TException {
try {
BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(vcml));
SimulationContext simContext = bioModel.getSimulationContext(applicationName);
SBMLExporter exporter = new SBMLExporter(simContext, 3, 1, simContext.getGeometry().getDimension() > 0);
VCellSBMLDoc sbmlDoc = exporter.convertToSBML();
return sbmlDoc.xmlString;
} catch (SBMLException | XmlParseException | SbmlException | XMLStreamException e) {
e.printStackTrace();
throw new ThriftDataAccessException("failed to generate SBML document: " + e.getMessage());
}
}
Aggregations