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();
}
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;
}
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;
}
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;
}
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);
}
Aggregations