spectral-peak-filtering-by-mass-accuracy
Summary
Filter FT-ICR MS peaks by rejecting those with formula assignment errors exceeding a mass accuracy threshold (typically 0.5 ppm), ensuring only high-confidence molecular formula assignments are retained for downstream analysis. This step removes ambiguous or spurious peaks that would compromise metabolomic interpretation.
When to use
After molecular formula assignment has been performed on FT-ICR MS peaks (e.g., by Formularity or CoreMS), and before calculating thermodynamic indices, compound class assignments, or statistical analysis. Use this skill when you have a peak abundance matrix with m/z values, assigned molecular formulas, and associated mass assignment error values, and you need to ensure formula quality before proceeding to chemodiversity or transformation network analysis.
When NOT to use
- Input peaks lack assigned molecular formulas or mass error values—apply formula assignment first (e.g., Formularity).
- Mass accuracy threshold is unknown or instrument-specific calibration differs substantially from 0.5 ppm—consult instrument calibration before filtering.
- You need to retain all peaks for exploratory visualization regardless of assignment quality—consider filtering only for downstream statistical or network analysis, not visualization.
Inputs
- Peak abundance CSV table with columns: m/z (observed), assigned molecular formula, mass assignment error (ppm)
- User-defined mass accuracy threshold (ppm)
Outputs
- Filtered peak abundance matrix (subset of input, peaks with error > threshold removed)
- Summary statistics: count of peaks retained vs. rejected, error distribution
How to apply
Load the peak abundance CSV containing m/z values, assigned formulas, and mass assignment error columns using pandas. Define a maximum allowable formula assignment error threshold (the article demonstrates 0.5 ppm as standard for FT-ICR MS). Retain only peaks where the absolute error between observed and theoretical m/z for the assigned formula is ≤ threshold. Remove all peaks exceeding this error cutoff. The rationale is that FT-ICR MS formula assignment relies on ultra-high mass accuracy; peaks with large errors indicate either misassignment or unresolvable ambiguity, and including them introduces systematic noise into downstream chemodiversity, statistical, and transformation network analyses. Document the number of peaks removed and the distribution of errors pre- and post-filtering.
Related tools
- pandas (Load and filter peak abundance CSV tables by mass error threshold)
- Formularity (Upstream tool that assigns molecular formulas and generates mass assignment error values for filtering)
- CoreMS (Alternative upstream tool for signal processing and molecular formula assignment prior to error-based filtering)
- MetaboDirect (Complete FT-ICR MS pipeline that integrates this filtering step in its data pre-processing stage) — https://github.com/Coayala/MetaboDirect
Examples
peaks_df = pd.read_csv('peaks_with_formulas.csv'); filtered_df = peaks_df[peaks_df['mass_error_ppm'].abs() <= 0.5]; filtered_df.to_csv('filtered_peaks.csv', index=False)
Evaluation signals
- Verify output peak count is strictly ≤ input peak count and > 0; document number of peaks removed.
- Check that all retained peaks have mass assignment error ≤ specified threshold; spot-check a sample of rejected peaks to confirm error > threshold.
- Compare error distribution (mean, median, max) before and after filtering; post-filter distribution should show tighter clustering near zero.
- Confirm downstream analysis outputs (chemodiversity indices, Van Krevelen diagrams, transformation networks) are stable and show expected chemical class distributions, not artifacts from low-quality formula assignments.
- Verify that the filtered matrix is a true subset (all retained peaks exist in input) and that no duplicates were introduced.
Limitations
- Threshold is instrument- and calibration-dependent; 0.5 ppm is standard for FT-ICR MS but may vary with tuning and sample complexity.
- Filtering by error alone does not resolve structural isomers with identical m/z; these will pass the filter but remain chemically ambiguous.
- Peaks near instrument detection limit may have larger errors and be preferentially removed, potentially biasing toward abundant species.
- Mass error is reported post-assignment; incorrect formula assignments (due to unresolved isobars or co-eluting isomers) may have low reported errors but be chemically wrong—this filter addresses error magnitude, not assignment correctness.
Evidence
- [methods] Remove peaks with formula assignment error exceeding 0.5 ppm and peaks absent in fewer samples than the user-defined threshold.: "Remove peaks with formula assignment error exceeding 0.5 ppm and peaks absent in fewer samples than the user-defined threshold."
- [methods] Filter peaks by m/z range (user-defined) and remove isotopic peaks (13C).: "Filter peaks by m/z range (user-defined) and remove isotopic peaks (13C)."
- [methods] error in formula assignment (0.5 ppm): "error in formula assignment (0.5 ppm)"
- [intro] advances in analytical mass spectrometry techniques and in particular the introduction of high-resolution mass spectrometry (HR-MS) in the last 20 years have allowed for high-precision formula: "advances in analytical mass spectrometry techniques and in particular the introduction of high-resolution mass spectrometry (HR-MS) in the last 20 years have allowed for high-precision formula"
- [methods] Load the input CSV file containing detected peaks, m/z values, molecular formulas, and peak intensities using pandas.: "Load the input CSV file containing detected peaks, m/z values, molecular formulas, and peak intensities using pandas."
1---2name: spectral-peak-filtering-by-mass-accuracy3description: Use when after molecular formula assignment has been performed on FT-ICR MS peaks (e.g., by Formularity or CoreMS), and before calculating thermodynamic indices, compound class assignments, or statistical analysis.4license: CC-BY-4.05---67# spectral-peak-filtering-by-mass-accuracy89## Summary1011Filter FT-ICR MS peaks by rejecting those with formula assignment errors exceeding a mass accuracy threshold (typically 0.5 ppm), ensuring only high-confidence molecular formula assignments are retained for downstream analysis. This step removes ambiguous or spurious peaks that would compromise metabolomic interpretation.1213## When to use1415After molecular formula assignment has been performed on FT-ICR MS peaks (e.g., by Formularity or CoreMS), and before calculating thermodynamic indices, compound class assignments, or statistical analysis. Use this skill when you have a peak abundance matrix with m/z values, assigned molecular formulas, and associated mass assignment error values, and you need to ensure formula quality before proceeding to chemodiversity or transformation network analysis.1617## When NOT to use1819- Input peaks lack assigned molecular formulas or mass error values—apply formula assignment first (e.g., Formularity).20- Mass accuracy threshold is unknown or instrument-specific calibration differs substantially from 0.5 ppm—consult instrument calibration before filtering.21- You need to retain all peaks for exploratory visualization regardless of assignment quality—consider filtering only for downstream statistical or network analysis, not visualization.2223## Inputs2425- Peak abundance CSV table with columns: m/z (observed), assigned molecular formula, mass assignment error (ppm)26- User-defined mass accuracy threshold (ppm)2728## Outputs2930- Filtered peak abundance matrix (subset of input, peaks with error > threshold removed)31- Summary statistics: count of peaks retained vs. rejected, error distribution3233## How to apply3435Load the peak abundance CSV containing m/z values, assigned formulas, and mass assignment error columns using pandas. Define a maximum allowable formula assignment error threshold (the article demonstrates 0.5 ppm as standard for FT-ICR MS). Retain only peaks where the absolute error between observed and theoretical m/z for the assigned formula is ≤ threshold. Remove all peaks exceeding this error cutoff. The rationale is that FT-ICR MS formula assignment relies on ultra-high mass accuracy; peaks with large errors indicate either misassignment or unresolvable ambiguity, and including them introduces systematic noise into downstream chemodiversity, statistical, and transformation network analyses. Document the number of peaks removed and the distribution of errors pre- and post-filtering.3637## Related tools3839- **pandas** (Load and filter peak abundance CSV tables by mass error threshold)40- **Formularity** (Upstream tool that assigns molecular formulas and generates mass assignment error values for filtering)41- **CoreMS** (Alternative upstream tool for signal processing and molecular formula assignment prior to error-based filtering)42- **MetaboDirect** (Complete FT-ICR MS pipeline that integrates this filtering step in its data pre-processing stage) — https://github.com/Coayala/MetaboDirect4344## Examples4546```47peaks_df = pd.read_csv('peaks_with_formulas.csv'); filtered_df = peaks_df[peaks_df['mass_error_ppm'].abs() <= 0.5]; filtered_df.to_csv('filtered_peaks.csv', index=False)48```4950## Evaluation signals5152- Verify output peak count is strictly ≤ input peak count and > 0; document number of peaks removed.53- Check that all retained peaks have mass assignment error ≤ specified threshold; spot-check a sample of rejected peaks to confirm error > threshold.54- Compare error distribution (mean, median, max) before and after filtering; post-filter distribution should show tighter clustering near zero.55- Confirm downstream analysis outputs (chemodiversity indices, Van Krevelen diagrams, transformation networks) are stable and show expected chemical class distributions, not artifacts from low-quality formula assignments.56- Verify that the filtered matrix is a true subset (all retained peaks exist in input) and that no duplicates were introduced.5758## Limitations5960- Threshold is instrument- and calibration-dependent; 0.5 ppm is standard for FT-ICR MS but may vary with tuning and sample complexity.61- Filtering by error alone does not resolve structural isomers with identical m/z; these will pass the filter but remain chemically ambiguous.62- Peaks near instrument detection limit may have larger errors and be preferentially removed, potentially biasing toward abundant species.63- Mass error is reported post-assignment; incorrect formula assignments (due to unresolved isobars or co-eluting isomers) may have low reported errors but be chemically wrong—this filter addresses error magnitude, not assignment correctness.6465## Evidence6667- [methods] Remove peaks with formula assignment error exceeding 0.5 ppm and peaks absent in fewer samples than the user-defined threshold.: "Remove peaks with formula assignment error exceeding 0.5 ppm and peaks absent in fewer samples than the user-defined threshold."68- [methods] Filter peaks by m/z range (user-defined) and remove isotopic peaks (13C).: "Filter peaks by m/z range (user-defined) and remove isotopic peaks (13C)."69- [methods] error in formula assignment (0.5 ppm): "error in formula assignment (0.5 ppm)"70- [intro] advances in analytical mass spectrometry techniques and in particular the introduction of high-resolution mass spectrometry (HR-MS) in the last 20 years have allowed for high-precision formula: "advances in analytical mass spectrometry techniques and in particular the introduction of high-resolution mass spectrometry (HR-MS) in the last 20 years have allowed for high-precision formula"71- [methods] Load the input CSV file containing detected peaks, m/z values, molecular formulas, and peak intensities using pandas.: "Load the input CSV file containing detected peaks, m/z values, molecular formulas, and peak intensities using pandas."