diff --git a/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/ResultWindow.java b/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/ResultWindow.java index 8cc1e116d..ba71f4a28 100644 --- a/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/ResultWindow.java +++ b/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/ResultWindow.java @@ -30,6 +30,7 @@ import java.io.File; import java.io.FileWriter; import java.util.Map; +import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -53,20 +54,22 @@ import net.sf.mzmine.datamodel.RawDataFile; import net.sf.mzmine.datamodel.impl.SimplePeakIdentity; import net.sf.mzmine.main.MZmineCore; +import net.sf.mzmine.modules.peaklistmethods.isotopes.isotopeprediction.IsotopePatternCalculator; import net.sf.mzmine.modules.visualization.spectra.simplespectra.SpectraVisualizerModule; import net.sf.mzmine.modules.visualization.spectra.simplespectra.SpectraVisualizerWindow; import net.sf.mzmine.taskcontrol.Task; import net.sf.mzmine.taskcontrol.TaskStatus; import net.sf.mzmine.util.ExceptionUtils; +import net.sf.mzmine.util.FormulaUtils; import net.sf.mzmine.util.GUIUtils; import net.sf.mzmine.util.components.PercentageCellRenderer; public class ResultWindow extends JFrame implements ActionListener { - /** - * - */ private static final long serialVersionUID = 1L; + + private Logger logger = Logger.getLogger(this.getClass().getName()); + private final JTable resultsTable; private final ResultTableModel resultsTableModel; private final TableRowSorter resultsTableSorter; @@ -226,6 +229,7 @@ public void actionPerformed(ActionEvent e) { if (command.equals("SHOW_ISOTOPES")) { + logger.finest("Showing isotope pattern for formula " + formula.getFormulaAsString()); IsotopePattern predictedPattern = formula.getPredictedIsotopes(); if (predictedPattern == null) diff --git a/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/SingleRowPredictionTask.java b/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/SingleRowPredictionTask.java index 899906b72..c5d945f1b 100644 --- a/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/SingleRowPredictionTask.java +++ b/src/main/java/net/sf/mzmine/modules/peaklistmethods/identification/formulaprediction/SingleRowPredictionTask.java @@ -204,24 +204,23 @@ private void checkConstraints(IMolecularFormula cdkFormula) { } // Calculate isotope similarity score - IsotopePattern detectedPattern = peakListRow.getBestIsotopePattern(); - IsotopePattern predictedIsotopePattern = null; - Double isotopeScore = null; - if ((checkIsotopes) && (detectedPattern != null)) { + final IsotopePattern detectedPattern = peakListRow.getBestIsotopePattern(); - String stringFormula = MolecularFormulaManipulator.getString(cdkFormula); + final String stringFormula = MolecularFormulaManipulator.getString(cdkFormula); - String adjustedFormula = FormulaUtils.ionizeFormula(stringFormula, ionType, charge); + final String adjustedFormula = FormulaUtils.ionizeFormula(stringFormula, ionType, charge); - final double isotopeNoiseLevel = isotopeParameters - .getParameter(IsotopePatternScoreParameters.isotopeNoiseLevel).getValue(); + final double isotopeNoiseLevel = + isotopeParameters.getParameter(IsotopePatternScoreParameters.isotopeNoiseLevel).getValue(); - final double detectedPatternHeight = detectedPattern.getHighestDataPoint().getIntensity(); + // Fixed min abundance + final double minPredictedAbundance = 0.00001; - final double minPredictedAbundance = isotopeNoiseLevel / detectedPatternHeight; + final IsotopePattern predictedIsotopePattern = IsotopePatternCalculator.calculateIsotopePattern( + adjustedFormula, minPredictedAbundance, charge, ionType.getPolarity()); - predictedIsotopePattern = IsotopePatternCalculator.calculateIsotopePattern(adjustedFormula, - minPredictedAbundance, charge, ionType.getPolarity()); + Double isotopeScore = null; + if ((checkIsotopes) && (detectedPattern != null)) { isotopeScore = IsotopePatternScoreCalculator.getSimilarityScore(detectedPattern, predictedIsotopePattern, isotopeParameters);