| Literature DB >> 34434837 |
Christine Blume1, Christian Cajochen2.
Abstract
The detection of NREM-REM sleep cycles in human sleep data (i.e., polysomnographically assessed sleep stages) enables fine-grained analyses of ultradian variations in sleep microstructure (e.g., sleep spindles, and arousals), or other amplitude- and frequency-specific electroencephalographic features during sleep. While many laboratories have software that is used internally, reproducibility requires the availability of open-source software. Therefore, we here introduce the 'SleepCycles' package for R, an open-source software package that identifies sleep cycles and their respective (non-) rapid eye movement ([N]REM) periods from sleep staging data. Additionally, each (N)REM period is subdivided into parts of equal duration (percentiles), which may be useful for further fine-grained analyses. The detection criteria used in the package are, with some adaptations, largely based on criteria originally proposed by Feinberg and Floyd (1979). The latest version of the package can be downloaded from the Comprehensive R Archives Network (CRAN).•The package 'SleepCycles' for R allows to identify sleep cycles and their respective NREM and REM periods from sleep staging results.•Besides the cycle detection, NREM and REM periods are also split into parts of equal duration (percentiles) thereby allowing for a better temporal resolution across the night and comparisons of sleep cycles with different durations amongst different night recordings.Entities:
Keywords: Circadian rhythm; R; Sleep; Sleep cycles; Sleep staging
Year: 2021 PMID: 34434837 PMCID: PMC8374325 DOI: 10.1016/j.mex.2021.101318
Source DB: PubMed Journal: MethodsX ISSN: 2215-0161
Sleep stages in humans according to Rechtschaffen and Kales (R&K) criteria and the criteria of the American Association of Sleep Medicine (AASM).
| Rechtschaffen and Kales | AmericanAcademy of Sleep Medicine | |
|---|---|---|
| Wake | W (0) | W (0) |
| Non-rapid eye movement (NREM) sleep stages | S1 (1) | N1 (1) |
| S2 (2) | N2 (2) | |
| S3 (3) | N3 (3) | |
| S4 (4) | ||
| Rapid-eye movement (REM) sleep | REM (5) | REM (5) |
The numbers in brackets denote the numeric value that sleep stages are commonly assigned and which the ‘SleepCycles’ package requires as an input (for details see below).
Fig. 1Examples of sleep cycles detected with the ‘SleepCycles’ package. Above the hypnogram, i.e. the succession of sleep stages, the NREM and REM periods of each cycle have been marked. Each NREM cycle usually comprises first a NREM (darker colours) and then a REM (yellow) period. (A) Regular night with NREM onset, no NREM period exceeds 120 min in duration. (B) The first detected sleep cycle comprised more than 240 epochs (i.e., 120 min) excluding wakefulness. Thus, the NREM period was split into two, where the first N3 epoch following a lightening of sleep (i.e., at least 12 min of any other stage than N3) marks the onset of the second period.
Criteria for the detection of sleep cycles and differences between criteria originally proposed by [12] and criteria used in the ‘SleepCycles’ package.
| Criterion | Feinberg and Floyd | ‘SleepCycles’ package |
|---|---|---|
| Start of NREMPs | S2 | First sleep episode starts with N1 (default) or N2; following a REM period, it can also start with wake |
| Minimum duration of NREMPs | 15 min (including wake before final awakening) | |
| Maximum duration of NREMPs | – | 120 min (excluding wake) |
| Splitting of NREMPs if duration exceeds 120 min (excl. wake) | – | Split at first N3 epoch following a period of 12 min with any other sleep stage than N31 |
| Duration of REMPs | First REMP: no minimum duration; subsequent REMPs: minimum 5 minutes2 | |
| Completeness of a (N)REMP | (N)REMP is followed by at least 5 min of (N)REM3 | |
(N)REMP = (non-)rapid eye movement period; S1 = stage 1 sleep according to R&K [21] criteria; N1/N3 = NREM sleep stage 1/3 according to the criteria of the American Association of Sleep Medicine (AASM, 2007). 1Note that the code suggests potential splitting points that fulfil this criterion and in case there are several, users are asked to select one, provide a different point, or indicate that they do not want to split the NREMP (see below and Fig. 2). 2Note that, if there is an ‘obvious’ REMP, e.g. a sequence of REM epochs with a duration of for instance 4 or 4.5 min separating two longer periods without REM, that is NREMPs, which therefore does not meet the duration criterion, the minimum duration can be decreased using the ‘REMP_length’ criterion following careful consideration. 3By default, incomplete (N)REMPs at the end of the night are not removed, can be changes in the ‘rm_incomplete_periods’ argument.
Fig. 2Interactive splitting dialogue in case of a NREMP exceeding 120 min. The code suggests potential splitting points, which in this case is epoch 152. Specifically, epoch 152 is the first N3 epoch following a lightening of sleep, i.e. a period of any stage other than N3 for a minimum of 12 min. The dialogue in R's console additionally informs the user about how long the resulting NREMPs would be.
Arguments for the ‘SleepCycles’ function.
| Argument | Default value | Input |
|---|---|---|
| p | – | Character string specifying the directory with the staging result files |
| sleepstart | “N1” | Character string specifying which sleep stage to start the first NREMP with. Can be “N1” (default) or “N2” |
| files | NA | Numeric vector indicating the files to process, e.g., c(2:5) |
| filetype | “txt” | “txt” or “vmrk” |
| treat_as_W | NA | Any numeric value to be treated as stage ‘Wake’ |
| treat_as_N3 | NA | Any numeric value to be treated as stage ‘N3’ |
| rm_incomplete_period | FALSE | Logical value; specifies whether an incomplete period at the end should be removed. Default: FALSE. |
| plot | TRUE | Logical value; specifies whether the results of the analysis should be plotted and the plot saved at the end. Default: TRUE. |
| REMP_length | 10 | Numeric value specifying the minimum length of any REM period following the first. Default: 10. Should only be changed after careful consideration. |
W = wake; REMP = REM period, NA = not available.
Fig. 3Output file. The resulting text file contains the sleep staging data and gives the sleep cycle an epoch belongs to. Further, it contains information about whether an epoch belongs to a REM or NREM period (cf. ‘N_REM’ column) and which percentile of a (N)REMP it pertains to.
Specifications Table
| Subject Area | Neuroscience |
| More specific subject area | |
| Method name | |
| Name and reference of original method | |
| Resource availability |