This Python script processes mass spectrometry (MS) data by applying smoothing, baseline correction, and peak detection. The results are exported as Excel files for further analysis.
- Loads MS data from an Excel file.
- Applies Savitzky-Golay smoothing to reduce noise.
- Performs baseline correction using wavelet decomposition.
- Detects peaks based on intensity prominence.
- Saves processed data and detected peaks to separate Excel files.
- Visualizes the raw, smoothed, and baseline-corrected spectra with detected peaks.
Ensure you have Python installed (>=3.7). Install the required dependencies using:
pip install -r requirements.txt- Place your MS data file (Excel format) in the same directory as the script.
- Modify the
file_pathvariable inmain()to point to your data file. - Run the script:
python ms_peak_processing.pyProcessed_MS_Data.xlsx: Contains raw, smoothed, and baseline-corrected intensity values.Detected_Peaks.xlsx: Contains detected peak m/z values and their corresponding intensities.
An example dataset (example_data.xlsx) is provided for testing purposes.
- pandas
- numpy
- matplotlib
- seaborn
- pywavelets
- scipy
This project is open-source under the MIT License.
Feel free to modify the script to suit your specific needs!