Skip to content

Commit

Permalink
Localize first derivative peak detector.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Jan 26, 2023
1 parent 7e5c9f7 commit 2dde3fa
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
eclipse.preferences.version=1
encoding//OSGI-INF/l10n/bundle_de.properties=UTF-8
encoding/<project>=utf8
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
###############################################################################
# Copyright (c) 2023 Lablicate GmbH.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Matthias Mailänder - initial API and implementation
###############################################################################
#Properties file
FirstDerivative=Erste Ableitung
FirstDerivativeDescription=Implementierung eines Peak Detectors auf Basis der ersten Ableitung.
Threshold=Schwellenwert
IncludeBackground=Untergrund einbeziehen
IncludeBackgroundDescription=ausgewählt: VV, abgewählt: BV|VB
MinSignalToNoiseRatio=Min Signal-Rausch-Verhältnis
WindowSize=Fensterweite
WindowSizeDescription=Fensterweite: 3, 5, 7, ..., 45
UseNoiseSegments=Rauschsegmente verwenden
UseNoiseSegmentsDescription=Ob Rauschsegmente verwendet werden sollen, um zu entscheiden, wo Spitzen erkannt werden sollen. Dies kann die Empfindlichkeit des Algorithmus verbessern.
FilterMode=Filter Modus
FilterMasses=zu filternde m/z Werte
UseIndividualTraces=Verwende Einzelmassen
UseIndividualTracesDescription=Verwendet jedes Ion in der Filterliste einzeln, um Peaks zu erkennen.
OptimizeBaselineVV=Optimiere Basislinie (VV)
FilterWavelengths=zu filternde Wellenlänge
UseIndividualWavelengths=Verwende einzelne Wellenlängen
UseIndividualWavelengthsDescription=Verwendet einzelnde Wellenlängen in der Filterliste um Peaks individuell zu detektieren.
PeaksDetected={0} Peaks wurden detektiert.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2015, 2017 Lablicate GmbH.
# Copyright (c) 2015, 2023 Lablicate GmbH.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -10,3 +10,24 @@
# Dr. Philip Wenig - initial API and implementation
###############################################################################
#Properties file
FirstDerivative=First Derivative
FirstDerivativeDescription=Implementation of a first derivative peak detector.
Threshold=Threshold
IncludeBackground=Include Background
IncludeBackgroundDescription=VV: true, BV|VB: false
MinSignalToNoiseRatio=Min S/N Ratio
WindowSize=Window Size
WindowSizeDescription=Window Size: 3, 5, 7, ..., 45
UseNoiseSegments=Use Noise-Segments
UseNoiseSegmentsDescription=Whether to use noise segments to decide where peaks should be detected. This can improve the sensitivity of the algorithm.
FilterMode=Filter Mode
FilterMasses=m/z values to filter
UseIndividualTraces=Use Individual Traces
UseIndividualTracesDescription=Uses each ion in the filter-list individually to detect peaks.
OptimizeBaselineVV=Optimize Baseline (VV)
FilterWavelengths=Wavelengths to filter
UseIndividualWavelengths=Use Individual Wavelengths
UseIndividualWavelengthsDescription=Uses each wavelength in the filter-list individually to detect peaks
PeaksDetected={0} peaks have been detected.


Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
<extension
point="org.eclipse.chemclipse.chromatogram.msd.peak.detector.peakDetectorSupplier">
<PeakDetector
description="Implementation of a first derivative peak detector."
description="%FirstDerivativeDescription"
id="org.eclipse.chemclipse.chromatogram.msd.peak.detector.supplier.firstderivative"
peakDetector="org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.core.PeakDetectorMSD"
peakDetectorName="First Derivative"
peakDetectorName="%FirstDerivative"
peakDetectorSettings="org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.PeakDetectorSettingsMSD">
</PeakDetector>
</extension>
<extension
point="org.eclipse.chemclipse.chromatogram.csd.peak.detector.peakDetectorSupplier">
<PeakDetector
description="Implementation of a first derivative peak detector."
description="%FirstDerivativeDescription"
id="org.eclipse.chemclipse.chromatogram.csd.peak.detector.supplier.firstderivative"
peakDetector="org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.core.PeakDetectorCSD"
peakDetectorName="First Derivative"
peakDetectorName="%FirstDerivative"
peakDetectorSettings="org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.PeakDetectorSettingsCSD">
</PeakDetector>
</extension>
<extension
point="org.eclipse.chemclipse.chromatogram.wsd.peak.detector.peakDetectorSupplier">
<PeakDetector
description="Implementation of a first derivative peak detector."
description="%FirstDerivativeDescription"
id="org.eclipse.chemclipse.chromatogram.wsd.peak.detector.supplier.firstderivative"
peakDetector="org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.core.PeakDetectorWSD"
peakDetectorName="First Derivative"
peakDetectorName="%FirstDerivative"
peakDetectorSettings="org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.PeakDetectorSettingsWSD">
</PeakDetector>
</extension>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Lablicate GmbH.
* Copyright (c) 2019, 2023 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -19,6 +19,8 @@
import java.util.Map;

