Moving average and standard deviation thresholding (MAST): a novel algorithm for accurate R-wave detection in the murine electrocardiogram

J Comp Physiol B. 2021 Nov;191(6):1071-1083. doi: 10.1007/s00360-021-01389-3. Epub 2021 Jul 25.


Advances in implantable radio-telemetry or diverse biologging devices capable of acquiring high-resolution ambulatory electrocardiogram (ECG) or heart rate recordings facilitate comparative physiological investigations by enabling detailed analysis of cardiopulmonary phenotypes and responses in vivo. Two priorities guiding the meaningful adoption of such technologies are: (1) automation, to streamline and standardize large dataset analysis, and (2) flexibility in quality-control. The latter is especially relevant when considering the tendency of some fully automated software solutions to significantly underestimate heart rate when raw signals contain high-amplitude noise. We present herein moving average and standard deviation thresholding (MAST), a novel, open-access algorithm developed to perform automated, accurate, and noise-robust single-channel R-wave detection from ECG obtained in chronically instrumented mice. MAST additionally and automatically excludes and annotates segments where R-wave detection is not possible due to artefact levels exceeding signal levels. Customizable settings (e.g. window width of moving average) allow for MAST to be scaled for use in non-murine species. Two expert reviewers compared MAST's performance (true/false positive and false negative detections) with that of a commercial ECG analysis program. Both approaches were applied blindly to the same random selection of 270 3-min ECG recordings from a dataset containing varying amounts of signal artefact. MAST exhibited roughly one quarter the error rate of the commercial software and accurately detected R-waves with greater consistency and virtually no false positives (sensitivity, Se: 98.48% ± 4.32% vs. 94.59% ± 17.52%, positive predictivity, +P: 99.99% ± 0.06% vs. 99.57% ± 3.91%, P < 0.001 and P = 0.0274 respectively, Wilcoxon signed rank; values are mean ± SD). Our novel, open-access approach for automated single-channel R-wave detection enables investigators to study murine heart rate indices with greater accuracy and less effort. It also provides a foundational code for translation to other mammals, ectothermic vertebrates, and birds.

Keywords: Autonomic nervous system; Comparative physiology; ECG; Methodology.

Publication types

  • Research Support, Non-U.S. Gov't

MeSH terms

  • Algorithms
  • Animals
  • Electrocardiography*
  • Heart
  • Heart Rate
  • Mice
  • Signal Processing, Computer-Assisted*