Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Direct antimicrobial resistance prediction from clinical MALDI-TOF mass spectra using machine learning


Early use of effective antimicrobial treatments is critical for the outcome of infections and the prevention of treatment resistance. Antimicrobial resistance testing enables the selection of optimal antibiotic treatments, but current culture-based techniques can take up to 72 hours to generate results. We have developed a novel machine learning approach to predict antimicrobial resistance directly from matrix-assisted laser desorption/ionization–time of flight (MALDI-TOF) mass spectra profiles of clinical isolates. We trained calibrated classifiers on a newly created publicly available database of mass spectra profiles from the clinically most relevant isolates with linked antimicrobial susceptibility phenotypes. This dataset combines more than 300,000 mass spectra with more than 750,000 antimicrobial resistance phenotypes from four medical institutions. Validation on a panel of clinically important pathogens, including Staphylococcus aureus, Escherichia coli and Klebsiella pneumoniae, resulting in areas under the receiver operating characteristic curve of 0.80, 0.74 and 0.74, respectively, demonstrated the potential of using machine learning to substantially accelerate antimicrobial resistance determination and change of clinical management. Furthermore, a retrospective clinical case study of 63 patients found that implementing this approach would have changed the clinical treatment in nine cases, which would have been beneficial in eight cases (89%). MALDI-TOF mass spectra-based machine learning may thus be an important new tool for treatment optimization and antibiotic stewardship.

This is a preview of subscription content, access via your institution

Access options

Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Fig. 1: MALDI-TOF mass spectrometry (MS)-based antimicrobial resistance (AMR) prediction workflow.
Fig. 2: Receiver operating characteristic and precision–recall curves of best-performance AMR prediction models on DRIAMS-A.
Fig. 3: Validation of predictive performance of each scenario trained and tested on DRIAMS-A–D (AUROC).
Fig. 4: Stability of results with different dataset perturbations.
Fig. 5: Quantification of feature impact on prediction through analysis of Shapley additive explanations (SHAP) values of the 30 most impactful features.
Fig. 6: Retrospective clinical case study including 63 cases of invasive bacterial infection.

Data availability

The full datasets generated during and analyzed during the current study are available in the Dryad repository,

Code availability

