Search in sources :

Example 76 with PeakList

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

the class ADAP3DecompositionV2SetupDialog method retTimeCluster.

/**
 * Cluster all peaks in PeakList based on retention time
 */
private void retTimeCluster() {
    ChromatogramPeakPair chromatogramPeakPair = cboPeakLists.getItemAt(cboPeakLists.getSelectedIndex());
    if (chromatogramPeakPair == null)
        return;
    PeakList chromatogramList = chromatogramPeakPair.chromatograms;
    PeakList peakList = chromatogramPeakPair.peaks;
    if (chromatogramList == null || peakList == null)
        return;
    Double minDistance = parameterSet.getParameter(ADAP3DecompositionV2Parameters.PREF_WINDOW_WIDTH).getValue();
    if (minDistance == null || minDistance <= 0.0)
        return;
    // Convert peakList into ranges
    List<RetTimeClusterer.Interval> ranges = Arrays.stream(peakList.getRows()).map(PeakListRow::getBestPeak).map(p -> new RetTimeClusterer.Interval(p.getRawDataPointsRTRange(), p.getMZ())).collect(Collectors.toList());
    List<BetterPeak> peaks = new ADAP3DecompositionV2Utils().getPeaks(peakList);
    // Form clusters of ranges
    List<RetTimeClusterer.Cluster> retTimeClusters = new RetTimeClusterer(minDistance).execute(peaks);
    cboClusters.removeAllItems();
    cboClusters.removeActionListener(this);
    for (RetTimeClusterer.Cluster cluster : retTimeClusters) {
        int i;
        for (i = 0; i < cboClusters.getItemCount(); ++i) {
            double retTime = cboClusters.getItemAt(i).retTime;
            if (cluster.retTime < retTime) {
                cboClusters.insertItemAt(cluster, i);
                break;
            }
        }
        if (i == cboClusters.getItemCount())
            cboClusters.addItem(cluster);
    }
    cboClusters.addActionListener(this);
    retTimeMZPlot.updateData(retTimeClusters);
    shapeCluster();
}
Also used : RetTimeClusterer(dulab.adap.workflow.decomposition.RetTimeClusterer) java.util(java.util) MZmineCore(net.sf.mzmine.main.MZmineCore) Parameter(net.sf.mzmine.parameters.Parameter) BetterComponent(dulab.adap.datamodel.BetterComponent) GUIUtils(net.sf.mzmine.util.GUIUtils) ActionEvent(java.awt.event.ActionEvent) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) PeakList(net.sf.mzmine.datamodel.PeakList) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) java.awt(java.awt) List(java.util.List) ComponentSelector(dulab.adap.workflow.decomposition.ComponentSelector) ParameterSet(net.sf.mzmine.parameters.ParameterSet) BetterPeak(dulab.adap.datamodel.BetterPeak) ParameterSetupDialog(net.sf.mzmine.parameters.dialogs.ParameterSetupDialog) Nonnull(javax.annotation.Nonnull) javax.swing(javax.swing) BetterPeak(dulab.adap.datamodel.BetterPeak) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) RetTimeClusterer(dulab.adap.workflow.decomposition.RetTimeClusterer) PeakList(net.sf.mzmine.datamodel.PeakList)

Example 77 with PeakList

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

the class LinearNormalizerModule method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    PeakList[] peakLists = parameters.getParameter(LinearNormalizerParameters.peakLists).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        Task newTask = new LinearNormalizerTask(project, peakList, parameters);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Example 78 with PeakList

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

the class StandardCompoundNormalizerModule method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    PeakList[] peakLists = parameters.getParameter(StandardCompoundNormalizerParameters.peakList).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        Task newTask = new StandardCompoundNormalizerTask(project, peakList, parameters);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Example 79 with PeakList

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

the class ADAP3DecompositionV1_5Module method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    PeakList[] peakLists = parameters.getParameter(ADAP3DecompositionV1_5Parameters.PEAK_LISTS).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        Task newTask = new ADAP3DecompositionV1_5Task(project, peakList, parameters);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Example 80 with PeakList

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

the class ADAP3DecompositionV1_5SetupDialog method retTimeCluster.

/**
 * Cluster all peaks in PeakList based on retention time
 *
 * @param peaks list od ADAP peaks
 * @param retTimeValues output of retention times
 * @param mzValues output of m/z-values
 * @param colorValues output of colors
 */
private void retTimeCluster(List<Peak> peaks, List<Double> retTimeValues, List<Double> mzValues, List<Double> colorValues) {
    Double minDistance = parameterSet.getParameter(ADAP3DecompositionV1_5Parameters.MIN_CLUSTER_DISTANCE).getValue();
    Integer minSize = parameterSet.getParameter(ADAP3DecompositionV1_5Parameters.MIN_CLUSTER_SIZE).getValue();
    Double minIntensity = parameterSet.getParameter(ADAP3DecompositionV1_5Parameters.MIN_CLUSTER_INTENSITY).getValue();
    if (minDistance == null || minSize == null || minIntensity == null)
        return;
    List<List<Peak>> retTimeClusters = TwoStepDecomposition.getRetTimeClusters(peaks, minDistance, minSize, minIntensity);
    int colorIndex = 0;
    final int numColors = 7;
    final double[] colors = new double[numColors];
    for (int i = 0; i < numColors; ++i) colors[i] = (double) i / numColors;
    comboClustersModel.removeAllElements();
    // Disable action listeners
    ActionListener[] comboListeners = comboClusters.getActionListeners();
    for (ActionListener l : comboListeners) comboClusters.removeActionListener(l);
    for (List<Peak> cluster : retTimeClusters) {
        for (Peak peak : cluster) {
            retTimeValues.add(peak.getRetTime());
            mzValues.add(peak.getMZ());
            colorValues.add(colors[colorIndex % numColors]);
        }
        ++colorIndex;
        ComboClustersItem newItem = new ComboClustersItem(cluster);
        int i;
        for (i = 0; i < comboClustersModel.getSize(); ++i) {
            double retTime = comboClustersModel.getElementAt(i).aveRetTime;
            if (newItem.aveRetTime < retTime) {
                comboClustersModel.insertElementAt(newItem, i);
                break;
            }
        }
        if (i == comboClustersModel.getSize())
            comboClustersModel.addElement(newItem);
    }
    // Enable action listeners
    for (ActionListener l : comboListeners) comboClusters.addActionListener(l);
}
Also used : ActionListener(java.awt.event.ActionListener) PeakList(net.sf.mzmine.datamodel.PeakList) ArrayList(java.util.ArrayList) List(java.util.List) Peak(dulab.adap.datamodel.Peak)

Aggregations

PeakList (net.sf.mzmine.datamodel.PeakList)120 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)41 Nonnull (javax.annotation.Nonnull)40 Task (net.sf.mzmine.taskcontrol.Task)37 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)36 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)26 Feature (net.sf.mzmine.datamodel.Feature)19 ArrayList (java.util.ArrayList)15 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)11 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)11 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)10 File (java.io.File)9 FileWriter (java.io.FileWriter)8 ParameterSet (net.sf.mzmine.parameters.ParameterSet)8 IOException (java.io.IOException)7 DataPoint (net.sf.mzmine.datamodel.DataPoint)7 Vector (java.util.Vector)6 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)6 MZmineProject (net.sf.mzmine.datamodel.MZmineProject)6 PeakIdentity (net.sf.mzmine.datamodel.PeakIdentity)6