Note: Using synthetic data due to mzR compatibility issues
Selected spectrum:
Precursor m/z: 754.184
Number of peaks: 133
Intensity range: 1.19e+01 - 2.37e+06
Peak detection and quantification form the foundation of MS data analysis workflows. This chapter covers modern algorithms implemented in the R for Mass Spectrometry ecosystem and practical implementations using Spectra and MsCoreUtils.
Note: Using synthetic data due to mzR compatibility issues
Selected spectrum:
Precursor m/z: 754.184
Number of peaks: 133
Intensity range: 1.19e+01 - 2.37e+06
The Spectra package provides optimized peak picking methods:
Peak reduction:
Original peaks: 133
After picking: 24
Reduction: 82 %

Estimated noise level: 3277.76
SNR statistics:
Median SNR: 0.75
Mean SNR: 9.31
Max SNR: 723.41



Peak Area: 0
Peak Height: 2371160
Peak m/z: 719.2207

Gaussian Fit Results:
Center: 719.1114
Area: -6674634
R-squared: 0.994
SNR values for detected peaks:
[1] 69.69
Peak Symmetry Assessment:
Asymmetry Factor: 5.621
FWHM: 22.7887
peak_id mz intensity relative_intensity snr asymmetry area
1 1 719.2207 2371160 100 69.68987 5.620902 0
Total peaks detected across spectra: 60
peak_id mz intensity relative_intensity snr asymmetry area
1 1 244.7057 42771.88 12.34308 0.9532201 2.5576214 0
2 2 327.8421 92756.94 26.76772 2.0967084 0.5159425 1722408
3 3 499.9734 48168.09 13.90031 1.0818725 0.4781007 0
4 4 583.4235 226616.75 65.39688 5.3889942 73.3594800 0
5 5 625.0181 148558.39 42.87086 3.4045120 15.9325747 0
6 6 653.3221 136722.88 39.45538 3.1273898 0.3150271 0
spectrum_id retention_time
1 1 100
2 1 100
3 1 100
4 1 100
5 1 100
6 1 100
This section introduces a comprehensive peak detection and area calculation system that provides robust methods for spectral analysis, including distance-based filtering, slope analysis, and sophisticated area calculations.
Note: To use the advanced peak detection functions, you need to first define them by running the code blocks above (or source them from a separate R script). For demonstration purposes, we’ll show a simplified example here.
For a working example that doesn’t require the full function definitions, we can use a simplified peak detection approach:
Simplified peak detection results:
Total peaks detected: 17
Peak m/z range: 300.44 1944.56
Peak height range: 6882.45 2371160
index peak height type
1 8 300.4421 31556.99 peak
2 17 393.2184 33672.98 peak
3 22 454.3711 10082.55 peak
4 27 510.6402 18913.01 peak
5 32 573.8701 19330.30 peak
For demonstration, here’s a simplified slope calculation:
Peak slope analysis:
Peaks analyzed: 16
Mean slope angle range: 89.96 90 degrees
Mean asymmetry (diff_percent): 0.01 %
index peak height angle_left angle_right angle_mean diff_percent
1 8 300.4421 31556.99 89.98430 89.99443 89.98936 0.011258257
2 17 393.2184 33672.98 89.99279 89.99487 89.99383 0.002310248
3 22 454.3711 10082.55 89.93208 89.98208 89.95708 0.055584005
This chapter covered advanced peak detection and quantification methods, including:
detect_spectral_peaks, filter_peaks_by_distance) for robust peak detection with neighbor validation, minimum height filtering, and distance-based filteringcalculate_peak_slope_metrics) and trough detection (detect_spectral_troughs) for comprehensive peak geometry assessmentcalculate_polygon_area), and Gaussian fittingrefine_peak_boundaries) for accurate peak area determinationcalculate_area_statistics) and ratio calculations (calculate_area_ratios) with outlier handlingThese techniques form the foundation for reliable quantitative analysis in mass spectrometry, providing robust tools for both automated and manual peak analysis workflows.