import org.eclipse.chemclipse.chromatogram.peak.detector.support.IRawPeak;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.FirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.IFirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.FirstDerivativePeakDetectorSettings;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.FirstDerivativeDetectorSlopes;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.IFirstDerivativeDetectorSlope;
Expand Down Expand Up @@ -48,7 +50,7 @@
@Component(service = {IMeasurementPeakDetector.class, Detector.class})
public class FirstDerivativePeakDetector implements IMeasurementPeakDetector<FirstDerivativePeakDetectorSettings> {

public static final String DETECTOR_DESCRIPTION = "First Derivative";
public static final String DETECTOR_DESCRIPTION = FirstDerivativeMessages.INSTANCE().getMessage(IFirstDerivativeMessages.FIRST_DERIVATIVE);

@Override
public String getName() {
Expand Down Expand Up @@ -112,7 +114,7 @@ public <T extends IMeasurement> Map<T, PeakList> detectIMeasurementPeaks(Collect
@Override
public String getDescription() {

return "Implementation of a first derivative peak detector.";
return FirstDerivativeMessages.INSTANCE().getMessage(IFirstDerivativeMessages.FIRST_DERIVATIVE_DESCRIPTON);
}

private static IFirstDerivativeDetectorSlopes getSignalSlopes(List<? extends ISignal> signals, int windowSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.eclipse.chemclipse.chromatogram.peak.detector.model.Threshold;
import org.eclipse.chemclipse.chromatogram.peak.detector.support.IRawPeak;
import org.eclipse.chemclipse.chromatogram.xxd.calculator.core.noise.NoiseChromatogramClassifier;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.FirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.IFirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.preferences.PreferenceSupplier;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.PeakDetectorSettingsCSD;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.FirstDerivativeDetectorSlope;
Expand Down Expand Up @@ -85,7 +87,8 @@ public IProcessingInfo<R> detect(IChromatogramSelectionCSD chromatogramSelection
chromatogram.addPeak(peak);
}
chromatogramSelection.getChromatogram().setDirty(true);
processingInfo.addMessage(new ProcessingMessage(MessageType.INFO, FirstDerivativePeakDetector.DETECTOR_DESCRIPTION, "Peaks have been detected successfully."));
String peakDetectedMessage = FirstDerivativeMessages.INSTANCE().getMessage(IFirstDerivativeMessages.PEAKS_DETECTED, String.valueOf(peaks.size()));
processingInfo.addMessage(new ProcessingMessage(MessageType.INFO, FirstDerivativePeakDetector.DETECTOR_DESCRIPTION, peakDetectedMessage));
} else {
logger.warn("Settings is not of type: " + PeakDetectorSettingsCSD.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.eclipse.chemclipse.chromatogram.peak.detector.model.Threshold;
import org.eclipse.chemclipse.chromatogram.peak.detector.support.IRawPeak;
import org.eclipse.chemclipse.chromatogram.xxd.calculator.core.noise.NoiseChromatogramClassifier;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.FirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.IFirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.preferences.PreferenceSupplier;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.PeakDetectorSettingsMSD;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.FirstDerivativeDetectorSlope;
Expand Down Expand Up @@ -91,7 +93,8 @@ public IProcessingInfo<R> detect(IChromatogramSelectionMSD chromatogramSelection
chromatogram.addPeak(peak);
}
chromatogram.setDirty(true);
processingInfo.addMessage(new ProcessingMessage(MessageType.INFO, FirstDerivativePeakDetector.DETECTOR_DESCRIPTION, peaks.size() + " peaks have been detected."));
String peakDetectedMessage = FirstDerivativeMessages.INSTANCE().getMessage(IFirstDerivativeMessages.PEAKS_DETECTED, String.valueOf(peaks.size()));
processingInfo.addMessage(new ProcessingMessage(MessageType.INFO, FirstDerivativePeakDetector.DETECTOR_DESCRIPTION, peakDetectedMessage));
} else {
logger.warn("Settings is not of type: " + PeakDetectorSettingsMSD.class);
}
Expand Down Expand Up @@ -354,9 +357,8 @@ protected float getScanSignal(IChromatogramMSD chromatogram, int scanNumber, IMa
if(scan instanceof IScanMSD) {
IScanMSD scanMSD = (IScanMSD)scan;
return scanMSD.getTotalSignal(ions);
} else {
return scan.getTotalSignal();
}
return scan.getTotalSignal();
}

private int optimizeRightBaseline(IChromatogramMSD chromatogram, int startScan, int centerScan, int stopScan, IMarkedIons ions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.eclipse.chemclipse.chromatogram.wsd.peak.detector.core.IPeakDetectorWSD;
import org.eclipse.chemclipse.chromatogram.wsd.peak.detector.settings.IPeakDetectorSettingsWSD;
import org.eclipse.chemclipse.chromatogram.xxd.calculator.core.noise.NoiseChromatogramClassifier;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.FirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.IFirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.preferences.PreferenceSupplier;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.settings.PeakDetectorSettingsWSD;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.FirstDerivativeDetectorSlope;
Expand Down Expand Up @@ -92,7 +94,8 @@ public IProcessingInfo<R> detect(IChromatogramSelectionWSD chromatogramSelection
chromatogram.addPeak(peak);
}
chromatogram.setDirty(true);
processingInfo.addMessage(new ProcessingMessage(MessageType.INFO, FirstDerivativePeakDetector.DETECTOR_DESCRIPTION, peaks.size() + " peaks have been detected successfully."));
String peakDetectedMessage = FirstDerivativeMessages.INSTANCE().getMessage(IFirstDerivativeMessages.PEAKS_DETECTED, String.valueOf(peaks.size()));
processingInfo.addMessage(new ProcessingMessage(MessageType.INFO, FirstDerivativePeakDetector.DETECTOR_DESCRIPTION, peakDetectedMessage));
} else {
logger.warn("Settings is not of type: " + PeakDetectorSettingsWSD.class);
}
Expand Down Expand Up @@ -326,9 +329,8 @@ protected float getScanSignal(IChromatogramWSD chromatogram, int scanNumber, IMa
if(scan instanceof IScanWSD) {
IScanWSD scanWSD = (IScanWSD)scan;
return scanWSD.getTotalSignal(wavelengths);
} else {
return scan.getTotalSignal();
}
return scan.getTotalSignal();
}

private int optimizeRightBaseline(IChromatogramWSD chromatogram, int startScan, int centerScan, int stopScan, IMarkedWavelengths wavelengths) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2015, 2023 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Dr. Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages;

import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.Activator;
import org.eclipse.chemclipse.support.l10n.Messages;

public class FirstDerivativeMessages implements IFirstDerivativeMessages {

private static Messages messages;

/**
* Returns the messages instance to get a translation.
*
* @return {@link Messages}
*/
public static Messages INSTANCE() {

if(messages == null) {
messages = new Messages(Activator.getContext().getBundle());
}
return messages;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2023 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Matthias Mailänder - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages;

public interface IFirstDerivativeMessages {

/*
* The strings need to be listed and translated in:
* OSGI-INF/l10n/bundle.properties ...
*/
String FIRST_DERIVATIVE = "FirstDerivative";
String FIRST_DERIVATIVE_DESCRIPTON = "FirstDerivativeDescription";
String THRESHOLD = "Threshold";
String INCLUDE_BACKGROUND = "IncludeBackground";
String BACKGROUND_DESCRIPTION = "IncludeBackgroundDescription";
String MIN_SN_RATIO = "MinSignalToNoiseRatio";
String WINDOW_SIZE = "WindowSize";
String WINDOW_SIZE_DESCRIPTION = "WindowSizeDescription";
String USE_NOISE_SEGMENTS = "UseNoiseSegments";
String USE_NOISE_SEGMENTS_DESCRIPTION = "UseNoiseSegmentsDescription";
String FILTER_MODE = "FilterMode";
String FILTER_MASSES = "FilterMasses";
String USE_INDIVIDUAL_TRACES = "UseIndividualTraces";
String USE_INDIVIDUAL_TRACES_DESCRIPTION = "UseIndividualTracesDescription";
String OPTIMIZE_BASELINE_VV = "OptimizeBaselineVV";
String PEAKS_DETECTED = "PeaksDetected";
String FILTER_WAVELENGTHS = "FilterWavelengths";
String USE_INDIVIDUAL_WAVELENGTHS = "UseIndividualWavelengths";
String USE_INDIVIDUAL_WAVELENGTHS_DESCRIPTION = "UseIndividualWavelengthsDescription";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

import org.eclipse.chemclipse.chromatogram.csd.peak.detector.settings.AbstractPeakDetectorCSDSettings;
import org.eclipse.chemclipse.chromatogram.peak.detector.model.Threshold;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.messages.IFirstDerivativeMessages;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.preferences.PreferenceSupplier;
import org.eclipse.chemclipse.support.settings.FloatSettingsProperty;
import org.eclipse.chemclipse.support.settings.IntSettingsProperty;
import org.eclipse.chemclipse.support.settings.IntSettingsProperty.Validation;
import org.eclipse.chemclipse.support.settings.LocalisationSettingsProperty;
import org.eclipse.chemclipse.support.settings.serialization.WindowSizeDeserializer;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -27,22 +29,27 @@
public class PeakDetectorSettingsCSD extends AbstractPeakDetectorCSDSettings {

@JsonProperty(value = "Threshold", defaultValue = "MEDIUM")
@LocalisationSettingsProperty(value = IFirstDerivativeMessages.THRESHOLD)
private Threshold threshold = Threshold.MEDIUM;
@JsonProperty(value = "Include Background", defaultValue = "false")
@JsonPropertyDescription("VV: true, BV|VB: false")
@LocalisationSettingsProperty(value = IFirstDerivativeMessages.INCLUDE_BACKGROUND, description = IFirstDerivativeMessages.BACKGROUND_DESCRIPTION)
private boolean includeBackground = false;
@JsonProperty(value = "Min S/N Ratio", defaultValue = "0")
@LocalisationSettingsProperty(value = IFirstDerivativeMessages.MIN_SN_RATIO)
@FloatSettingsProperty(minValue = PreferenceSupplier.MIN_SN_RATIO_MIN, maxValue = PreferenceSupplier.MIN_SN_RATIO_MAX)
private float minimumSignalToNoiseRatio;
@JsonProperty(value = "Window Size", defaultValue = "5")
@JsonPropertyDescription(value = "Window Size: 3, 5, 7, ..., 45")
@LocalisationSettingsProperty(value = IFirstDerivativeMessages.WINDOW_SIZE, description = IFirstDerivativeMessages.WINDOW_SIZE_DESCRIPTION)
@IntSettingsProperty(minValue = PreferenceSupplier.MIN_WINDOW_SIZE, maxValue = PreferenceSupplier.MAX_WINDOW_SIZE, validation = Validation.ODD_NUMBER_INCLUDING_ZERO)
@JsonDeserialize(using = WindowSizeDeserializer.class)
private int windowSize = 5;
@JsonProperty(value = "Use Noise-Segments", defaultValue = "false")
@JsonPropertyDescription(value = "Whether to use noise segments to decide where peaks should be detected. This can improve the sensitivity of the algorithm.")
private boolean useNoiseSegments = false;
@JsonProperty(value = "Optimize Baseline (VV)", defaultValue = "false")
@LocalisationSettingsProperty(value = IFirstDerivativeMessages.OPTIMIZE_BASELINE_VV)
private boolean optimizeBaseline = false;

public PeakDetectorSettingsCSD() {
Expand Down
Loading

0 comments on commit 2dde3fa

Please sign in to comment.