All R and Python scripts can be found in under a BSD 3-Clause License.


  1. World Health Organization. Global Action Plan on Antimicrobial Resistance (WHO, 2016).

  2. Wise, R. et al. Antimicrobial resistance. Is a major threat to public health. BMJ 317, 609–610 (1998).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  3. Cassini, A. et al. Attributable deaths and disability-adjusted life-years caused by infections with antibiotic-resistant bacteria in the EU and the European Economic Area in 2015: a population-level modelling analysis. Lancet Infect. Dis. 19, 56–66 (2019).

    Article  PubMed  PubMed Central  Google Scholar 

  4. Kumar, A. et al. Duration of hypotension before initiation of effective antimicrobial therapy is the critical determinant of survival in human septic shock. Crit. Care Med. 34, 1589–1596 (2006).

    Article  PubMed  Google Scholar 

  5. Seymour, C. W. et al. Time to treatment and mortality during mandated emergency care for sepsis. N. Engl. J. Med. 376, 2235–2244 (2017).

    Article  PubMed  PubMed Central  Google Scholar 

  6. Huang, A. M. et al. Impact of rapid organism identification via matrix-assisted laser desorption/ionization time-of-flight combined with antimicrobial stewardship team intervention in adult patients with bacteremia and candidemia. Clin. Infect. Dis. 57, 1237–1245 (2013).

    Article  CAS  PubMed  Google Scholar 

  7. Osthoff, M. et al. Impact of MALDI-TOF-MS-based identification directly from positive blood cultures on patient management: a controlled clinical trial. Clin. Microbiol. Infect. 23, 78–85 (2017).

    Article  CAS  PubMed  Google Scholar 

  8. Banerjee, R. et al. Randomized trial of rapid multiplex polymerase chain reaction-based blood culture identification and susceptibility testing. Clin. Infect. Dis. 61, 1071–1080 (2015).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  9. Kommedal, Ø., Aasen, J. L. & Lindemann, P. C. Genetic antimicrobial susceptibility testing in Gram-negative sepsis: impact on time to results in a routine laboratory. APMIS 124, 603–610 (2016).

    Article  CAS  PubMed  Google Scholar 

  10. Centers for Disease Control and Prevention. Core Elements of Antibiotic Stewardship (2019).

  11. Bourdon, N. et al. Rapid detection of vancomycin-resistant enterococci from rectal swabs by the Cepheid Xpert vanA/vanB assay. Diagn. Microbiol. Infect. Dis. 67, 291–293 (2010).

    Article  PubMed  Google Scholar 

  12. Huh, H. J., Kim, E. S. & Chae, S. L. Methicillin-resistant Staphylococcus aureus in nasal surveillance swabs at an intensive care unit: an evaluation of the LightCycler MRSA advanced test. Ann. Lab. Med. 32, 407–412 (2012).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  13. Cury, A. P. et al. Diagnostic performance of the Xpert Carba-RTM assay directly from rectal swabs for active surveillance of carbapenemase-producing organisms in the largest Brazilian University Hospital. J. Microbiol. Methods 171, 105884 (2020).

    Article  CAS  PubMed  Google Scholar 

  14. van Belkum, A., Welker, M., Pincus, D., Charrier, J. P. & Girard, V. Matrix-assisted laser desorption ionization time-of-flight mass spectrometry in clinical microbiology: what are the current issues? Ann. Lab. Med. 37, 475–483 (2017).

    Article  PubMed  PubMed Central  Google Scholar 

  15. Croxatto, A., Prod’hom, G. & Greub, G. Applications of MALDI-TOF mass spectrometry in clinical diagnostic microbiology. FEMS Microbiol. Rev. 36, 380–407 (2012).

    Article  CAS  PubMed  Google Scholar 

  16. Dierig, A., Frei, R. & Egli, A. The fast route to microbe identification: matrix assisted laser desorption/ionization-time of flight mass spectrometry (MALDI-TOF MS). Pediatr. Infect. Dis. J. 34, 97–99 (2015).

    Article  PubMed  Google Scholar 

  17. Hou, T.-Y., Chiang-Ni, C. & Teng, S.-H. Current status of MALDI-TOF mass spectrometry in clinical microbiology. J. Food Drug Anal. 27, 404–414 (2019).

    Article  CAS  PubMed  Google Scholar 

  18. Kim, J.-M. et al. Rapid discrimination of methicillin-resistant Staphylococcus aureus by MALDI-TOF MS. Pathogens 8, 214 (2019).

    Article  CAS  PubMed Central  Google Scholar 

  19. Weis, C. et al. Topological and kernel-based microbial phenotype prediction from MALDI-TOF mass spectra. Bioinformatics 36, i30–i38 (2020).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  20. Vervier, K., Mahé, P., Veyrieras, J.-B. & Vert, J.-P. Benchmark of structured machine learning methods for microbial identification from mass-spectrometry data. Preprint at (2015).

  21. Weis, C. V., Jutzeler, C. R. & Borgwardt, K. Machine learning for microbial identification and antimicrobial susceptibility testing on MALDI-TOF mass spectra: a systematic review. Clin. Microbiol. Infect. 26, 1310–1317 (2020).

    Article  CAS  PubMed  Google Scholar 

  22. Wang, H.-Y. et al. A large-scale investigation and identification of methicillin-resistant Staphylococcus aureus based on peaks binning of matrix-assisted laser desorption ionization–time of flight MS spectra. Brief. Bioinform. 22, bbaa138 (2021).

    Article  PubMed  Google Scholar 

  23. World Health Organization (WHO). WHO publishes list of bacteria for which new antibiotics are urgently needed. (2017).

  24. Centers for Disease Control and Prevention. Antibiotic resistance threats in the United States, 2019. (2019).

  25. Zhang, H. et al. An empirical framework for domain generalization in clinical settings. In CHIL '21: Proceedings of the Conference on Health, Inference, and Learning 279–290 (Association for Computing Machinery, 2021)

  26. Bevan, E. R., Jones, A. M. & Hawkey, P. M. Global epidemiology of CTX-M β-lactamases: temporal and geographical shifts in genotype. J. Antimicrob. Chemother. 72, 2145–2155 (2017).

    Article  CAS  PubMed  Google Scholar 

  27. Pietsch, M. et al. Molecular characterisation of extended-spectrum β-lactamase (ESBL)-producing Escherichia coli isolates from hospital and ambulatory patients in Germany. Vet. Microbiol. 200, 130–137 (2017).

    Article  CAS  PubMed  Google Scholar 

  28. Kim, Y.-K. et al. Bloodstream infections by extended-spectrum beta-lactamase-producing Escherichia coli and Klebsiella pneumoniae in children: epidemiology and clinical outcome. Antimicrob. Agents Chemother. 46, 1481–1491 (2002).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  29. Potron, A., Poirel, L., Rondinaud, E. & Nordmann, P. Intercontinental spread of OXA-48 beta-lactamase-producing Enterobacteriaceae over a 11-year period, 2001 to 2011. Euro Surveill. 18, 20549 (2013).

    Article  PubMed  Google Scholar 

  30. Pereira, L. A., Harnett, G. B., Hodge, M. M., Cattell, J. A. & Speers, D. J. Real-time PCR assay for detection of blaZ genes in Staphylococcus aureus clinical isolates. J. Clin. Microbiol. 52, 1259–1261 (2014).

    Article  PubMed  PubMed Central  Google Scholar 

  31. Long, S. W. et al. PBP2a mutations causing high-level Ceftaroline resistance in clinical methicillin-resistant Staphylococcus aureus isolates. Antimicrob. Agents Chemother. 58, 6668–6674 (2014).

    Article  PubMed  PubMed Central  Google Scholar 

  32. Shapley, L. S. 17. A value for n-person games. In Contributions to the Theory of Games (AM-28), Vol. II (eds Kuhn, H. W. & Tucker, A. W.) 307–318 (Princeton University Press, 1953)

  33. Cuénod, A., Foucault, F., Pflüger, V. & Egli, A. Factors associated with MALDI-TOF mass spectral quality of species identification in clinical routine diagnostics. Front. Cell. Infect. Microbiol. 11, 646648 (2021).

    Article  PubMed  PubMed Central  Google Scholar 

  34. Camoez, M. et al. Automated categorization of methicillin-resistant Staphylococcus aureus clinical isolates into different clonal complexes by MALDI-TOF mass spectrometry. Clin. Microbiol. Infect. 22, 161.e1–161.e7 (2016).

    Article  CAS  Google Scholar 

  35. Josten, M. et al. Identification of agr-positive methicillin-resistant Staphylococcus aureus harbouring the class A mec complex by MALDI-TOF mass spectrometry. Int. J. Med. Microbiol. 304, 1018–1023 (2014).

    Article  CAS  PubMed  Google Scholar 

  36. Josten, M. et al. Analysis of the matrix-assisted laser desorption ionization–time of flight mass spectrum of Staphylococcus aureus identifies mutations that allow differentiation of the main clonal lineages. J. Clin. Microbiol. 51, 1809–1817 (2013).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  37. Østergaard, C., Hansen, S. G. K. & Møller, J. K. Rapid first-line discrimination of methicillin resistant Staphylococcus aureus strains using MALDI-TOF MS. Int. J. Med. Microbiol. 305, 838–847 (2015).

    Article  PubMed  Google Scholar 

  38. Rhoads, D. D., Wang, H., Karichu, J. & Richter, S. S. The presence of a single MALDI-TOF mass spectral peak predicts methicillin resistance in staphylococci. Diagn. Microbiol. Infect. Dis. 86, 257–261 (2016).

    Article  CAS  PubMed  Google Scholar 

  39. Sauget, M., van der Mee-Marquet, N., Bertrand, X. & Hocquet, D. Matrix-assisted laser desorption ionization–time of flight mass spectrometry can detect Staphylococcus aureus clonal complex 398. J. Microbiol. Methods 127, 20–23 (2016).

    Article  PubMed  Google Scholar 

  40. Sogawa, K. et al. Use of the MALDI BioTyper system with MALDI–TOF mass spectrometry for rapid identification of microorganisms. Anal. Bioanal. Chem. 400, 1905–1911 (2011).

    Article  CAS  PubMed  Google Scholar 

  41. Wolters, M. et al. MALDI-TOF MS fingerprinting allows for discrimination of major methicillin-resistant Staphylococcus aureus lineages. Int. J. Med. Microbiol. 301, 64–68 (2011).

    Article  CAS  PubMed  Google Scholar 

  42. Zhang, T. et al. Analysis of methicillin-resistant Staphylococcus aureus major clonal lineages by matrix-assisted laser desorption ionization–time of flight mass spectrometry (MALDI–TOF MS). J. Microbiol. Methods 117, 122–127 (2015).

    Article  CAS  PubMed  Google Scholar 

  43. Chatterjee, S. S. et al. Distribution and regulation of the mobile genetic element-encoded phenol-soluble modulin PSM-mec in methicillin-resistant Staphylococcus aureus. PLoS ONE 6, e28781 (2011).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  44. Hu, Y., Huang, Y., Lizou, Y., Li, J. & Zhang, R. Evaluation of Staphylococcus aureus subtyping module for methicillin-resistant Staphylococcus aureus detection based on matrix-assisted laser desorption ionization time-of-flight mass spectrometry. Front. Microbiol. 10, 2504 (2019).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  45. Ludden, C. et al. Genomic surveillance of Escherichia coli ST131 identifies local expansion and serial replacement of subclones. Microb. Genom. 6, e000352 (2020).

    PubMed Central  Google Scholar 

  46. Nakamura, A. et al. Identification of specific protein amino acid substitutions of extended-spectrum β-lactamase (ESBL)-producing Escherichia coli ST131: a proteomics approach using mass spectrometry. Sci. Rep. 9, 8555 (2019).

    Article  PubMed  PubMed Central  Google Scholar 

  47. Lafolie, J., Sauget, M., Cabrolier, N., Hocquet, D. & Bertrand, X. Detection of Escherichia coli sequence type 131 by matrix-assisted laser desorption ionization time-of-flight mass spectrometry: implications for infection control policies? J. Hosp. Infect. 90, 208–212 (2015).

    Article  CAS  PubMed  Google Scholar 

  48. Oberle, M. et al. The technical and biological reproducibility of matrix-assisted laser desorption ionization–time of flight mass spectrometry (MALDI-TOF MS) based typing: employment of bioinformatics in a multicenter study. PLoS ONE 11, e0164260 (2016).

    Article  PubMed  PubMed Central  Google Scholar 

  49. UniProt. Beta-lactam-inducible penicillin-binding protein.

  50. UniProt. Beta-lactamase OXA-1.

  51. UniProt. Beta-lactamase TEM.

  52. UniProt. Beta-lactamase SHV-24.

  53. UniProt. Beta-lactamase CTX-M-1.

  54. UniProt. ompC: outer membrane porin C.

  55. Pickens, C. et al. A multiplex polymerase chain reaction assay for antibiotic stewardship in suspected pneumonia. Diagn. Microbiol. Infect. Dis. 98, 115179 (2020).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  56. European Committee on Antimicrobial Susceptibility Testing (EUCAST), European Society of Clinical Microbiology and Diseases. Clinical Breakpoints and Dosing of Antibiotics (2021).

  57. Schmidt, A. et al. The quantitative and condition-dependent Escherichia coli proteome. Nat. Biotechnol. 34, 104–110 (2016).

    Article  CAS  PubMed  Google Scholar 

  58. Gibb, S. & Strimmer, K. MALDIquant: a versatile R package for the analysis of mass spectrometry data. Bioinformatics 28, 2270–2271 (2012).

    Article  CAS  PubMed  Google Scholar 

  59. Ke, G. et al. LightGBM: a highly efficient gradient boosting decision tree. In Advances in Neural Information Processing Systems 30 (eds Guyon, I. et al.) 3146–3154 (Curran Associates, Inc., 2017).

  60. Pedregosa, F. et al. Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011).

    Google Scholar 

