* minRatio
&& peakDuration
.contains(retentionTimes[currentRegionEnd]
- retentionTimes[currentRegionStart])) {
resolvedPeaks.add(new ResolvedPeak(chromatogram,
currentRegionStart, currentRegionEnd));
}
// Set the next region start to current region end - 1
// because it will be immediately
// increased +1 as we continue the for-cycle.
currentRegionStart = currentRegionEnd - 1;
continue startSearch;
}
// Minimum duration of peak must be at least searchRTRange.
if (retentionTimes[currentRegionEnd]
- retentionTimes[currentRegionStart] >= searchRTRange) {
// Set the RT range to check
final Range checkRange = new Range(
retentionTimes[currentRegionEnd]
- searchRTRange,
retentionTimes[currentRegionEnd]
+ searchRTRange);
// Search if there is lower data point on the left from
// current peak i.
for (int i = currentRegionEnd - 1; i > 0
&& checkRange.contains(retentionTimes[i]); i--) {
if (intensities[i] < intensities[currentRegionEnd]) {
continue endSearch;
}
}
// Search on the right from current peak i.
for (int i = currentRegionEnd + 1; i < scanCount
&& checkRange.contains(retentionTimes[i]); i++) {
if (intensities[i] < intensities[currentRegionEnd]) {
continue endSearch;
}
}
// Find the intensity at the sides (lowest data points).
final double peakMinLeft = intensities[currentRegionStart];
final double peakMinRight = intensities[currentRegionEnd];
// If we have reached a minimum which is non-zero, but
// the peak shape would not fulfill the
// ratio condition, continue searching for next minimum.
if (currentRegionHeight >= peakMinRight * minRatio) {
// Check the shape of the peak.
if (currentRegionHeight >= minHeight
&& currentRegionHeight >= peakMinLeft
* minRatio
&& currentRegionHeight >= peakMinRight
* minRatio
&& peakDuration
.contains(retentionTimes[currentRegionEnd]
- retentionTimes[currentRegionStart])) {
resolvedPeaks.add(new ResolvedPeak(
chromatogram, currentRegionStart,
currentRegionEnd));
}
// Set the next region start to current region end-1