Automated rodent sleep spindle detector: MATLAB app using two complementary search algorithms | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Article Automated rodent sleep spindle detector: MATLAB app using two complementary search algorithms Kevin Scott Holly, Teresa Ann Murray, Allison C. Kumler, Pragya Dhungel, and 6 more This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-3523866/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract A Rodent Sleep Spindle Detector (RSSD) application (app) was developed to assist researchers working with high volume studies examining the impact of sleep on neurological function. Our RSSD is a MATLAB-based software program with a user interface that automatically identifies sleep spindles from intracranial EEG (iEEG) recordings of rodents using two novel yet complementary algorithmic approaches, a primary and secondary one. To validate the program, 6,000 copies of real spindles of 5 different types, ranging from 11–17 Hz with a duration of at least 0.3 seconds, were randomly placed within a noisy simulated prefrontal cortex iEEG signal of 50,000 seconds in duration. When compared to the ground truth on a datapoint-by-datapoint basis (individual spindle detection), the program had an accuracy of 98.40 ± 5.62% (mean ± SD) with 95% C.I. [91.93, 100] and 96.90 ± 4.34% (mean ± SD) with 95% C.I. [91.91, 100] for the primary and secondary algorithmic approach, respectively. Evaluating total spindle count, the program had an accuracy of 93.68 ± 13.66% (mean ± SD) with 95% C.I. [81.71, 100], and of 99.85 ± 0.12% (mean ± SD) with 95% C.I. [99.71, 99.96] for the primary and secondary algorithmic approach, respectively. The robustness of the sleep spindle detection was further validated for a range of spindle's duration, amplitude, and frequency by embedding in the iEEG signal respective artificial spindles. Finally, the RSSD app further improves its performance by first processing available video recordings of rodents to identify periods of quiescence and then running the sleep spindle detection algorithms on the iEEG only for those periods. Biological sciences/Biological techniques Biological sciences/Neuroscience Health sciences/Biomarkers Physical sciences/Engineering Physical sciences/Mathematics and computing Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Introduction Sleep spindles are waxing and waning waveforms generated by thalamocortical circuits and present in scalp recorded electroencephalography (EEG) recordings. In humans, sleep spindles occur in 0.5-3 s bursts with frequency of 11–17 Hz during the non-rapid eye movement (NREM) stage of sleep[ 1 ][ 2 ] [ 3 ]. In human studies, sleep spindles have been associated with sleep maintenance [ 4 ], learning, and memory [ 5 ]. Changes in sleep spindles have been noted in some neurological and psychiatric disorders [ 6 ], such as epilepsy and schizophrenia[ 7 ] [ 8 ]. In rodents, there is no single accepted frequency range for sleep spindles, nor are they known to occur during a defined stage of sleep. While there are differences in sleep architecture between rodents and humans, the shared similarities make rodent models valuable for investigating sleep spindles. Similarities include slow frontal and fast posterior spindles similar to those in humans[ 9 , 10 ] Mice, like humans, have also displayed distinct electrophysiological sleep staging activity during NREM sleep [ 11 ]. Furthermore, rats exhibit common characteristics with humans, such as an increase in spindle density in response to exposure to new information (memory consolidation) [ 12 ]. They also demonstrate enhanced spindle activity with the administration of benzodiazepines and barbiturates [ 13 ]. Moreover, the temporal correlation between rodent spindles and hippocampal ripples, which are high-frequency oscillations crucial for memory consolidation and information processing, has made rats the most extensively studied mammals in neuroscience, providing valuable insights into the intricate interplay between brain regions and their contributions to cognitive functions [ 14 ]. Rodent models are suitable for, and thus widely employed, in neuroscience research [ 14 ]. They offer unique advantages for studying conditions that are challenging or near impossible to investigate using human models. For instance, rodents can be easily induced with conditions like epilepsy and traumatic brain injury, allowing researchers to explore these conditions in a controlled manner. This circumvents ethical concerns associated with inducing such conditions in human subjects. Additionally, rodents enable long-term, continuous recording of iEEG signals, providing valuable insights. Subsequently, rodents can be euthanized for high-resolution imaging, further enhancing the understanding of neural processes [ 15 ]. Detecting and analyzing sleep spindles becomes crucial for understanding their role in sleep, cognition, and pathology. Reliable methods for quantifying sleep spindles are essential for advancing knowledge and improving diagnosis and treatment of sleep-related and neurological disorders. Efforts have been made to develop automatic spindle detection software for humans [ 16 ][ 17 ]. Methods used include filtering techniques, wavelet transform [ 17 ], non-linear signal decomposition, multichannel transient separation algorithms [ 18 ], and machine learning [ 19 ]. Each method comes with its own benefits and drawbacks. For example, filtering techniques are typically used to remove noise components. Butterworth and Chebyshev bandpass and lowpass filters are the most used filters for processing EEG signals. If a Butterworth filter is utilized, the window size selection is important to prevent erroneous detection of short, spike-like artifacts [ 20 ]. In wavelet approaches, the choice of wavelet function affects the performance of the algorithm [ 17 ] [ 21 ]. Applications using signal processing approaches have faced challenges in distinguishing between sleep spindles and K-complexes [ 19 ]. Given these drawbacks, some researchers have turned to machine learning approaches to improve the accuracy of spindle and K-complex detection. However, a challenge in using machine learning is the imbalanced sample size between spindle and non-spindle periods [ 19 ]. For deep learning, all the different types of spindles would need to be captured to effectively train the neural network [ 22 ][ 23 ]. In the past, the study of sleep spindles required manual identification by highly skilled professionals which is time consuming, tedious, and prone to human errors and bias [ 24 ]. While automatic sleep detection software has been deployed to assist in human studies, they are not available for rodents. It is impractical to use automatic sleep spindle detection algorithms developed for humans as rodent sleep spindles differ slightly in frequency from that of humans and rodents do not exhibit the full range of defined sleep stages seen in humans [ 15 ]. As rodent models enable mechanistic studies of the role of spindles in normal and pathological function, and are increasingly studied in large numbers, we developed a freely available, open-source Rodent Sleep Spindle Detector (RSSD) program, which is specifically optimized to robustly detect sleep spindles from rodent iEEG recordings. Results Sleep Spindle Detection Accuracy RSSD incorporates two novel and complementary detection techniques to locate sleep spindles based on their frequency and envelope shape. The primary method focuses on identifying peaks in the absolute value of the oscillatory component, which serves as the envelope for the potential spindle (see Figs. 1 & 2 ). The secondary method assesses the shape of the potential spindle by segregating the peaks and valleys, effectively separating the negative and positive envelopes. Then a second-degree polynomial fit is applied to each envelope to confirm a spindle shape. To validate the spindle identification algorithms, we employed a simulated signal that contained real spindles extracted from raw rodent iEEG signals. These spindles were randomly inserted into a noisy rodent iEEG signal devoid of any intrinsic spindles (See methods for detail description of algorithms.) A macro analysis (the total number of spindles detected in the recording) and a micro analysis (detecting spindles on a datapoint-by-datapoint basis) was conducted. In the macro analysis, utilizing the primary method, the sleep spindle detection program had a macro accuracy of 93.68 ± 13.66% (mean ± SD) with 95% C.I.(81.71, 100) when detecting 6,000 randomly placed real spindles of 5 different types within a noisy simulated signal with a duration of 50,000 seconds. The secondary method had a macro accuracy of 99.85 ± 0.12% (mean ± SD) with 95% C.I.(99.71, 99.99) upon detection of sleep spindles across the same dataset. In the macro analysis, neither method had false positives. In the micro analysis, the primary method had a micro accuracy of 98.41 ± 0.24% (mean ± SD) with 95% C.I.(98.19,98.62) when detecting the 6,000 randomly placed real spindles of 5 different variations within a noisy simulated signal with a duration of 50,000 seconds (see Supplementary Table 2). The secondary method had a micro accuracy of 96.90 ± 0.46% (mean ± SD) with 95% C.I.(96.50,97.31) across the same dataset. In addition to accuracy, Supplementary Table 2 also shows the sensitivity, specificity, Matthew correlation coefficient (MCC), and the F-score for both the primary and secondary methods. Detection of Diverse Sleep Spindles To ensure our program can detect variations of spindles, the percentage of spindles detected in simulated signals with 1200 randomly placed artificial spindles amongst a noisy simulated signal with a duration of 10,000 seconds for each variation of frequency, amplitude, and duration was calculated, as shown in Figs. 3 a-c. The detection of sleep spindles is lower for the primary method at 11 Hz, which is at the cut-off frequency of the 11–17 Hz bandpass filter used within the algorithm (Fig. 3 a). The percentage of spindles detected drops when their amplitude becomes smaller for both methods (Fig. 3 b). This is expected because the noise would start to mask the spindle signal when the amplitude is lowered and the signal-to-noise ratio would decrease. Neither sleep spindle detection method was affected by the sleep spindle durations (Fig. 3 c). Sleep Spindle Duration Detection As shown in Fig. 3 d, the detected sleep spindle durations by either method were longer than the actual durations. These overestimations were proportional to the actual spindle durations. The secondary method had a larger overestimation of the durations than the primary method. Sleep Spindle Amplitude Detection The detected amplitude correlated with the actual amplitude of the simulated sleep spindles as shown in Figs. 3 e-g. The detected max, mean, and median amplitude values by either the primary or secondary methods were proportional to the actual amplitude values of the artificial spindles. However, the detected mean and median amplitude were lower using the secondary method in comparison to the primary method. This is caused by the larger overestimation of the spindle's duration by the secondary method. For the mean amplitude calculation, the data points with a value close to zero would be included. For the median amplitude calculation, the overestimation could be greater on one side of the spindle offsetting the median amplitude. Discussion Animal models, particularly those involving rodents, have been a preferred choice for neuroscience research, including sleep studies. Although several algorithms are available for automatic detection of human sleep spindles, similar tools for rodents are less common. This scarcity often leads to the use of labor-intensive manual detection methods, or the creation and validation of in-house programs, both of which are typically impractical for neuroscientists. Manual detection and counting of sleep spindles, the gold standard for analyzing sleep data, is prone to human bias and errors that often lead to high inter-rater variability, as well as being time-inefficient [ 25 ]. The load of manual analysis of sleep spindles in rodents is also high, especially in studies that require analysis of months of iEEG data for large cohorts of rodents. Various detection methods for sleep spindles have been developed over the years, each with its unique challenges. These include detection errors due to unintended effects of frequency filters (e.g. generation of oscillatory artifacts), the inability to distinguish between sleep spindles and k-complexes in signal processing (machine learning), and errors due to imbalanced spindle and non-spindle data points for machine learning [ 19 ]. RSSD is an open-source app that identifies sleep spindles in rodent iEEG recordings without most of the errors that can occur in other detection methods[ 20 ][ 17 ][ 21 ][ 26 ][ 22 ][ 23 ] and also provides an intuitive user interface. In RSSD, a Chebyshev filter was used to eliminate noise instead of the commonly used Butterworth filter, which often leads to the creation of artificial oscillations and subsequent false positives. A novel sleep spindle detection method that identifies peaks prevents the false detection of spindles due to the presence of k-complexes. Furthermore, the program avoids the need for large and diverse sets of annotated data for training, which is a common requirement in neural networks, and has no dependency on particular functions, like wavelets that are used by the wavelet method for spindle detection. The MATLAB-based RSSD offers an intuitive, user-friendly interface for all stages of the workflow, thus eliminating the need for specialized training. Users have the flexibility to define and fine-tune parameters according to their preference. RSSD also incorporates a built-in validation technique, ensuring accurate and reliable results. Users can conveniently track the detection process in terms of what is being detected, how it is being detected, and where it is being detected. In spindle detection from the iEEG, RSSD considers the shape of spindles, which helps distinguish between sleep spindles and non-spindles such as k-complexes. Two novel yet complementary detection techniques were employed in our program. The primary method finds peaks of the absolute value of the oscillatory component, which forms the potential spindle’s envelope (Fig. 1 ). It then counts the number of decreasing peaks to provide the length of the potential spindle. The secondary method evaluates the shape of the potential spindle by separating the odd and even peaks, which separates the negative and positive envelope of the potential spindle and applies second-degree polynomial fits to confirm the envelopes are in the shape of a spindle (Fig. 2 ). The secondary method, being more sensitive than the primary method, reduces the possibility of ignoring sleep spindles that are deformed due to noise or other factors. The RSSD approach provides the count of spindles in each epoch by both methods separately, so that one can verify if the sleep spindles detected by the secondary method are valid or not. In lieu of an electromyography (EMG) recording for detecting the movement of the rodents, RSSD performs motion detection from corresponding videos of the rodents to identify the quiescent periods of sleep, which can be used to discard detected spindles outside of these quiescent periods because the rat would be likely to be awake if it is moving. RSSD’s integrated video-based motion detector is a cost-effective alternative to EMG typically employed in rodent motion detection. Firstly, the RSSD video detection utility mitigates the health risks associated with implanting both iEEG and EMG electrodes in the rodent. Secondly, using fewer implants reduces stress on the animal, contributing to a more comfortable environment and, in turn, facilitating the collection of more meaningful and authentic data. Furthermore, this prevents unwanted artifacts from contaminating the iEEG and reduces the financial burden associated with procuring EMG sensors. A technique using real spindles extracted by a human reviewer from raw iEEG signals and artificial spindles created using Eq. 2 at various frequencies, amplitudes, and durations, was used to validate RSSD. After extraction, real spindles were added to a raw iEEG signal that lacked sleep spindles. Similarly, artificial spindles were also embedded in a raw iEEG recording without sleep spindles present. These signals were then analyzed at two levels: macro and micro. The macro level tested if the spindles can be accurately detected holistically (the total numbers of spindles detected in the recording), whereas the micro level tested the accuracy of detecting the spindles on a datapoint-by-datapoint basis, where each datapoint in the signal was examined to see if it belongs to a spindle. The macro analysis revealed that while both algorithmic approaches had zero false positives, the secondary method was more accurate in detecting the real spindles than the primary method. The secondary method was able to capture spindles that were missed by the primary method. However, the micro analysis showed that the secondary method overestimated the number of spindle datapoints. These results can be explained by the fact that the secondary method overestimates the duration of the sleep spindles, whereas the primary method sometimes underestimates the sleep spindles’ duration due to the valleys having a different amplitude than the peaks, which sometimes leads to discounting the spindles with small duration. This causes the secondary method to identify all the spindles on the macro level and to increase the accuracy by increasing the sensitivity of the detection. The micro level accuracy is lower in the secondary method because the specificity is lower as it falsely extends the duration of the spindles. The peaks of the absolute value of the oscillatory component of the potential spindles provides the envelope or shape of the spindle. In the secondary method, we employed a 2nd-degree polynomial equation to fit either the odd or even peaks of the candidate spindle. The coefficient of determination, \({R}^{2}\) , serves as a measure of how effectively the equation fits the spindle's envelope. In cases where the \({R}^{2}\) value did not meet a certain threshold the potential spindles were disregarded. Our program lets the user adjust the coefficient of determination threshold, which determines what spindles are counted or not. During our validation, we observed that the higher the threshold value, the lower the mean number of detected spindles, which agree with our expected results. The coefficient of determination threshold value of 0.7 was chosen after testing with threshold values of 0.5, 0.6, 0.7, and 0.8 (0.7 had the highest accuracy). Using artificial spindles with varied frequency, amplitude, and duration we were able to detect the range and effectiveness of the RSSD. For both primary and secondary approaches, there was a direct relationship between the percentage of spindles detected and amplitude of the spindles. No significant difference was observed between spindles detected and their duration. As in the real spindles, the secondary method was found, in some cases, to overestimate the duration of the spindle. The validation results from the simulated data not only demonstrate the effectiveness and robustness of RSSD but also highlight its potential to save researchers’ valuable time. By automating the process of counting spindles in the iEEG signal of a rodent, the program relieves the burden of manual analysis and reduces the biases and errors associated with human scorers. Moreover, the integration of real sleep spindles that were extract by a human reviewer into noise-saturated simulated signals provides a more reliable ground truth, surpassing the reliance on a consensus from fallible human observers. In addition to its accuracy, the RSSD offers an easy and rapid way to identify sleep spindles in rodents, eliminating the variability commonly associated with human observers and enhancing the consistency and objectivity of spindle detection. This automated approach holds immense potential to elucidate the relationship between spindles and deficits in function observed in rodent models of neurological disorders. Overall, the program's ability to streamline spindle analysis and provide reliable results has significant implications for advancing our understanding of sleep physiology and its implications in neurological research. Methods Animals Male Sprague-Dawley rats from Jackson Laboratories were employed in this study. Animals were housed in groups of 1–2 rats per cage before surgery and housed singly afterwards. The rats were maintained on a 12-hour day/night cycle with food provided ad libitum. Surgery and iEEG recording procedures were approved by the Louisiana Tech University Institutional Animal Care and Use Committee (IACUC) and were in accordance with the National Institute of Health Guide for the Care and Use of Laboratory Animals. Euthanasia was performed in accordance with the AVMA Guidelines on Euthanasia. Experiments complied with ARRIVE Guidelines. Surgery In compliance with an IACUC-approved protocol, rats were anesthetized using a combination of ketamine HCL and dexmedetomidine HCl delivered via intramuscular injection. Aseptic technique was used to clean, dry, and drill the skull. Electrodes were implanted bilaterally in the prefrontal cortex (channels 1 and 2), thalamus (channels 3 and 4), parietal cortex (channels 5 and 6), and the hippocampus (channels 7 and 8) [ 27 ]. Stainless steel anchor screws, including one anchor screw used as the reference (channel 9), and dental acrylic were used to secure the electrode implants and enclose the surgical site. Figure 4 displays the configuration of the eight electrodes and anchor screws in relation to bregma. The excess skin incision was closed using simple interrupted nylon sutures. Antibiotic ointment and topical powder were applied to the wound. Atipamezole was delivered via intramuscular injection to reverse the effects of the dexmedetomidine. After the surgery, rats were given at least 14 days to recover before performing any tests. Cardiac perfusion and histological analysis were performed to confirm the placement of the eight electrodes. iEEG Acquisition System In this research, data from male Sprague Dawley rats were recorded over time at Louisiana Tech University, Ruston, LA. Each rat was housed individually in a 9in x 9in x 13.5in acrylic chamber. iEEG was recorded using a Tucker-Davis Technologies (TDT’s) RZ5 BioAmp digital signal processor which features efficient communication and memory access. The commutator and length of the cable connected to the implanted electrodes allowed for free movement within the chamber. A subject interface (SI8) program was used to record iEEG from 8 rats at a time with a sampling rate of 2 kHz. The spindle detection program was developed and validated using iEEG data acquired from channel 1 (left prefrontal cortex). Sleep Spindle Analysis McSleep [ 18 ], a global and local human sleep spindle detection program, was modified to analyze iEEG recordings from adult Sprague Dawley rats using parameters shown in Supplementary Table 1. After normalizing the raw iEEG signal based on Eq. (1) for successive non-overlapping epochs, a transient separation algorithm was used to estimate the oscillatory component in the iEEG recording. The normalized oscillatory component was extracted by bandpass filtering the signal using a Chebyshev filter (11–17 Hz) instead of the original filter used in McSleep. The envelope of the absolute value of the normalized filtered oscillatory component (Fig. 5 ) was used to identify sleep spindles with a custom-made algorithm (see next section). \(\varvec{n}\varvec{o}\varvec{r}\varvec{m}\varvec{a}\varvec{l}\varvec{i}\varvec{z}\varvec{e}\varvec{d}=\frac{\varvec{r}\varvec{a}\varvec{w}-\varvec{m}\varvec{e}\varvec{d}\varvec{i}\varvec{a}\varvec{n}\left(\varvec{r}\varvec{a}\varvec{w}\right)}{\mathbf{max}\left(|\varvec{r}\varvec{a}\varvec{w}-\varvec{m}\varvec{e}\varvec{d}\varvec{i}\varvec{a}\varvec{n}\left(\varvec{r}\varvec{a}\varvec{w}\right)|\right)}\) Eq. (1) From Peak Envelope to Sleep Spindle The algorithm considered an amplitude threshold and the shape of the potential spindles when identifying the presence of sleep spindles (Fig. 5 ). The peaks of the absolute value of the normalized filtered oscillatory component were identified and used to form an envelope of the signal. At this stage, the subsequent analysis split into two different classification methods, which are the primary and secondary methods. The primary method considers all peaks and valleys of the normalized oscillatory component identified as local maxima in the envelope of the absolute value of the normalized oscillatory component (Figs. 1 & 5 ). The secondary method separates the peaks and valleys (positive and negative peaks) in the normalized oscillatory component that are identified as odd and even peaks in the envelope signal formed from the absolute value of the normalized oscillatory component, as shown in Fig. 2 . Then it follows the same process as the primary method separately for the odd and even components. For both primary and secondary classification methods, an algorithm was applied to each of the peaks of the envelope to identify the spindles highlighted in Fig. 5 . The algorithm was applied to the entire signal in the primary method (Fig. 1 a) and to both the odd and even signal components in the secondary method (Fig. 2 ). These signals were normalized based on their respective maximum value and peaks with an amplitude above 0.5 were identified within each signal. As shown in Fig. 1 b, the algorithm looks at the outward adjacent data points (see small black arrows) from each peak in incremental steps comparing the values. If the outwardly adjacent values are ever greater than the inward adjacent values, then those outward data points are not considered to be a part of the candidate spindle identified by the peak. A binary signal is derived with values of 1 when it constitutes part of an identified spindle. If the length of time associated with candidate spindle is too short (smaller than duration of a true spindle, which we consider less than 0.3 seconds or less than 5 oscillations), then all data points are not considered part of a spindle and are given a value of 0 in the derived binary signal. In the secondary classification method, the Curve Fitting Toolbox® of MATLAB was used to fit a second-degree polynomial to the suspected sleep spindles to verify the shape of its positive and negative envelope matches that of a spindle. As shown in Fig. 2 , curve fits were applied to both the odd (red) and even (green) peak data points. The coefficient of determination, \({R}^{2}\) , was used to estimate a threshold. If the coefficient of determination falls below \(\) 0.70 for either fit, the suspected sleep spindle was not considered to be a sleep spindle. This \({R}^{2}\) threshold can be changed by the user on the user interface of the app. Motion Detection In lieu of an EMG signal, to determine if a rodent is in a quiescent period, RSSD employs the video recordings of the rodent during the iEEG recording. Any detected candidate spindles outside the quiescent periods are not considered spindles. To detect motion, the current frame was compared to a frame a half of a second earlier. The difference between these two frames are converted to a binary image with a binary threshold of 0.8. If the number of pixels remaining is greater than the empirically-derived area threshold of 50, the rodent is considered to be moving. The binary and area thresholds can be adjusted via the slider in Fig. 6 . Tests were conducted to ensure that the video and iEEG recordings were in sync. Application’s User Interface The RSSD sleep spindle detection software comes with a multi-windowed user interface (UI) created with App Designer (Fig. 6 ). Using the Controller window, iEEG recordings and video files can be uploaded and analyzed. The visualization of the iEEG and video analysis is displayed in the app’s iEEG and Video windows, respectively. The iEEG Window displays the raw, filtered oscillatory component, and the “Find Peak” custom spindle detection algorithm of the iEEG channel chosen with a dropdown box. The video window (Fig. 6 , right) compares pixel movement to determine if the rodent is in a quiescent period. The user can navigate through the different epochs of the iEEG signal and the corresponding video via sliders found on the controller (Supplementary Figs. S1, S2). The window of the epoch and other signal processing parameters can be adjusted with the controller as well. Notes associated with the iEEG file being analyzed can be recorded by the user and the project can be saved along with all parameter settings and interface displays and later loaded (Supplementary Fig. S3). The loaded video file can be cropped down to a user-defined region of interest where the rodent is located. After the user analyzes the iEEG file, the Results window will appear. The Results window has three tabs: “Summary”, “Sleep Spindle Specifics”, and “Validation” (Supplementary Figs. S4-S6, respectively). The Summary tab provides the number and percentage of sleep spindles detected for each epoch as well as the mean and median duration of the detected spindles for both the primary and secondary classification methods. The Sleep Spindle Specifics tab shows the start and end times for each of the detected sleep spindles along with their maximum and median amplitude and duration. In the Validation tab, the user can compare their sleep spindle detection methods to a ground truth. The sensitivity, specificity, accuracy, Matthew’s correlation coefficient, and F-score are calculated for the primary and secondary classification methods. Validation and Statistical Methods After filtering the oscillatory component from a raw left prefrontal cortex iEEG recording, 5 different sleep spindles were manually identified by a human reviewer and extracted (see Fig. 7 ). Using a custom MATLAB live script (see MATLAB live script in Supplementary Data), 6,000 of these extracted sleep spindles were then randomly added throughout a raw iEEG recording from the left prefrontal cortex without any sleep spindles present to create 50,000 seconds (13 hours, 53 minutes, and 20 seconds) of simulated data for validation purposes. A secondary approach was also taken in which artificial sleep spindles were generated via amplitude modulation of a sinusoid by a quadratic function (Eq. (2) and Fig. 8 ) and embedded in the raw left prefrontal cortex iEEG recording using the same custom MATLAB live script as with the real spindles. \(-{A\bullet x}^{2}\bullet sin(b\bullet x)\) Eq. (2) Sixteen European Data Format (EDF) files of simulated data each with a duration of 10,000 seconds (2 hours, 46 minutes, and 40 seconds) were generated by adding 1200 randomly placed artificial sleep spindles at various frequencies, amplitudes, and durations to raw prefrontal cortex iEEG recordings of the rodents without any known sleep spindles present (see Supplementary Information). Each EDF file contained artificial spindles at a specific frequency, amplitude, and duration, so that the percentage of spindles detected could be evaluated for each parameter combination. The positions of these randomly placed sleep spindles were recorded to create a binary ground truth, where a value of 1 indicated the sleep spindle was present. The amplitude, frequency, and duration of the sleep spindles were manipulated to test the rigor of RSSD. The software’s detection of sleep spindles using primary and secondary classification methods was compared to the ground truth. The accuracy was evaluated at two levels: macro and micro. The macro level analysis determined if the spindles were accurately detected holistically, whereas the micro level tested the accuracy of detecting the spindles on a datapoint-by-datapoint basis. On the macro level, the accuracy was calculated by comparing the total number of sleep spindles detected by the program to the known number of sleep spindles. On the micro level, the accuracy, sensitivity, and specificity of RSSD were determined along with the F-score and MCC through a comparison of candidate spindles to the ground truth (the known locations of the inserted sleep spindles). MCC is commonly used to evaluate the performance of binary classifiers on imbalanced datasets, where one class is much less frequent than the other. The MCC can range from − 1 to 1, where 1 indicates perfect prediction, 0 indicates random prediction, and − 1 indicates total disagreement between prediction and observation[ 18 ] [ 28 ][ 29 ]. Binomial proportion confidence intervals for the accuracy, sensitivity, and specificity were calculated using normal approximation intervals (Wald interval) since the sample size (the total seconds of the iEEG evaluated) was greater than 30 and the proportions were not close to 0 or 1 [ 30 ]. Software Availability The most recent version of Rodent Sleep Spindle Detector can be found at GitHub ( https://github.com/mathworks/Rodent-Sleep-Spindle-Detector ) and MATLAB’s File Exchange ( https://www.mathworks.com/matlabcentral/fileexchange/??-Rodent Sleep Spindle Detector). The app is packaged into a single installation file which installs a standard, stand-alone executable file that does not require a MATLAB license. MATLAB (version R2021b or greater) along with the Signal Processing Toolbox™, Image Processing Toolbox™ and Curve Fitting Toolbox™ are required to edit the Rodent Sleep Spindle Detector. Programming comments are embedded within the MATLAB code for experienced programmers. Runtime The computing resources utilized for validation included an 11th Gen Intel® Core™ i7-1185G7 processor running at a base frequency of 3.00GHz. Using a laptop with a 64-bit, Windows 11 operating system and 32.0 GB of RAM (31.7 GB being usable), the runtime to analyze a 2 hr, 46 min, and 40 s iEEG recording was 1 hr and 4 min with the integrated video motion detection utility and 8 min without the utility. Declarations Acknowledgements This work was supported by the National Science Foundation (RII-2 FEC OIA1632891, “Probing and Understanding the Brain: Micro and Macro Dynamics of Seizure and Memory Networks – PI: L.I., Co-PIs: T.A.M. and L.L.P.), the National Institutes of Health (NS114723, PI: T.A.M.; A.C.K., S.V.), and the Herman A. (Dusty) Rhodes Eminent Scholar Chair, Louisiana Board of Regents to T.A.M. The funding agencies were not involved in the study design; in the collection, analysis, and interpretation of data; and in writing this report and the decision to submit it for publication. S.V. drew the diagram in Figure 4a. Author contributions K.S.H., T.A.M. and L.L.P. conceived the project and S.V., A.S.K. and J.M. helped to refine it. K.S.H. wrote the program, and A.C.K., P.D., and T.A.M. assisted with editing the program. L.I. ensured accuracy of signal analysis and graphic representations. S.V. and A.C.K. performed iEEG surgeries and acquired recordings. S.R. performed statistical analysis. All authors wrote and approved the manuscript. Competing interests The authors declare no competing interests. K.S.H. is employed by MathWorks Inc. Data availability Datasets and a video demonstrating the use of the user interface are available in a Figshare repository, https://doi.org/10.6084/m9.figshare.24452677 Additional information Supplementary tables and figures are available at [Scientific Reports editorial staff: please add link here]. Correspondence and requests for materials should be addressed to T.A.M. References Boutin, A. et al. Transient synchronization of hippocampo-striato-thalamo-cortical networks during sleep spindle oscillations induces motor memory consolidation. Neuroimage 169, (2018). Lazic, K., Ciric, J. & Saponjic, J. Sleep spindle dynamics during NREM and REM sleep following distinct general anaesthesia in control rats and in a rat model of Parkinson’s disease cholinopathy. J Sleep Res 28, (2019). Markovic, A., Kaess, M. & Tarokh, L. Gender differences in adolescent sleep neurophysiology: a high-density sleep EEG study. Sci Rep 10, (2020). Merikanto, I. et al. ADHD symptoms are associated with decreased activity of fast sleep spindles and poorer procedural overnight learning during adolescence. Neurobiol Learn Mem 157, (2019). Petzka, M., Chatburn, A., Charest, I., Balanos, G. M. & Staresina, B. P. Sleep spindles track cortical learning patterns for memory consolidation. Current Biology 32, (2022). Ang, G. et al. Absent sleep EEG spindle activity in GluA1 (Gria1) knockout mice: relevance to neuropsychiatric disorders. Transl Psychiatry 8, (2018). Castelnovo, A., D’Agostino, A., Casetta, C., Sarasso, S. & Ferrarelli, F. Sleep Spindle Deficit in Schizophrenia: Contextualization of Recent Findings. Current Psychiatry Reports vol. 18 Preprint at https://doi.org/10.1007/s11920-016-0713-2 (2016). Ferrarelli, F. & Tononi, G. Reduced sleep spindle activity point to a TRN-MD thalamus-PFC circuit dysfunction in schizophrenia. Schizophrenia Research vol. 180 Preprint at https://doi.org/10.1016/j.schres.2016.05.023 (2017). Terrier, G. & Gottesmann, C. Study of cortical spindles during sleep in the rat. Brain Res Bull 3, (1978). Iotchev, I. B. & Kubinyi, E. Shared and unique features of mammalian sleep spindles – insights from new and old animal models. Biological Reviews 96, (2021). Merten, J. E. et al. The use of rodent models to better characterize the relationship among epilepsy, sleep, and memory. Epilepsia 63, 525–536 (2022). Demanuele, C. et al. Coordination of slow waves with sleep spindles predicts sleep-dependent memory consolidation in schizophrenia. Sleep 40, (2017). van Luijtelaar, E. L. J. M., van der Grinten, C. P. M., Blokhuis, H. J. & Coenen, A. M. L. Sleep in the domestic hen (Gallus domesticus). Physiol Behav 41, (1987). Iotchev, I. B. & Kubinyi, E. Shared and unique features of mammalian sleep spindles – insights from new and old animal models. Biological Reviews 96, (2021). Merten, J. E. et al. The use of rodent models to better characterize the relationship among epilepsy, sleep, and memory. Epilepsia vol. 63 Preprint at https://doi.org/10.1111/epi.17161 (2022). Schimicek, P., Zeitlhofer, J., Anderer, P. & Saletu, B. Automatic Sleep-Spindle Detection Procedure: Aspects of Reliability and Validity. Clin EEG Neurosci 25, (1994). Adamczyk, M., Genzel, L., Dresler, M., Steiger, A. & Friess, E. Automatic sleep spindle detection and genetic influence estimation using continuous wavelet transform. Front Hum Neurosci 9, (2015). Parekh, A. et al. Multichannel sleep spindle detection using sparse low-rank optimization. J Neurosci Methods 288, (2017). Mei, N., Grossberg, M. D., Ng, K., Navarro, K. T. & Ellmore, T. M. Identifying sleep spindles with multichannel EEG and classification optimization. Comput Biol Med 89, (2017). Uygun, D. S. et al. Validation of an automated sleep spindle detection method for mouse electroencephalography. Sleep 42, (2019). Kinoshita, T. et al. Sleep Spindle Detection Using RUSBoost and Synchrosqueezed Wavelet Transform. IEEE Transactions on Neural Systems and Rehabilitation Engineering 28, (2020). Gong, Z., Zhong, P. & Hu, W. Diversity in Machine Learning. IEEE Access 7, (2019). Kulkarni, P. M. et al. A deep learning approach for real-time detection of sleep spindles. J Neural Eng 16, (2019). Wei, L. et al. Spindle-AI: Sleep Spindle Number and Duration Estimation in Infant EEG. IEEE Trans Biomed Eng 69, (2022). O’Reilly, C. & Nielsen, T. Automatic sleep spindle detection: Benchmarking with fine temporal resolution using open science tools. Front Hum Neurosci 9, (2015). Mei, N., Grossberg, M. D., Ng, K., Navarro, K. T. & Ellmore, T. M. Identifying sleep spindles with multichannel EEG and classification optimization. Comput Biol Med 89, (2017). Doughty, P. T. et al. Novel microwire-based biosensor probe for simultaneous real-time measurement of glutamate and GABA dynamics in vitro and in vivo. Sci Rep 10, (2020). Bekkar, M., Djemaa, H. K. & Alitouche, T. A. Evaluation Measures for Models Assessment over Imbalanced Data Sets. Journal of Information Engineering and Applications 3, (2013). Chicco, D., Tötsch, N. & Jurman, G. The matthews correlation coefficient (Mcc) is more reliable than balanced accuracy, bookmaker informedness, and markedness in two-class confusion matrix evaluation. BioData Min 14, (2021). Brown, L. D., Cai, T. T. & DasGupta, A. Interval estimation for a binomial proportion. Statistical science 101–117 (2001). Additional Declarations No competing interests reported. Supplementary Files SupplementaryInfoSleepSpindleDetectorrevsub.pdf Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-3523866","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Article","associatedPublications":[],"authors":[{"id":245808271,"identity":"d67fe63b-bf71-4673-943a-595fe879766c","order_by":0,"name":"Kevin Scott Holly","email":"","orcid":"","institution":"MathWorks (United States)","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Kevin","middleName":"Scott","lastName":"Holly","suffix":""},{"id":245808272,"identity":"3da89434-8efd-4a16-a284-98a07136101c","order_by":1,"name":"Teresa Ann Murray","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA+UlEQVRIiWNgGAWjYBACA2YwJQEmD3xsAFGMjQeI1cJ4cGYDiMXYgF8LEpv5MG8DRDNeLebszAcfF/yyyONn731w2HaHTZ1u+2GgLTU20bi0WDazJRvP7JMoluw5bnA490yahNmZRKCWY2m5DbgcdpjHTJq3RyJxw400hsO5bYclzA4AtTA2HManxfw3SMv++88YDluCtJx/SFCLGTPPD6AtEmwMhxlBWm4QsAXkF2neBonEGWfSGA72tqVJbrsBtCUBj1/M+Q8f/Mzzpy6xv/0Y84efbTb8ZufTHz74UGODUwsYMLahiyTgUw4GfwiqGAWjYBSMgpEMAMQmYkJuMrQSAAAAAElFTkSuQmCC","orcid":"","institution":"Louisiana Tech University","correspondingAuthor":true,"submittingAuthor":false,"prefix":"","firstName":"Teresa","middleName":"Ann","lastName":"Murray","suffix":""},{"id":245808273,"identity":"598ec5a6-848a-4bf9-96c7-47aeb1aa5343","order_by":2,"name":"Allison C. Kumler","email":"","orcid":"","institution":"Louisiana Tech University","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Allison","middleName":"C.","lastName":"Kumler","suffix":""},{"id":245808274,"identity":"2bd54f14-609e-4257-ba75-73077681dbed","order_by":3,"name":"Pragya Dhungel","email":"","orcid":"","institution":"Louisiana Tech University","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Pragya","middleName":"","lastName":"Dhungel","suffix":""},{"id":245808275,"identity":"b7572a6a-da07-4c1b-85d2-2ddcd5a66475","order_by":4,"name":"Sai Mohan Rudrashetty","email":"","orcid":"","institution":"Louisiana Tech University","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Sai","middleName":"Mohan","lastName":"Rudrashetty","suffix":""},{"id":245808276,"identity":"c6e6f6a4-cae6-4527-b4be-b81074c42e5c","order_by":5,"name":"Sadie Villarrubia","email":"","orcid":"","institution":"Louisiana Tech University","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Sadie","middleName":"","lastName":"Villarrubia","suffix":""},{"id":245808277,"identity":"6f603153-2d7b-469a-ae73-425145de3cd4","order_by":6,"name":"John E. Merten","email":"","orcid":"","institution":"University of Arkansas for Medical Sciences","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"John","middleName":"E.","lastName":"Merten","suffix":""},{"id":245808280,"identity":"254b3596-2518-4d2a-bd70-27c0e9e19b29","order_by":7,"name":"Aaron S. Kemp","email":"","orcid":"","institution":"University of Arkansas for Medical Sciences","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Aaron","middleName":"S.","lastName":"Kemp","suffix":""},{"id":245808282,"identity":"5b580c3f-ad58-42aa-9cde-9776b6d3a164","order_by":8,"name":"Leonidas Iasemidis","email":"","orcid":"","institution":"Barrow Neurological Institute","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Leonidas","middleName":"","lastName":"Iasemidis","suffix":""},{"id":245808284,"identity":"0764a04b-8bf4-44de-9a00-df0136f2c838","order_by":9,"name":"Linda Larson-Prior","email":"","orcid":"","institution":"University of Arkansas for Medical Sciences","correspondingAuthor":false,"submittingAuthor":false,"prefix":"","firstName":"Linda","middleName":"","lastName":"Larson-Prior","suffix":""}],"badges":[],"createdAt":"2023-10-31 11:29:31","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-3523866/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-3523866/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":46049783,"identity":"ed0a9ccf-e505-4337-a93d-04018884f2aa","added_by":"auto","created_at":"2023-11-07 23:43:16","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":1595881,"visible":true,"origin":"","legend":"\u003cp\u003eVisualization of spindle detection process utilizing a threshold-based peak identification and length determination. (a) Oscillatory component of signal showing the location of a potential spindle (shaded area). (b) The algorithm examines the outward data points from each peak, incrementally comparing their values. Any outwardly adjacent values greater than the inward adjacent values are not considered to be a part of the spindle identified by that peak. A binary signal is generated, with values of 1 at the time points that the identified spindle exists and 0 otherwise.\u003c/p\u003e","description":"","filename":"Figure1.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/24666e5eb359b941fe312252.png"},{"id":46049688,"identity":"f37c3838-3c96-489e-8278-459faba3f027","added_by":"auto","created_at":"2023-11-07 23:35:16","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":1521934,"visible":true,"origin":"","legend":"\u003cp\u003eThe secondary classification method applies a 2nd degree polynomial fit to the odd and even peaks of the absolute value of the normalized filtered oscillatory component of an iEEG recording. (a) Potential spindle in the normalized filtered oscillatory component that is being analyzed. (b) After taking the absolute value of the signal, peaks were detected and separated into odd (red) and even (green) data points. (c) A 2nd degree polynomial fit was then applied to each set of odd and even peaks. Potential spindles that had a coefficient of determination (R\u003csup\u003e2\u003c/sup\u003e) less than 0.70 in odd or even data point sets were discarded.\u003c/p\u003e","description":"","filename":"Figure2.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/765804f732ecb0f72647f699.png"},{"id":46049693,"identity":"868e4b0e-725e-4f3d-a1a7-9ff77ff60709","added_by":"auto","created_at":"2023-11-07 23:35:16","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":2446083,"visible":true,"origin":"","legend":"\u003cp\u003ePanels a, b, and c\u003cem\u003e \u003c/em\u003eshow the percentage of spindles (sensitivity) detected at the macro level. (a) Detection of artificial spindles at various frequencies using the primary (blue) and secondary (red) methods. The primary method was affected by frequency to a greater extent than the secondary method, with spindles being less likely to be detected near the cut-off frequencies of the Chebyshev bandpass filter. (b) Detection of randomly placed 1-second-long artificial 15 Hz spindles at various amplitudes using the primary (blue) and secondary (red) methods. The percentage of spindles detected drops as the amplitude becomes smaller for both methods. (c) Detection of randomly placed artificial 15 Hz spindles with an amplitude of 1 at various durations using the primary (blue) and secondary (red) methods. The ability to detect spindles was slightly lower for spindles with a duration of 0.3 seconds compared to those with a duration of at least 0.5 seconds for both methods. (d) The detected average duration ± standard deviation from 1200 randomly placed 15 Hz artificial spindles with an amplitude of 1 at durations of 0.3, 0.5, 0.6, and 1 second using the primary (blue) and secondary (red) methods. Panels e, f, and g show the detected maximum, mean, and median amplitudes ± standard deviation, respectively, from 1200 randomly placed 15 Hz artificial spindles with amplitudes of 0.25, 0.5, 1, and 2 using the primary (blue) and secondary (red) methods.\u003c/p\u003e","description":"","filename":"Figure3.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/055878d35204a0fcc89418cd.png"},{"id":46049785,"identity":"776a7e25-d2ef-4cdc-9a5c-be5fa3cd1a10","added_by":"auto","created_at":"2023-11-07 23:43:16","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":1468543,"visible":true,"origin":"","legend":"\u003cp\u003e(a) Electrode and anchor screw configuration in relation to bregma. (b) Rat with iEEG implant.\u003c/p\u003e","description":"","filename":"Figure4.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/90f6f63707b10e202813d776.png"},{"id":46049784,"identity":"314e8bad-0550-4f25-8478-b444e03f0776","added_by":"auto","created_at":"2023-11-07 23:43:16","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":2113194,"visible":true,"origin":"","legend":"\u003cp\u003eAnalysis of iEEG Signal for Sleep Spindle Identification. (a) Raw iEEG signal representation over a 6-second period. (b) The oscillatory component by filtering the raw iEEG signal shown in (A). (c) Identification of sleep spindles using a custom algorithm based on the envelope of the absolute value of the normalized oscillatory component. The sleep spindles that were identified are highlighted in the plot (shaded time segments in blue and grey identified by the primary and secondary approach, respectively).\u003c/p\u003e","description":"","filename":"Figure5.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/8e9c16eb99d9ea5339ecaff9.png"},{"id":46049686,"identity":"58d6c24c-2bfd-4b8f-bafe-8de65ba6a873","added_by":"auto","created_at":"2023-11-07 23:35:16","extension":"png","order_by":6,"title":"Figure 6","display":"","copyAsset":false,"role":"figure","size":542767,"visible":true,"origin":"","legend":"\u003cp\u003eThe user interface has an iEEG window (top left), a video window (top right) for monitoring awake and quiescent states, and a control window (bottom). Pink highlighted segment on iEEG recording denotes a period of quiescence.\u003c/p\u003e","description":"","filename":"Figure6.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/fb1ad68c17c89de18a8739bf.png"},{"id":46049691,"identity":"1aee7401-2579-40d6-ae3d-38b2208b2362","added_by":"auto","created_at":"2023-11-07 23:35:16","extension":"png","order_by":7,"title":"Figure 7","display":"","copyAsset":false,"role":"figure","size":699732,"visible":true,"origin":"","legend":"\u003cp\u003eReal sleep spindles that were extracted by a human reviewer from the filtered oscillatory component and randomly added throughout a raw iEEG recording.\u003c/p\u003e","description":"","filename":"Figure7.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/231235107249bc2fe9d818bf.png"},{"id":46049786,"identity":"64c3accc-f6cd-4f86-885b-869f40d384d2","added_by":"auto","created_at":"2023-11-07 23:43:16","extension":"png","order_by":8,"title":"Figure 8","display":"","copyAsset":false,"role":"figure","size":1542910,"visible":true,"origin":"","legend":"\u003cp\u003eSixteen artificially generated sleep spindles of different amplitude, frequency, and duration based on Equation 2.\u003c/p\u003e","description":"","filename":"Figure8.png","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/ac6d849c19045f60cf874f25.png"},{"id":53989985,"identity":"0f755d01-cb79-4422-b4fd-05db70d2eaf7","added_by":"auto","created_at":"2024-04-03 05:28:41","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":2645257,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/cdb04942-3ff1-40b4-ab68-070ed0896468.pdf"},{"id":46049692,"identity":"96ee204a-5542-4740-a254-c641e5b9ffbb","added_by":"auto","created_at":"2023-11-07 23:35:16","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"supplement","size":1217088,"visible":true,"origin":"","legend":"","description":"","filename":"SupplementaryInfoSleepSpindleDetectorrevsub.pdf","url":"https://assets-eu.researchsquare.com/files/rs-3523866/v1/d7bb50901222d3ad3fa71c36.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Automated rodent sleep spindle detector: MATLAB app using two complementary search algorithms","fulltext":[{"header":"Introduction","content":"\u003cp\u003eSleep spindles are waxing and waning waveforms generated by thalamocortical circuits and present in scalp recorded electroencephalography (EEG) recordings. In humans, sleep spindles occur in 0.5-3 s bursts with frequency of 11\u0026ndash;17 Hz during the non-rapid eye movement (NREM) stage of sleep[\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e][\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e] [\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e]. In human studies, sleep spindles have been associated with sleep maintenance [\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e], learning, and memory [\u003cspan citationid=\"CR5\" class=\"CitationRef\"\u003e5\u003c/span\u003e]. Changes in sleep spindles have been noted in some neurological and psychiatric disorders [\u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e], such as epilepsy and schizophrenia[\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e] [\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e]. In rodents, there is no single accepted frequency range for sleep spindles, nor are they known to occur during a defined stage of sleep. While there are differences in sleep architecture between rodents and humans, the shared similarities make rodent models valuable for investigating sleep spindles. Similarities include slow frontal and fast posterior spindles similar to those in humans[\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e, \u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e] Mice, like humans, have also displayed distinct electrophysiological sleep staging activity during NREM sleep [\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eFurthermore, rats exhibit common characteristics with humans, such as an increase in spindle density in response to exposure to new information (memory consolidation) [\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e]. They also demonstrate enhanced spindle activity with the administration of benzodiazepines and barbiturates [\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e]. Moreover, the temporal correlation between rodent spindles and hippocampal ripples, which are high-frequency oscillations crucial for memory consolidation and information processing, has made rats the most extensively studied mammals in neuroscience, providing valuable insights into the intricate interplay between brain regions and their contributions to cognitive functions [\u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eRodent models are suitable for, and thus widely employed, in neuroscience research [\u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e]. They offer unique advantages for studying conditions that are challenging or near impossible to investigate using human models. For instance, rodents can be easily induced with conditions like epilepsy and traumatic brain injury, allowing researchers to explore these conditions in a controlled manner. This circumvents ethical concerns associated with inducing such conditions in human subjects. Additionally, rodents enable long-term, continuous recording of iEEG signals, providing valuable insights. Subsequently, rodents can be euthanized for high-resolution imaging, further enhancing the understanding of neural processes [\u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e15\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eDetecting and analyzing sleep spindles becomes crucial for understanding their role in sleep, cognition, and pathology. Reliable methods for quantifying sleep spindles are essential for advancing knowledge and improving diagnosis and treatment of sleep-related and neurological disorders. Efforts have been made to develop automatic spindle detection software for humans [\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e][\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e]. Methods used include filtering techniques, wavelet transform [\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e], non-linear signal decomposition, multichannel transient separation algorithms [\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e], and machine learning [\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e]. Each method comes with its own benefits and drawbacks. For example, filtering techniques are typically used to remove noise components. Butterworth and Chebyshev bandpass and lowpass filters are the most used filters for processing EEG signals. If a Butterworth filter is utilized, the window size selection is important to prevent erroneous detection of short, spike-like artifacts [\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e]. In wavelet approaches, the choice of wavelet function affects the performance of the algorithm [\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e] [\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e]. Applications using signal processing approaches have faced challenges in distinguishing between sleep spindles and K-complexes [\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e]. Given these drawbacks, some researchers have turned to machine learning approaches to improve the accuracy of spindle and K-complex detection. However, a challenge in using machine learning is the imbalanced sample size between spindle and non-spindle periods [\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e]. For deep learning, all the different types of spindles would need to be captured to effectively train the neural network [\u003cspan citationid=\"CR22\" class=\"CitationRef\"\u003e22\u003c/span\u003e][\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eIn the past, the study of sleep spindles required manual identification by highly skilled professionals which is time consuming, tedious, and prone to human errors and bias [\u003cspan citationid=\"CR24\" class=\"CitationRef\"\u003e24\u003c/span\u003e]. While automatic sleep detection software has been deployed to assist in human studies, they are not available for rodents. It is impractical to use automatic sleep spindle detection algorithms developed for humans as rodent sleep spindles differ slightly in frequency from that of humans and rodents do not exhibit the full range of defined sleep stages seen in humans [\u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e15\u003c/span\u003e]. As rodent models enable mechanistic studies of the role of spindles in normal and pathological function, and are increasingly studied in large numbers, we developed a freely available, open-source Rodent Sleep Spindle Detector (RSSD) program, which is specifically optimized to robustly detect sleep spindles from rodent iEEG recordings.\u003c/p\u003e"},{"header":"Results","content":"\u003cp\u003eSleep Spindle Detection Accuracy\u003c/p\u003e \u003cp\u003eRSSD incorporates two novel and complementary detection techniques to locate sleep spindles based on their frequency and envelope shape. The primary method focuses on identifying peaks in the absolute value of the oscillatory component, which serves as the envelope for the potential spindle (see Figs.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e\u0026amp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e). The secondary method assesses the shape of the potential spindle by segregating the peaks and valleys, effectively separating the negative and positive envelopes. Then a second-degree polynomial fit is applied to each envelope to confirm a spindle shape.\u003c/p\u003e \u003cp\u003eTo validate the spindle identification algorithms, we employed a simulated signal that contained real spindles extracted from raw rodent iEEG signals. These spindles were randomly inserted into a noisy rodent iEEG signal devoid of any intrinsic spindles (See methods for detail description of algorithms.) A macro analysis (the total number of spindles detected in the recording) and a micro analysis (detecting spindles on a datapoint-by-datapoint basis) was conducted. In the macro analysis, utilizing the primary method, the sleep spindle detection program had a macro accuracy of 93.68\u0026thinsp;\u0026plusmn;\u0026thinsp;13.66% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I.(81.71, 100) when detecting 6,000 randomly placed real spindles of 5 different types within a noisy simulated signal with a duration of 50,000 seconds. The secondary method had a macro accuracy of 99.85\u0026thinsp;\u0026plusmn;\u0026thinsp;0.12% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I.(99.71, 99.99) upon detection of sleep spindles across the same dataset. In the macro analysis, neither method had false positives. In the micro analysis, the primary method had a micro accuracy of 98.41\u0026thinsp;\u0026plusmn;\u0026thinsp;0.24% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I.(98.19,98.62) when detecting the 6,000 randomly placed real spindles of 5 different variations within a noisy simulated signal with a duration of 50,000 seconds (see Supplementary Table\u0026nbsp;2). The secondary method had a micro accuracy of 96.90\u0026thinsp;\u0026plusmn;\u0026thinsp;0.46% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I.(96.50,97.31) across the same dataset. In addition to accuracy, Supplementary Table\u0026nbsp;2 also shows the sensitivity, specificity, Matthew correlation coefficient (MCC), and the F-score for both the primary and secondary methods.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eDetection of Diverse Sleep Spindles\u003c/p\u003e \u003cp\u003eTo ensure our program can detect variations of spindles, the percentage of spindles detected in simulated signals with 1200 randomly placed artificial spindles amongst a noisy simulated signal with a duration of 10,000 seconds for each variation of frequency, amplitude, and duration was calculated, as shown in Figs.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003ea-c. The detection of sleep spindles is lower for the primary method at 11 Hz, which is at the cut-off frequency of the 11\u0026ndash;17 Hz bandpass filter used within the algorithm (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003ea). The percentage of spindles detected drops when their amplitude becomes smaller for both methods (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003eb). This is expected because the noise would start to mask the spindle signal when the amplitude is lowered and the signal-to-noise ratio would decrease. Neither sleep spindle detection method was affected by the sleep spindle durations (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003ec).\u003c/p\u003e \u003cp\u003eSleep Spindle Duration Detection\u003c/p\u003e \u003cp\u003eAs shown in Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003ed, the detected sleep spindle durations by either method were longer than the actual durations. These overestimations were proportional to the actual spindle durations. The secondary method had a larger overestimation of the durations than the primary method.\u003c/p\u003e \u003cp\u003eSleep Spindle Amplitude Detection\u003c/p\u003e \u003cp\u003eThe detected amplitude correlated with the actual amplitude of the simulated sleep spindles as shown in Figs.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003ee-g. The detected max, mean, and median amplitude values by either the primary or secondary methods were proportional to the actual amplitude values of the artificial spindles. However, the detected mean and median amplitude were lower using the secondary method in comparison to the primary method. This is caused by the larger overestimation of the spindle's duration by the secondary method. For the mean amplitude calculation, the data points with a value close to zero would be included. For the median amplitude calculation, the overestimation could be greater on one side of the spindle offsetting the median amplitude.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e"},{"header":"Discussion","content":"\u003cp\u003eAnimal models, particularly those involving rodents, have been a preferred choice for neuroscience research, including sleep studies. Although several algorithms are available for automatic detection of human sleep spindles, similar tools for rodents are less common. This scarcity often leads to the use of labor-intensive manual detection methods, or the creation and validation of in-house programs, both of which are typically impractical for neuroscientists. Manual detection and counting of sleep spindles, the gold standard for analyzing sleep data, is prone to human bias and errors that often lead to high inter-rater variability, as well as being time-inefficient [\u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e]. The load of manual analysis of sleep spindles in rodents is also high, especially in studies that require analysis of months of iEEG data for large cohorts of rodents.\u003c/p\u003e \u003cp\u003eVarious detection methods for sleep spindles have been developed over the years, each with its unique challenges. These include detection errors due to unintended effects of frequency filters (e.g. generation of oscillatory artifacts), the inability to distinguish between sleep spindles and k-complexes in signal processing (machine learning), and errors due to imbalanced spindle and non-spindle data points for machine learning [\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eRSSD is an open-source app that identifies sleep spindles in rodent iEEG recordings without most of the errors that can occur in other detection methods[\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e][\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e][\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e][\u003cspan citationid=\"CR26\" class=\"CitationRef\"\u003e26\u003c/span\u003e][\u003cspan citationid=\"CR22\" class=\"CitationRef\"\u003e22\u003c/span\u003e][\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e] and also provides an intuitive user interface. In RSSD, a Chebyshev filter was used to eliminate noise instead of the commonly used Butterworth filter, which often leads to the creation of artificial oscillations and subsequent false positives. A novel sleep spindle detection method that identifies peaks prevents the false detection of spindles due to the presence of k-complexes. Furthermore, the program avoids the need for large and diverse sets of annotated data for training, which is a common requirement in neural networks, and has no dependency on particular functions, like wavelets that are used by the wavelet method for spindle detection.\u003c/p\u003e \u003cp\u003eThe MATLAB-based RSSD offers an intuitive, user-friendly interface for all stages of the workflow, thus eliminating the need for specialized training. Users have the flexibility to define and fine-tune parameters according to their preference. RSSD also incorporates a built-in validation technique, ensuring accurate and reliable results. Users can conveniently track the detection process in terms of what is being detected, how it is being detected, and where it is being detected.\u003c/p\u003e \u003cp\u003eIn spindle detection from the iEEG, RSSD considers the shape of spindles, which helps distinguish between sleep spindles and non-spindles such as k-complexes. Two novel yet complementary detection techniques were employed in our program. The primary method finds peaks of the absolute value of the oscillatory component, which forms the potential spindle\u0026rsquo;s envelope (Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e). It then counts the number of decreasing peaks to provide the length of the potential spindle. The secondary method evaluates the shape of the potential spindle by separating the odd and even peaks, which separates the negative and positive envelope of the potential spindle and applies second-degree polynomial fits to confirm the envelopes are in the shape of a spindle (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e). The secondary method, being more sensitive than the primary method, reduces the possibility of ignoring sleep spindles that are deformed due to noise or other factors. The RSSD approach provides the count of spindles in each epoch by both methods separately, so that one can verify if the sleep spindles detected by the secondary method are valid or not. In lieu of an electromyography (EMG) recording for detecting the movement of the rodents, RSSD performs motion detection from corresponding videos of the rodents to identify the quiescent periods of sleep, which can be used to discard detected spindles outside of these quiescent periods because the rat would be likely to be awake if it is moving.\u003c/p\u003e \u003cp\u003eRSSD\u0026rsquo;s integrated video-based motion detector is a cost-effective alternative to EMG typically employed in rodent motion detection. Firstly, the RSSD video detection utility mitigates the health risks associated with implanting both iEEG and EMG electrodes in the rodent. Secondly, using fewer implants reduces stress on the animal, contributing to a more comfortable environment and, in turn, facilitating the collection of more meaningful and authentic data. Furthermore, this prevents unwanted artifacts from contaminating the iEEG and reduces the financial burden associated with procuring EMG sensors.\u003c/p\u003e \u003cp\u003eA technique using real spindles extracted by a human reviewer from raw iEEG signals and artificial spindles created using Eq.\u0026nbsp;2 at various frequencies, amplitudes, and durations, was used to validate RSSD. After extraction, real spindles were added to a raw iEEG signal that lacked sleep spindles. Similarly, artificial spindles were also embedded in a raw iEEG recording without sleep spindles present. These signals were then analyzed at two levels: macro and micro. The macro level tested if the spindles can be accurately detected holistically (the total numbers of spindles detected in the recording), whereas the micro level tested the accuracy of detecting the spindles on a datapoint-by-datapoint basis, where each datapoint in the signal was examined to see if it belongs to a spindle. The macro analysis revealed that while both algorithmic approaches had zero false positives, the secondary method was more accurate in detecting the real spindles than the primary method. The secondary method was able to capture spindles that were missed by the primary method. However, the micro analysis showed that the secondary method overestimated the number of spindle datapoints. These results can be explained by the fact that the secondary method overestimates the duration of the sleep spindles, whereas the primary method sometimes underestimates the sleep spindles\u0026rsquo; duration due to the valleys having a different amplitude than the peaks, which sometimes leads to discounting the spindles with small duration. This causes the secondary method to identify all the spindles on the macro level and to increase the accuracy by increasing the sensitivity of the detection. The micro level accuracy is lower in the secondary method because the specificity is lower as it falsely extends the duration of the spindles.\u003c/p\u003e \u003cp\u003eThe peaks of the absolute value of the oscillatory component of the potential spindles provides the envelope or shape of the spindle. In the secondary method, we employed a 2nd-degree polynomial equation to fit either the odd or even peaks of the candidate spindle. The coefficient of determination, \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\({R}^{2}\\)\u003c/span\u003e\u003c/span\u003e, serves as a measure of how effectively the equation fits the spindle's envelope. In cases where the \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\({R}^{2}\\)\u003c/span\u003e\u003c/span\u003e value did not meet a certain threshold the potential spindles were disregarded. Our program lets the user adjust the coefficient of determination threshold, which determines what spindles are counted or not. During our validation, we observed that the higher the threshold value, the lower the mean number of detected spindles, which agree with our expected results. The coefficient of determination threshold value of 0.7 was chosen after testing with threshold values of 0.5, 0.6, 0.7, and 0.8 (0.7 had the highest accuracy).\u003c/p\u003e \u003cp\u003eUsing artificial spindles with varied frequency, amplitude, and duration we were able to detect the range and effectiveness of the RSSD. For both primary and secondary approaches, there was a direct relationship between the percentage of spindles detected and amplitude of the spindles. No significant difference was observed between spindles detected and their duration. As in the real spindles, the secondary method was found, in some cases, to overestimate the duration of the spindle.\u003c/p\u003e \u003cp\u003eThe validation results from the simulated data not only demonstrate the effectiveness and robustness of RSSD but also highlight its potential to save researchers\u0026rsquo; valuable time. By automating the process of counting spindles in the iEEG signal of a rodent, the program relieves the burden of manual analysis and reduces the biases and errors associated with human scorers. Moreover, the integration of real sleep spindles that were extract by a human reviewer into noise-saturated simulated signals provides a more reliable ground truth, surpassing the reliance on a consensus from fallible human observers. In addition to its accuracy, the RSSD offers an easy and rapid way to identify sleep spindles in rodents, eliminating the variability commonly associated with human observers and enhancing the consistency and objectivity of spindle detection. This automated approach holds immense potential to elucidate the relationship between spindles and deficits in function observed in rodent models of neurological disorders. Overall, the program's ability to streamline spindle analysis and provide reliable results has significant implications for advancing our understanding of sleep physiology and its implications in neurological research.\u003c/p\u003e "},{"header":"Methods","content":"\u003cp\u003eAnimals\u003c/p\u003e\n\u003cp\u003eMale Sprague-Dawley rats from Jackson Laboratories were employed in this study. Animals were housed in groups of 1\u0026ndash;2 rats per cage before surgery and housed singly afterwards. The rats were maintained on a 12-hour day/night cycle with food provided ad libitum. Surgery and iEEG recording procedures were approved by the Louisiana Tech University Institutional Animal Care and Use Committee (IACUC) and were in accordance with the National Institute of Health Guide for the Care and Use of Laboratory Animals. Euthanasia was performed in accordance with the AVMA Guidelines on Euthanasia. Experiments complied with ARRIVE Guidelines.\u003c/p\u003e\n\u003cp\u003eSurgery\u003c/p\u003e\n\u003cp\u003eIn compliance with an IACUC-approved protocol, rats were anesthetized using a combination of ketamine HCL and dexmedetomidine HCl delivered via intramuscular injection. Aseptic technique was used to clean, dry, and drill the skull. Electrodes were implanted bilaterally in the prefrontal cortex (channels 1 and 2), thalamus (channels 3 and 4), parietal cortex (channels 5 and 6), and the hippocampus (channels 7 and 8) [\u003cspan class=\"CitationRef\"\u003e27\u003c/span\u003e]. Stainless steel anchor screws, including one anchor screw used as the reference (channel 9), and dental acrylic were used to secure the electrode implants and enclose the surgical site. Figure \u003cspan class=\"InternalRef\"\u003e4\u003c/span\u003e displays the configuration of the eight electrodes and anchor screws in relation to bregma. The excess skin incision was closed using simple interrupted nylon sutures. Antibiotic ointment and topical powder were applied to the wound. Atipamezole was delivered via intramuscular injection to reverse the effects of the dexmedetomidine. After the surgery, rats were given at least 14 days to recover before performing any tests.\u003c/p\u003e\n\u003cp\u003eCardiac perfusion and histological analysis were performed to confirm the placement of the eight electrodes.\u003c/p\u003e\n\u003cp\u003eiEEG Acquisition System\u003c/p\u003e\n\u003cp\u003eIn this research, data from male Sprague Dawley rats were recorded over time at Louisiana Tech University, Ruston, LA. Each rat was housed individually in a 9in x 9in x 13.5in acrylic chamber. iEEG was recorded using a Tucker-Davis Technologies (TDT\u0026rsquo;s) RZ5 BioAmp digital signal processor which features efficient communication and memory access. The commutator and length of the cable connected to the implanted electrodes allowed for free movement within the chamber. A subject interface (SI8) program was used to record iEEG from 8 rats at a time with a sampling rate of 2 kHz. The spindle detection program was developed and validated using iEEG data acquired from channel 1 (left prefrontal cortex).\u003c/p\u003e\n\u003cp\u003eSleep Spindle Analysis\u003c/p\u003e\n\u003cp\u003eMcSleep [\u003cspan class=\"CitationRef\"\u003e18\u003c/span\u003e], a global and local human sleep spindle detection program, was modified to analyze iEEG recordings from adult Sprague Dawley rats using parameters shown in Supplementary Table 1. After normalizing the raw iEEG signal based on Eq. (1) for successive non-overlapping epochs, a transient separation algorithm was used to estimate the oscillatory component in the iEEG recording. The normalized oscillatory component was extracted by bandpass filtering the signal using a Chebyshev filter (11\u0026ndash;17 Hz) instead of the original filter used in McSleep. The envelope of the absolute value of the normalized filtered oscillatory component (Fig. \u003cspan class=\"InternalRef\"\u003e5\u003c/span\u003e) was used to identify sleep spindles with a custom-made algorithm (see next section).\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"InlineEquation\"\u003e\u0026nbsp;\u003cspan class=\"mathinline\"\u003e\\(\\varvec{n}\\varvec{o}\\varvec{r}\\varvec{m}\\varvec{a}\\varvec{l}\\varvec{i}\\varvec{z}\\varvec{e}\\varvec{d}=\\frac{\\varvec{r}\\varvec{a}\\varvec{w}-\\varvec{m}\\varvec{e}\\varvec{d}\\varvec{i}\\varvec{a}\\varvec{n}\\left(\\varvec{r}\\varvec{a}\\varvec{w}\\right)}{\\mathbf{max}\\left(|\\varvec{r}\\varvec{a}\\varvec{w}-\\varvec{m}\\varvec{e}\\varvec{d}\\varvec{i}\\varvec{a}\\varvec{n}\\left(\\varvec{r}\\varvec{a}\\varvec{w}\\right)|\\right)}\\)\u003c/span\u003e\u0026nbsp;\u003c/span\u003e \u003cstrong\u003eEq. (1)\u003c/strong\u003e\u003c/p\u003e\n\u003ch3\u003eFrom Peak Envelope to Sleep Spindle\u003c/h3\u003e\n\u003cp\u003eThe algorithm considered an amplitude threshold and the shape of the potential spindles when identifying the presence of sleep spindles (Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e5\u003c/span\u003e). The peaks of the absolute value of the normalized filtered oscillatory component were identified and used to form an envelope of the signal. At this stage, the subsequent analysis split into two different classification methods, which are the primary and secondary methods.\u003c/p\u003e\n\u003cp\u003eThe primary method considers all peaks and valleys of the normalized oscillatory component identified as local maxima in the envelope of the absolute value of the normalized oscillatory component (Figs.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e1\u003c/span\u003e \u0026amp; \u003cspan class=\"InternalRef\"\u003e5\u003c/span\u003e).\u003c/p\u003e\n\u003cp\u003eThe secondary method separates the peaks and valleys (positive and negative peaks) in the normalized oscillatory component that are identified as odd and even peaks in the envelope signal formed from the absolute value of the normalized oscillatory component, as shown in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e2\u003c/span\u003e. Then it follows the same process as the primary method separately for the odd and even components.\u003c/p\u003e\n\u003cp\u003eFor both primary and secondary classification methods, an algorithm was applied to each of the peaks of the envelope to identify the spindles highlighted in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e5\u003c/span\u003e. The algorithm was applied to the entire signal in the primary method (Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e1\u003c/span\u003ea) and to both the odd and even signal components in the secondary method (Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e2\u003c/span\u003e). These signals were normalized based on their respective maximum value and peaks with an amplitude above 0.5 were identified within each signal. As shown in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e1\u003c/span\u003eb, the algorithm looks at the outward adjacent data points (see small black arrows) from each peak in incremental steps comparing the values. If the outwardly adjacent values are ever greater than the inward adjacent values, then those outward data points are not considered to be a part of the candidate spindle identified by the peak. A binary signal is derived with values of 1 when it constitutes part of an identified spindle. If the length of time associated with candidate spindle is too short (smaller than duration of a true spindle, which we consider less than 0.3 seconds or less than 5 oscillations), then all data points are not considered part of a spindle and are given a value of 0 in the derived binary signal.\u003c/p\u003e\n\u003cp\u003eIn the secondary classification method, the Curve Fitting Toolbox\u0026reg; of MATLAB was used to fit a second-degree polynomial to the suspected sleep spindles to verify the shape of its positive and negative envelope matches that of a spindle. As shown in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e2\u003c/span\u003e, curve fits were applied to both the odd (red) and even (green) peak data points. The coefficient of determination, \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\({R}^{2}\\)\u003c/span\u003e\u003c/span\u003e, was used to estimate a threshold. If the coefficient of determination falls below\u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\)\u003c/span\u003e\u003c/span\u003e0.70 for either fit, the suspected sleep spindle was not considered to be a sleep spindle. This \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\({R}^{2}\\)\u003c/span\u003e\u003c/span\u003e threshold can be changed by the user on the user interface of the app.\u003c/p\u003e\n\u003cp\u003eMotion Detection\u003c/p\u003e\n\u003cp\u003eIn lieu of an EMG signal, to determine if a rodent is in a quiescent period, RSSD employs the video recordings of the rodent during the iEEG recording. Any detected candidate spindles outside the quiescent periods are not considered spindles. To detect motion, the current frame was compared to a frame a half of a second earlier. The difference between these two frames are converted to a binary image with a binary threshold of 0.8. If the number of pixels remaining is greater than the empirically-derived area threshold of 50, the rodent is considered to be moving. The binary and area thresholds can be adjusted via the slider in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e6\u003c/span\u003e. Tests were conducted to ensure that the video and iEEG recordings were in sync.\u003c/p\u003e\n\u003cp\u003eApplication\u0026rsquo;s User Interface\u003c/p\u003e\n\u003cp\u003eThe RSSD sleep spindle detection software comes with a multi-windowed user interface (UI) created with App Designer (Fig. \u003cspan class=\"InternalRef\"\u003e6\u003c/span\u003e). Using the Controller window, iEEG recordings and video files can be uploaded and analyzed. The visualization of the iEEG and video analysis is displayed in the app\u0026rsquo;s iEEG and Video windows, respectively. The iEEG Window displays the raw, filtered oscillatory component, and the \u0026ldquo;Find Peak\u0026rdquo; custom spindle detection algorithm of the iEEG channel chosen with a dropdown box. The video window (Fig. \u003cspan class=\"InternalRef\"\u003e6\u003c/span\u003e, right) compares pixel movement to determine if the rodent is in a quiescent period. The user can navigate through the different epochs of the iEEG signal and the corresponding video via sliders found on the controller (Supplementary Figs. S1, S2). The window of the epoch and other signal processing parameters can be adjusted with the controller as well. Notes associated with the iEEG file being analyzed can be recorded by the user and the project can be saved along with all parameter settings and interface displays and later loaded (Supplementary Fig. S3). The loaded video file can be cropped down to a user-defined region of interest where the rodent is located.\u003c/p\u003e\n\u003cp\u003eAfter the user analyzes the iEEG file, the Results window will appear. The Results window has three tabs: \u0026ldquo;Summary\u0026rdquo;, \u0026ldquo;Sleep Spindle Specifics\u0026rdquo;, and \u0026ldquo;Validation\u0026rdquo; (Supplementary Figs. S4-S6, respectively). The Summary tab provides the number and percentage of sleep spindles detected for each epoch as well as the mean and median duration of the detected spindles for both the primary and secondary classification methods. The Sleep Spindle Specifics tab shows the start and end times for each of the detected sleep spindles along with their maximum and median amplitude and duration. In the Validation tab, the user can compare their sleep spindle detection methods to a ground truth. The sensitivity, specificity, accuracy, Matthew\u0026rsquo;s correlation coefficient, and F-score are calculated for the primary and secondary classification methods.\u003c/p\u003e\n\u003cp\u003eValidation and Statistical Methods\u003c/p\u003e\n\u003cp\u003eAfter filtering the oscillatory component from a raw left prefrontal cortex iEEG recording, 5 different sleep spindles were manually identified by a human reviewer and extracted (see Fig. \u003cspan class=\"InternalRef\"\u003e7\u003c/span\u003e). Using a custom MATLAB live script (see MATLAB live script in Supplementary Data), 6,000 of these extracted sleep spindles were then randomly added throughout a raw iEEG recording from the left prefrontal cortex without any sleep spindles present to create 50,000 seconds (13 hours, 53 minutes, and 20 seconds) of simulated data for validation purposes.\u003c/p\u003e\n\u003cp\u003eA secondary approach was also taken in which artificial sleep spindles were generated via amplitude modulation of a sinusoid by a quadratic function (Eq. (2) and Fig. \u003cspan class=\"InternalRef\"\u003e8\u003c/span\u003e) and embedded in the raw left prefrontal cortex iEEG recording using the same custom MATLAB live script as with the real spindles.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"InlineEquation\"\u003e\u0026nbsp;\u003cspan class=\"mathinline\"\u003e\\(-{A\\bullet x}^{2}\\bullet sin(b\\bullet x)\\)\u003c/span\u003e\u0026nbsp;\u003c/span\u003e \u003cstrong\u003eEq. (2)\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eSixteen European Data Format (EDF) files of simulated data each with a duration of 10,000 seconds (2 hours, 46 minutes, and 40 seconds) were generated by adding 1200 randomly placed artificial sleep spindles at various frequencies, amplitudes, and durations to raw prefrontal cortex iEEG recordings of the rodents without any known sleep spindles present (see Supplementary Information). Each EDF file contained artificial spindles at a specific frequency, amplitude, and duration, so that the percentage of spindles detected could be evaluated for each parameter combination.\u003c/p\u003e\n\u003cp\u003eThe positions of these randomly placed sleep spindles were recorded to create a binary ground truth, where a value of 1 indicated the sleep spindle was present. The amplitude, frequency, and duration of the sleep spindles were manipulated to test the rigor of RSSD. The software\u0026rsquo;s detection of sleep spindles using primary and secondary classification methods was compared to the ground truth. The accuracy was evaluated at two levels: macro and micro. The macro level analysis determined if the spindles were accurately detected holistically, whereas the micro level tested the accuracy of detecting the spindles on a datapoint-by-datapoint basis. On the macro level, the accuracy was calculated by comparing the total number of sleep spindles detected by the program to the known number of sleep spindles. On the micro level, the accuracy, sensitivity, and specificity of RSSD were determined along with the F-score and MCC through a comparison of candidate spindles to the ground truth (the known locations of the inserted sleep spindles). MCC is commonly used to evaluate the performance of binary classifiers on imbalanced datasets, where one class is much less frequent than the other. The MCC can range from \u0026minus;\u0026thinsp;1 to 1, where 1 indicates perfect prediction, 0 indicates random prediction, and \u0026minus;\u0026thinsp;1 indicates total disagreement between prediction and observation[\u003cspan class=\"CitationRef\"\u003e18\u003c/span\u003e] [\u003cspan class=\"CitationRef\"\u003e28\u003c/span\u003e][\u003cspan class=\"CitationRef\"\u003e29\u003c/span\u003e]. Binomial proportion confidence intervals for the accuracy, sensitivity, and specificity were calculated using normal approximation intervals (Wald interval) since the sample size (the total seconds of the iEEG evaluated) was greater than 30 and the proportions were not close to 0 or 1 [\u003cspan class=\"CitationRef\"\u003e30\u003c/span\u003e].\u003c/p\u003e\n\u003cp\u003eSoftware Availability\u003c/p\u003e\n\u003cp\u003eThe most recent version of Rodent Sleep Spindle Detector can be found at GitHub (\u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://github.com/mathworks/Rodent-Sleep-Spindle-Detector\u003c/span\u003e\u003c/span\u003e) and MATLAB\u0026rsquo;s File Exchange (\u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.mathworks.com/matlabcentral/fileexchange/??-Rodent\u003c/span\u003e\u003c/span\u003e Sleep Spindle Detector). The app is packaged into a single installation file which installs a standard, stand-alone executable file that does not require a MATLAB license. MATLAB (version R2021b or greater) along with the Signal Processing Toolbox\u0026trade;, Image Processing Toolbox\u0026trade; and Curve Fitting Toolbox\u0026trade; are required to edit the Rodent Sleep Spindle Detector. Programming comments are embedded within the MATLAB code for experienced programmers.\u003c/p\u003e\n\u003cp\u003eRuntime\u003c/p\u003e\n\u003cp\u003eThe computing resources utilized for validation included an 11th Gen Intel\u0026reg; Core\u0026trade; i7-1185G7 processor running at a base frequency of 3.00GHz. Using a laptop with a 64-bit, Windows 11 operating system and 32.0 GB of RAM (31.7 GB being usable), the runtime to analyze a 2 hr, 46 min, and 40 s iEEG recording was 1 hr and 4 min with the integrated video motion detection utility and 8 min without the utility.\u003c/p\u003e"},{"header":"Declarations","content":"\u003ch1\u003eAcknowledgements\u003c/h1\u003e\n\u003cp\u003eThis work was supported by the National Science Foundation (RII-2 FEC OIA1632891, \u0026ldquo;Probing and Understanding the Brain: Micro and Macro Dynamics of Seizure and Memory Networks \u0026ndash; PI: L.I., Co-PIs: T.A.M. and L.L.P.), the National Institutes of Health (NS114723, PI: T.A.M.; A.C.K., S.V.), and the Herman A. (Dusty) Rhodes Eminent Scholar Chair, Louisiana Board of Regents to T.A.M. The funding agencies were not involved in the study design; in the collection, analysis, and interpretation of data; and in writing this report and the decision to submit it for publication. S.V. drew the diagram in Figure 4a.\u003c/p\u003e\n\u003ch1\u003eAuthor contributions\u003c/h1\u003e\n\u003cp\u003eK.S.H., T.A.M. and L.L.P. conceived the project and S.V., A.S.K. and J.M. helped to refine it. K.S.H. wrote the program, and A.C.K., P.D., and T.A.M. assisted with editing the program. L.I. ensured accuracy of signal analysis and graphic representations. S.V. and A.C.K. performed iEEG surgeries and acquired recordings. S.R. performed statistical analysis. All authors wrote and approved the manuscript. \u0026nbsp;\u003c/p\u003e\n\u003ch1\u003eCompeting interests\u003c/h1\u003e\n\u003cp\u003eThe authors declare no competing interests. K.S.H. is employed by MathWorks Inc.\u003c/p\u003e\n\u003ch1\u003eData availability\u003c/h1\u003e\n\u003cp\u003eDatasets and a video demonstrating the use of the user interface are available in a Figshare repository, https://doi.org/10.6084/m9.figshare.24452677 \u0026nbsp;\u003c/p\u003e\n\u003ch1\u003eAdditional information\u003c/h1\u003e\n\u003cp\u003eSupplementary tables and figures are available at [Scientific Reports editorial staff: please add link here]. \u0026nbsp;\u003c/p\u003e\n\u003cp\u003eCorrespondence and requests for materials should be addressed to T.A.M.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\u003cli\u003e\u003cspan\u003eBoutin, A. \u003cem\u003eet al.\u003c/em\u003e Transient synchronization of hippocampo-striato-thalamo-cortical networks during sleep spindle oscillations induces motor memory consolidation. Neuroimage 169, (2018).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLazic, K., Ciric, J. \u0026amp; Saponjic, J. Sleep spindle dynamics during NREM and REM sleep following distinct general anaesthesia in control rats and in a rat model of Parkinson\u0026rsquo;s disease cholinopathy. J Sleep Res 28, (2019).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMarkovic, A., Kaess, M. \u0026amp; Tarokh, L. Gender differences in adolescent sleep neurophysiology: a high-density sleep EEG study. Sci Rep 10, (2020).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMerikanto, I. \u003cem\u003eet al.\u003c/em\u003e ADHD symptoms are associated with decreased activity of fast sleep spindles and poorer procedural overnight learning during adolescence. Neurobiol Learn Mem 157, (2019).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePetzka, M., Chatburn, A., Charest, I., Balanos, G. M. \u0026amp; Staresina, B. P. Sleep spindles track cortical learning patterns for memory consolidation. Current Biology 32, (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAng, G. \u003cem\u003eet al.\u003c/em\u003e Absent sleep EEG spindle activity in GluA1 (Gria1) knockout mice: relevance to neuropsychiatric disorders. Transl Psychiatry 8, (2018).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eCastelnovo, A., D\u0026rsquo;Agostino, A., Casetta, C., Sarasso, S. \u0026amp; Ferrarelli, F. Sleep Spindle Deficit in Schizophrenia: Contextualization of Recent Findings. \u003cem\u003eCurrent Psychiatry Reports\u003c/em\u003e vol.\u0026nbsp;18 Preprint at \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1007/s11920-016-0713-2\u003c/span\u003e\u003cspan address=\"10.1007/s11920-016-0713-2\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e (2016).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFerrarelli, F. \u0026amp; Tononi, G. Reduced sleep spindle activity point to a TRN-MD thalamus-PFC circuit dysfunction in schizophrenia. \u003cem\u003eSchizophrenia Research\u003c/em\u003e vol.\u0026nbsp;180 Preprint at \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1016/j.schres.2016.05.023\u003c/span\u003e\u003cspan address=\"10.1016/j.schres.2016.05.023\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eTerrier, G. \u0026amp; Gottesmann, C. Study of cortical spindles during sleep in the rat. Brain Res Bull 3, (1978).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eIotchev, I. B. \u0026amp; Kubinyi, E. Shared and unique features of mammalian sleep spindles \u0026ndash; insights from new and old animal models. Biological Reviews 96, (2021).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMerten, J. E. \u003cem\u003eet al.\u003c/em\u003e The use of rodent models to better characterize the relationship among epilepsy, sleep, and memory. Epilepsia 63, 525\u0026ndash;536 (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDemanuele, C. \u003cem\u003eet al.\u003c/em\u003e Coordination of slow waves with sleep spindles predicts sleep-dependent memory consolidation in schizophrenia. Sleep 40, (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003evan Luijtelaar, E. L. J. M., van der Grinten, C. P. M., Blokhuis, H. J. \u0026amp; Coenen, A. M. L. Sleep in the domestic hen (Gallus domesticus). Physiol Behav 41, (1987).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eIotchev, I. B. \u0026amp; Kubinyi, E. Shared and unique features of mammalian sleep spindles \u0026ndash; insights from new and old animal models. Biological Reviews 96, (2021).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMerten, J. E. \u003cem\u003eet al.\u003c/em\u003e The use of rodent models to better characterize the relationship among epilepsy, sleep, and memory. \u003cem\u003eEpilepsia\u003c/em\u003e vol.\u0026nbsp;63 Preprint at \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1111/epi.17161\u003c/span\u003e\u003cspan address=\"10.1111/epi.17161\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSchimicek, P., Zeitlhofer, J., Anderer, P. \u0026amp; Saletu, B. Automatic Sleep-Spindle Detection Procedure: Aspects of Reliability and Validity. Clin EEG Neurosci 25, (1994).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAdamczyk, M., Genzel, L., Dresler, M., Steiger, A. \u0026amp; Friess, E. Automatic sleep spindle detection and genetic influence estimation using continuous wavelet transform. Front Hum Neurosci 9, (2015).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eParekh, A. \u003cem\u003eet al.\u003c/em\u003e Multichannel sleep spindle detection using sparse low-rank optimization. J Neurosci Methods 288, (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMei, N., Grossberg, M. D., Ng, K., Navarro, K. T. \u0026amp; Ellmore, T. M. Identifying sleep spindles with multichannel EEG and classification optimization. Comput Biol Med 89, (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eUygun, D. S. \u003cem\u003eet al.\u003c/em\u003e Validation of an automated sleep spindle detection method for mouse electroencephalography. Sleep 42, (2019).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKinoshita, T. \u003cem\u003eet al.\u003c/em\u003e Sleep Spindle Detection Using RUSBoost and Synchrosqueezed Wavelet Transform. IEEE Transactions on Neural Systems and Rehabilitation Engineering 28, (2020).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eGong, Z., Zhong, P. \u0026amp; Hu, W. Diversity in Machine Learning. IEEE Access 7, (2019).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKulkarni, P. M. \u003cem\u003eet al.\u003c/em\u003e A deep learning approach for real-time detection of sleep spindles. J Neural Eng 16, (2019).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eWei, L. \u003cem\u003eet al.\u003c/em\u003e Spindle-AI: Sleep Spindle Number and Duration Estimation in Infant EEG. IEEE Trans Biomed Eng 69, (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eO\u0026rsquo;Reilly, C. \u0026amp; Nielsen, T. Automatic sleep spindle detection: Benchmarking with fine temporal resolution using open science tools. Front Hum Neurosci 9, (2015).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMei, N., Grossberg, M. D., Ng, K., Navarro, K. T. \u0026amp; Ellmore, T. M. Identifying sleep spindles with multichannel EEG and classification optimization. Comput Biol Med 89, (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDoughty, P. T. \u003cem\u003eet al.\u003c/em\u003e Novel microwire-based biosensor probe for simultaneous real-time measurement of glutamate and GABA dynamics in vitro and in vivo. Sci Rep 10, (2020).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBekkar, M., Djemaa, H. K. \u0026amp; Alitouche, T. A. Evaluation Measures for Models Assessment over Imbalanced Data Sets. Journal of Information Engineering and Applications 3, (2013).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eChicco, D., T\u0026ouml;tsch, N. \u0026amp; Jurman, G. The matthews correlation coefficient (Mcc) is more reliable than balanced accuracy, bookmaker informedness, and markedness in two-class confusion matrix evaluation. BioData Min 14, (2021).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBrown, L. D., Cai, T. T. \u0026amp; DasGupta, A. Interval estimation for a binomial proportion. Statistical science 101\u0026ndash;117 (2001).\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"","lastPublishedDoi":"10.21203/rs.3.rs-3523866/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-3523866/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eA Rodent Sleep Spindle Detector (RSSD) application (app) was developed to assist researchers working with high volume studies examining the impact of sleep on neurological function. Our RSSD is a MATLAB-based software program with a user interface that automatically identifies sleep spindles from intracranial EEG (iEEG) recordings of rodents using two novel yet complementary algorithmic approaches, a primary and secondary one. To validate the program, 6,000 copies of real spindles of 5 different types, ranging from 11\u0026ndash;17 Hz with a duration of at least 0.3 seconds, were randomly placed within a noisy simulated prefrontal cortex iEEG signal of 50,000 seconds in duration. When compared to the ground truth on a datapoint-by-datapoint basis (individual spindle detection), the program had an accuracy of 98.40\u0026thinsp;\u0026plusmn;\u0026thinsp;5.62% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I. [91.93, 100] and 96.90\u0026thinsp;\u0026plusmn;\u0026thinsp;4.34% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I. [91.91, 100] for the primary and secondary algorithmic approach, respectively. Evaluating total spindle count, the program had an accuracy of 93.68\u0026thinsp;\u0026plusmn;\u0026thinsp;13.66% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I. [81.71, 100], and of 99.85\u0026thinsp;\u0026plusmn;\u0026thinsp;0.12% (mean\u0026thinsp;\u0026plusmn;\u0026thinsp;SD) with 95% C.I. [99.71, 99.96] for the primary and secondary algorithmic approach, respectively. The robustness of the sleep spindle detection was further validated for a range of spindle's duration, amplitude, and frequency by embedding in the iEEG signal respective artificial spindles. Finally, the RSSD app further improves its performance by first processing available video recordings of rodents to identify periods of quiescence and then running the sleep spindle detection algorithms on the iEEG only for those periods.\u003c/p\u003e","manuscriptTitle":"Automated rodent sleep spindle detector: MATLAB app using two complementary search algorithms","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2023-11-07 23:35:11","doi":"10.21203/rs.3.rs-3523866/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"73365300-3664-4061-919c-44ff48873f4c","owner":[],"postedDate":"November 7th, 2023","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[{"id":25953629,"name":"Biological sciences/Biological techniques"},{"id":25953630,"name":"Biological sciences/Neuroscience"},{"id":25953631,"name":"Health sciences/Biomarkers"},{"id":25953632,"name":"Physical sciences/Engineering"},{"id":25953633,"name":"Physical sciences/Mathematics and computing"}],"tags":[],"updatedAt":"2024-04-03T05:20:32+00:00","versionOfRecord":[],"versionCreatedAt":"2023-11-07 23:35:11","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-3523866","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-3523866","identity":"rs-3523866","version":["v1"]},"buildId":"FbvkV6FR0MCFSLy54lSbu","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.