Download references


The authors thank O. Grüninger, J. Reist, Y. Mahiddine, D. Lang, C. Straub and M. Schneider for excellent technical assistance in accessing the mass spectra and antimicrobial resistance data at the University Hospital Basel; and B. Rodríguez-Sánchez (Hospital General Universitario Gregorio Marañón, Madrid, Spain), H. Seth-Smith (University Hospital Basel), C. Kaufmann (University Hospital Basel), and V. Pflüger (MabritecAG, Riehen, Switzerland) for valuable advice, technical consultation and feedback throughout the project. The authors also thank X. He (ETH Zurich) for fruitful discussions, and D. Chen (ETH Zurich) and Jacques Schrenzel (Geneva University Hospitals) for assistance with the manuscript and for providing valuable feedback. This study was supported by the Alfried Krupp Prize for Young University Teachers of the Alfried Krupp von Bohlen und Halbach-Stiftung (K.B.), by the two Cantons of Basel through a D-BSSE-Uni-Basel Personalised Medicine grant from the ETH Zurich (PMB-03-17, K.B. and A.E.) and a Doc.Mobility fellowship (A.C.) by the Swiss National Science Foundation (P1BSP3-184342). This study received ethics approval through the local ethics review board (EKNZ number: IEC 2019-00729, 2019-01860 and 2019-00748).

