Search in sources :

Example 36 with XmlParseException

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);
    }
}
Also used : XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException)

Example 37 with XmlParseException

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();
    }
}
Also used : BioModel(cbit.vcell.biomodel.BioModel) XmlParseException(cbit.vcell.xml.XmlParseException) SimulationContext(cbit.vcell.mapping.SimulationContext) File(java.io.File) XMLSource(cbit.vcell.xml.XMLSource) MappingException(cbit.vcell.mapping.MappingException) XmlParseException(cbit.vcell.xml.XmlParseException) MathException(cbit.vcell.math.MathException)

Example 38 with XmlParseException

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());
}
Also used : ExecutableException(org.vcell.util.exe.ExecutableException) FileWriter(java.io.FileWriter) XMLSource(cbit.vcell.xml.XMLSource) ExecutableException(org.vcell.util.exe.ExecutableException) SocketException(java.net.SocketException) SocketTimeoutException(java.net.SocketTimeoutException) XmlParseException(cbit.vcell.xml.XmlParseException) IOException(java.io.IOException)

Example 39 with XmlParseException

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.");
    }
}
Also used : BioModel(cbit.vcell.biomodel.BioModel) IOException(java.io.IOException) XmlParseException(cbit.vcell.xml.XmlParseException) XMLSource(cbit.vcell.xml.XMLSource)

Example 40 with XmlParseException

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());
    }
}
Also used : SBMLException(org.sbml.jsbml.SBMLException) XMLStreamException(javax.xml.stream.XMLStreamException) BioModel(cbit.vcell.biomodel.BioModel) VCellSBMLDoc(org.vcell.sbml.vcell.SBMLExporter.VCellSBMLDoc) ThriftDataAccessException(org.vcell.vcellij.api.ThriftDataAccessException) SBMLExporter(org.vcell.sbml.vcell.SBMLExporter) XmlParseException(cbit.vcell.xml.XmlParseException) SbmlException(org.vcell.sbml.SbmlException) SimulationContext(cbit.vcell.mapping.SimulationContext) XMLSource(cbit.vcell.xml.XMLSource)

Aggregations

XmlParseException (cbit.vcell.xml.XmlParseException)49 DataAccessException (org.vcell.util.DataAccessException)35 XMLSource (cbit.vcell.xml.XMLSource)19 BigString (org.vcell.util.BigString)18 BioModel (cbit.vcell.biomodel.BioModel)16 KeyValue (org.vcell.util.document.KeyValue)16 SQLException (java.sql.SQLException)14 ExpressionException (cbit.vcell.parser.ExpressionException)12 IOException (java.io.IOException)12 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)11 SimulationContext (cbit.vcell.mapping.SimulationContext)10 PrintWriter (java.io.PrintWriter)9 User (org.vcell.util.document.User)9 MathException (cbit.vcell.math.MathException)8 MathModel (cbit.vcell.mathmodel.MathModel)8 Element (org.jdom.Element)8 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)8 BioModelInfo (org.vcell.util.document.BioModelInfo)7 PropertyVetoException (java.beans.PropertyVetoException)5 File (java.io.File)5