Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localized the First Derivative peak detector #1259

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2022 Lablicate GmbH.
* Copyright (c) 2014, 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 @@ -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
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2022 Lablicate GmbH.
* Copyright (c) 2008, 2023 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down 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
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2022 Lablicate GmbH.
* Copyright (c) 2018, 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 @@ -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";
}
Loading