return alignMol;
}
private void updatePreview() {
PeakList peakListX = (PeakList) peakListsComboX.getSelectedItem();
PeakList peakListY = (PeakList) peakListsComboY.getSelectedItem();
if ((peakListX == null) || (peakListY == null))
return;
// Select the rawDataFile which has more peaks in each peakList
int numPeaks = 0;
RawDataFile file = null;
RawDataFile file2 = null;
for (RawDataFile rfile : peakListX.getRawDataFiles()) {
if (peakListX.getPeaks(rfile).length > numPeaks) {
numPeaks = peakListX.getPeaks(rfile).length;
file = rfile;
}
}
numPeaks = 0;
for (RawDataFile rfile : peakListY.getRawDataFiles()) {
if (peakListY.getPeaks(rfile).length > numPeaks) {
numPeaks = peakListY.getPeaks(rfile).length;
file2 = rfile;
}
}
// Update the parameter set from dialog components
updateParameterSetFromComponents();
// Check the parameter values
ArrayList<String> errorMessages = new ArrayList<String>();
boolean parametersOK = super.parameterSet
.checkAllParameterValues(errorMessages);
if (!parametersOK) {
StringBuilder message = new StringBuilder(
"Please check the parameter settings:\n\n");
for (String m : errorMessages) {
message.append(m);
message.append("\n");
}
MZmineCore.getDesktop().displayMessage(message.toString());
return;
}
// Ransac Alignment
Vector<AlignStructMol> list = this.getVectorAlignment(peakListX,
peakListY, file, file2);
RANSAC ransac = new RANSAC(super.parameterSet);
ransac.alignment(list);
// Plot the result
this.chart.removeSeries();
this.chart.addSeries(list,
peakListX.getName() + " vs " + peakListY.getName(),
super.parameterSet.getParameter(RansacAlignerParameters.Linear)
.getValue());
this.chart.printAlignmentChart(peakListX.getName() + " RT",
peakListY.getName() + " RT");
}