Search in sources :

Example 36 with MassList

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

the class StorableScan method addMassList.

@Override
public synchronized void addMassList(@Nonnull final MassList massList) {
    // Remove all mass lists with same name, if there are any
    MassList[] currentMassLists = massLists.toArray(new MassList[0]);
    for (MassList ml : currentMassLists) {
        if (ml.getName().equals(massList.getName()))
            removeMassList(ml);
    }
    StorableMassList storedMassList;
    if (massList instanceof StorableMassList) {
        storedMassList = (StorableMassList) massList;
    } else {
        DataPoint[] massListDataPoints = massList.getDataPoints();
        try {
            int mlStorageID = rawDataFile.storeDataPoints(massListDataPoints);
            storedMassList = new StorableMassList(rawDataFile, mlStorageID, massList.getName(), this);
        } catch (IOException e) {
            logger.severe("Could not write data to temporary file " + e.toString());
            return;
        }
    }
    // Add the new mass list
    massLists.add(storedMassList);
    // Add the mass list to the tree model
    MZmineProjectImpl project = (MZmineProjectImpl) MZmineCore.getProjectManager().getCurrentProject();
    // Check if we are adding to the current project
    if (Arrays.asList(project.getDataFiles()).contains(rawDataFile)) {
        final RawDataTreeModel treeModel = project.getRawDataTreeModel();
        treeModel.addObjectWithoutGUIUpdate(storedMassList);
    }
}
Also used : DataPoint(net.sf.mzmine.datamodel.DataPoint) RawDataTreeModel(net.sf.mzmine.desktop.impl.projecttree.RawDataTreeModel) IOException(java.io.IOException) MassList(net.sf.mzmine.datamodel.MassList) DataPoint(net.sf.mzmine.datamodel.DataPoint)

Aggregations

MassList (net.sf.mzmine.datamodel.MassList)36 Scan (net.sf.mzmine.datamodel.Scan)25 DataPoint (net.sf.mzmine.datamodel.DataPoint)24 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)14 Feature (net.sf.mzmine.datamodel.Feature)9 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)9 ArrayList (java.util.ArrayList)6 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 PeakList (net.sf.mzmine.datamodel.PeakList)5 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)4 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)4 Range (com.google.common.collect.Range)3 FileWriter (java.io.FileWriter)3 IOException (java.io.IOException)3 TreePath (javax.swing.tree.TreePath)3 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)3 MZmineProject (net.sf.mzmine.datamodel.MZmineProject)3 MergedSpectrum (net.sf.mzmine.modules.tools.msmsspectramerge.MergedSpectrum)3 MsMsSpectraMergeModule (net.sf.mzmine.modules.tools.msmsspectramerge.MsMsSpectraMergeModule)3 BufferedWriter (java.io.BufferedWriter)2