Search in sources :

Example 56 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.

the class ProjectOpeningTask method loadRawDataFile.

private void loadRawDataFile(InputStream is, String fileID, String fileName) throws IOException, ParserConfigurationException, SAXException, InstantiationException, IllegalAccessException {
    logger.info("Loading raw data file #" + fileID + ": " + fileName);
    currentLoadedObjectName = fileName;
    File scansFile = scanFilesIDMap.get(fileID);
    if (scansFile == null) {
        throw new IOException("Missing scans data for file ID " + fileID);
    }
    RawDataFile newFile = rawDataFileOpenHandler.readRawDataFile(is, scansFile);
    newProject.addFile(newFile);
    dataFilesIDMap.put(fileID, newFile);
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) IOException(java.io.IOException) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) ZipFile(java.util.zip.ZipFile) File(java.io.File)

Example 57 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.

the class PeakListOpenHandler_2_0 method initializePeakList.

/**
 * Initializes the feature list
 */
private void initializePeakList() {
    RawDataFile[] dataFiles = currentPeakListDataFiles.toArray(new RawDataFile[0]);
    buildingPeakList = new SimplePeakList(peakListName, dataFiles);
    for (int i = 0; i < appliedMethods.size(); i++) {
        String methodName = appliedMethods.elementAt(i);
        String methodParams = appliedMethodParameters.elementAt(i);
        PeakListAppliedMethod pam = new SimplePeakListAppliedMethod(methodName, methodParams);
        buildingPeakList.addDescriptionOfAppliedTask(pam);
    }
    buildingPeakList.setDateCreated(dateCreated);
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) PeakListAppliedMethod(net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Example 58 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.

the class RawDataFileOpenHandler_2_0 method readRawDataFile.

/**
 * Create a new raw data file using the information from the XML raw data description file
 *
 * @param Name raw data file name
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public RawDataFile readRawDataFile(InputStream is, File scansFile) throws IOException, ParserConfigurationException, SAXException {
    storageFileOffset = 0;
    charBuffer = new StringBuffer();
    newRawDataFile = (RawDataFileImpl) MZmineCore.createNewFile(null);
    newRawDataFile.openDataPointsFile(scansFile);
    // Reads the XML file (raw data description)
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse(is, this);
    // Adds the raw data file to MZmine
    RawDataFile rawDataFile = newRawDataFile.finishWriting();
    return rawDataFile;
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SAXParser(javax.xml.parsers.SAXParser) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Example 59 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.

the class PeakListOpenHandler_2_3 method initializePeakList.

/**
 * Initializes the feature list
 */
private void initializePeakList() {
    RawDataFile[] dataFiles = currentPeakListDataFiles.toArray(new RawDataFile[0]);
    buildingPeakList = new SimplePeakList(peakListName, dataFiles);
    for (int i = 0; i < appliedMethods.size(); i++) {
        String methodName = appliedMethods.elementAt(i);
        String methodParams = appliedMethodParameters.elementAt(i);
        PeakListAppliedMethod pam = new SimplePeakListAppliedMethod(methodName, methodParams);
        buildingPeakList.addDescriptionOfAppliedTask(pam);
    }
    buildingPeakList.setDateCreated(dateCreated);
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) PeakListAppliedMethod(net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Example 60 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.

the class RawDataFileOpenHandler_2_3 method readRawDataFile.

/**
 * Extract the scan file and copies it into the temporary folder. Create a new raw data file using
 * the information from the XML raw data description file
 *
 * @param Name raw data file name
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public RawDataFile readRawDataFile(InputStream is, File scansFile) throws IOException, ParserConfigurationException, SAXException {
    storageFileOffset = 0;
    charBuffer = new StringBuffer();
    currentMassLists = new ArrayList<SimpleMassList>();
    allMassLists = new ArrayList<SimpleMassList>();
    newRawDataFile = (RawDataFileImpl) MZmineCore.createNewFile(null);
    newRawDataFile.openDataPointsFile(scansFile);
    // Reads the XML file (raw data description)
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse(is, this);
    // instead of being part of the data points file.
    for (SimpleMassList ml : allMassLists) {
        Scan s = ml.getScan();
        s.addMassList(ml);
    }
    RawDataFile rawDataFile = newRawDataFile.finishWriting();
    return rawDataFile;
}
Also used : SimpleMassList(net.sf.mzmine.datamodel.impl.SimpleMassList) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SAXParser(javax.xml.parsers.SAXParser) Scan(net.sf.mzmine.datamodel.Scan) StorableScan(net.sf.mzmine.project.impl.StorableScan) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Aggregations

RawDataFile (net.sf.mzmine.datamodel.RawDataFile)185 Feature (net.sf.mzmine.datamodel.Feature)59 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)52 DataPoint (net.sf.mzmine.datamodel.DataPoint)51 Scan (net.sf.mzmine.datamodel.Scan)40 ArrayList (java.util.ArrayList)33 PeakList (net.sf.mzmine.datamodel.PeakList)33 Nonnull (javax.annotation.Nonnull)24 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)24 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)24 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)22 Task (net.sf.mzmine.taskcontrol.Task)20 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)19 SimpleFeature (net.sf.mzmine.datamodel.impl.SimpleFeature)17 IOException (java.io.IOException)14 ParameterSet (net.sf.mzmine.parameters.ParameterSet)14 File (java.io.File)13 MassList (net.sf.mzmine.datamodel.MassList)13 PeakListAppliedMethod (net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod)13 TreeMap (java.util.TreeMap)10