use of dulab.adap.datamodel.Peak 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);
}
use of dulab.adap.datamodel.Peak in project mzmine2 by mzmine.
the class ADAPInterface method getComponent.
public static Component getComponent(final PeakListRow row) {
if (row.getNumberOfPeaks() == 0)
throw new IllegalArgumentException("No peaks found");
NavigableMap<Double, Double> spectrum = new TreeMap<>();
// Read Spectrum information
IsotopePattern ip = row.getBestIsotopePattern();
if (ip != null) {
for (DataPoint dataPoint : ip.getDataPoints()) spectrum.put(dataPoint.getMZ(), dataPoint.getIntensity());
}
// Read Chromatogram
final Feature peak = row.getBestPeak();
final RawDataFile dataFile = peak.getDataFile();
NavigableMap<Double, Double> chromatogram = new TreeMap<>();
for (final int scan : peak.getScanNumbers()) {
final DataPoint dataPoint = peak.getDataPoint(scan);
if (dataPoint != null)
chromatogram.put(dataFile.getScan(scan).getRetentionTime(), dataPoint.getIntensity());
}
return new Component(null, new Peak(chromatogram, new PeakInfo().mzValue(peak.getMZ()).peakID(row.getID())), spectrum, null);
}
Aggregations