Author information

Authors and Affiliations



C.W., B.R. and K.B. designed the machine learning experiments; C.W. and B.R. implemented all experiments of the machine learning analysis; A.E., A.C. and K.K.S. organized data collection; A.C., S.G., O.D., C.L. and M.O. extracted clinical data; A.C. and M.O. performed the retrospective clinical case study; A.C. and C.W. implemented the preprocessing of the datasets DRIAMS-A and DRIAMS-B; C.W. implemented the preprocessing of the datasets DRIAMS-C and DRIAMS-D; M.B. contributed to mass spectrometry data interpretation; M.O. and A.E. provided feedback on the clinical implications of resistance predictions; C.W., B.R. and A.C. designed all display items; C.W., B.R., A.C., K.B. and A.E. wrote the manuscript with the assistance and feedback of all of the co-authors. K.B. and A.E. conceived and supervised the study.

Corresponding authors

Correspondence to Caroline Weis, Karsten Borgwardt or Adrian Egli.

Ethics declarations

Competing interests

The authors declare no competing interests.

Peer review information

Nature Medicine thanks Roman Yelensky and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Alison Farrell was the primary editor on this article and managed its editorial process and peer review in collaboration with the rest of the editorial team.

Additional information

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Extended data

Extended Data Fig. 1 Comparison turnaround times between MALDI-TOF MS and resistance.

