use of dulab.adap.workflow.decomposition.RetTimeClusterer 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();
}
Aggregations