Search in sources :

Example 1 with MzMLFileExportMethod

use of io.github.msdk.io.mzml.MzMLFileExportMethod in project mzmine2 by mzmine.

the class ExportScansTask method exportmzML.

/**
 * Export the chromatogram - mzML format
 *
 * @throws IOException if there are i/o problems.
 */
public void exportmzML() throws MSDKException {
    // Initialize objects
    SimpleRawDataFile msdkRawFile = new SimpleRawDataFile("MZmine 2 mzML export", Optional.empty(), FileType.MZML);
    for (Scan scan : scans) {
        MsScan MSDKscan = new MZmineToMSDKMsScan(scan);
        msdkRawFile.addScan(MSDKscan);
    }
    // Actually write to disk
    MzMLFileExportMethod method = new MzMLFileExportMethod(msdkRawFile, exportFile, MzMLCompressionType.ZLIB, MzMLCompressionType.ZLIB);
    method.execute();
}
Also used : MZmineToMSDKMsScan(net.sf.mzmine.datamodel.impl.MZmineToMSDKMsScan) MsScan(io.github.msdk.datamodel.MsScan) MzMLFileExportMethod(io.github.msdk.io.mzml.MzMLFileExportMethod) Scan(net.sf.mzmine.datamodel.Scan) MZmineToMSDKMsScan(net.sf.mzmine.datamodel.impl.MZmineToMSDKMsScan) MsScan(io.github.msdk.datamodel.MsScan) MZmineToMSDKMsScan(net.sf.mzmine.datamodel.impl.MZmineToMSDKMsScan) SimpleRawDataFile(io.github.msdk.datamodel.SimpleRawDataFile)

Example 2 with MzMLFileExportMethod

use of io.github.msdk.io.mzml.MzMLFileExportMethod in project mzmine2 by mzmine.

the class RawDataExportTask method run.

/**
 * @see Runnable#run()
 */
public void run() {
    try {
        setStatus(TaskStatus.PROCESSING);
        logger.info("Started export of file " + dataFile + " to " + outFilename);
        MZmineToMSDKRawDataFile msdkDataFile = new MZmineToMSDKRawDataFile(dataFile);
        if (outFilename.getName().toLowerCase().endsWith("mzml")) {
            msdkMethod = new MzMLFileExportMethod(msdkDataFile, outFilename, MzMLCompressionType.ZLIB, MzMLCompressionType.ZLIB);
        }
        if (outFilename.getName().toLowerCase().endsWith("cdf")) {
            msdkMethod = new NetCDFFileExportMethod(msdkDataFile, outFilename);
        }
        if (isCanceled())
            return;
        msdkMethod.execute();
        setStatus(TaskStatus.FINISHED);
        logger.info("Finished export of file " + dataFile + " to " + outFilename);
    } catch (Exception e) {
        e.printStackTrace();
        setStatus(TaskStatus.ERROR);
        setErrorMessage("Error in file export: " + e.getMessage());
    }
}
Also used : MzMLFileExportMethod(io.github.msdk.io.mzml.MzMLFileExportMethod) NetCDFFileExportMethod(io.github.msdk.io.netcdf.NetCDFFileExportMethod) MZmineToMSDKRawDataFile(net.sf.mzmine.datamodel.impl.MZmineToMSDKRawDataFile)

Aggregations

MzMLFileExportMethod (io.github.msdk.io.mzml.MzMLFileExportMethod)2 MsScan (io.github.msdk.datamodel.MsScan)1 SimpleRawDataFile (io.github.msdk.datamodel.SimpleRawDataFile)1 NetCDFFileExportMethod (io.github.msdk.io.netcdf.NetCDFFileExportMethod)1 Scan (net.sf.mzmine.datamodel.Scan)1 MZmineToMSDKMsScan (net.sf.mzmine.datamodel.impl.MZmineToMSDKMsScan)1 MZmineToMSDKRawDataFile (net.sf.mzmine.datamodel.impl.MZmineToMSDKRawDataFile)1