Time from the entry of a patient sample at the diagnostic laboratory at the DRIAMS-A collection site to species identification by MALDI-TOF MS and phenotypic resistance testing for three clinically relevant species: E. coli (n = 54), K. pneumoniae (n = 66), and S. aureus (n = 57). Boxplot shows median and interquartile time ranges in hours, whiskers indicate adjacent values.

Extended Data Fig. 2 Improved antimicrobial resistance prediction based on MALDI-TOF mass spectra combining all species compared to species information alone.

AUROC values of logistic regression classifiers trained on data combining all samples with labels available for each antimicrobial prediction task in DRIAMS-A. The blue bars depict predictive performance using spectral data as features. The red bars show the predictive performance when using species label information only. The fractions of resistant/intermediate samples in the training data are indicated in brackets after the antibiotic name. Reported metrics and error bars are the mean and standard deviation of 10 repetitions with different random train–test-splits. The asterisks indicate a statistically significant difference between the reported metrics between all species and species information alone of a two-sided Welch’s t-test (not assuming equal population variance) and a significance level of <0.05.

Extended Data Fig. 3 Flowchart inclusion of cases into the retrospective clinical study.

We reviewed 416 clinical cases which had a severe bacterial infection with K. pneumoniae, E. coli or S. aureus between April and August 2018. Cases were excluded if (i) cases were treated external to the DRIAMS-A collection site, (ii) no consultation note by a infectious diseases specialist was available within 5 days (for cases with a positive blood culture) or 1 day (for cases with a positive deep tissue sample), (iii) the general research consent was rejected, (iv) the species identified by the Bruker database did not match the species in the laboratory report, (v) the antibiotic resistance profile was already present at the at the time of the infectious diseases consultation and (vi) if the consultation note was written without the knowledge of the species identity. 63 clinical cases were included.

Extended Data Fig. 4 Barplot of feature importances of LightGBM and MLP model.

Importance values larger than two times absolute standard deviation are colored in either blue (LightGBM) or orange (MLP). The sign of each feature importance value of the MLP model indicates the association with the positive (positive sign) or negative class. The LightGBM values indicate the contribution to the prediction without direction of association. All three models indicate that a large number of features are relevant for an accurate antimicrobial resistance prediction. The scenario abbreviations follow Fig. 2a.

Extended Data Fig. 5 Temporal validation including sample size of training window.

The timepoints correspond to points in Fig. 4 and arrow directions indicate time progression. With time progression both the trends in sample size per 8-month time window and the predictive performance increase. The scenario abbreviations follow Fig. 2a.

Supplementary information

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Weis, C., Cuénod, A., Rieck, B. et al. Direct antimicrobial resistance prediction from clinical MALDI-TOF mass spectra using machine learning. Nat Med 28, 164–174 (2022).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing