Sleep increases firing rate modulation during interictal epileptiform discharges in mesial temporal structures.
The 8 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § Results › Increased IED rate with increased slow wave activity and delta power ↔ projects/hspike/analysis.R, lines 1279–1365 · score 0.76 · post hoc comparisons, delta power, 2.5–4 Hz, 0.1–2.5 Hz, IED rate, sleep stage
- [2] § Results › Increased IED rate with deeper stages of NREM sleep ↔ projects/hspike/analysis.R, lines 1279–1365 · score 0.72 · post hoc comparisons, delta power, slow wave activity, 2.5–4 Hz, 0.1–2.5 Hz, interictal epileptiform
- [3] § Results › Increased IED rate with deeper stages of NREM sleep ↔ projects/hspike/analysis_12122022.R, lines 1126–1168 · score 0.61 · delta power, slow wave activity, 2.5–4 Hz, 0.1–2.5 Hz, interictal epileptiform, mixed
- [4] § Methods and materials › Sliding window analyses ↔ trash/ft_spike_isi_edited.m, lines 1–42 · score 0.59 · Interspike intervals, spike train, windows, firing, 0.1 Hz
- [5] § Methods and materials › Spike sorting ↔ trash/pnh_seizures/mlib6/mcheck.m, lines 1–64 · score 0.56 · refractory period, violations, noise, signal, matching, ISI
- [6] § Methods and materials › Statistics ↔ projects/hspike/analysis.R, lines 953–1002 · score 0.54 · emmeans, post hoc, lmer, coefficients, Tukey, Models
- [7] § Methods and materials › Sliding window analyses ↔ shared/addSlidingWindows.m, the whole file · a weak match · score 0.51 · window overlapped, Sliding, FFT, segmentation, event, 0.5 Hz
- [8] § Methods and materials › Time-locked analyses ↔ trash/pnh_seizures/mlib6/mpsth.m, the whole file · a weak match · score 0.50 · peri stimulus, firing rate, PSTH, histogram, bin, width
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 3,194 lines · 144 KB · GPL-3.0 · 3 matches
- install.packages("circular")
- install.packages("ggplot2")
- install.packages("units")
- install.packages("reshape2")
- install.packages("circlize")
- install.packages("ggthemes")
- install.packages("lemon")
- install.packages("egg")
- install.packages("readxl")
- install.packages('Rcpp')
- install.packages("equatiomatic")
- install.packages("kableExtra")
- install.packages("CircStats")
- install.packages("emmeans")
- install.packages("lmerTest")
- install.packages("devtools")
- install.packages("sjPlot")
- install.packages("ggpubr")
- install.packages("viridis")
- install.packages("latex2exp")
- #if(!require(devtools)) install.packages("devtools")
- #devtools::install_github("kassambara/ggpubr")
- #setTimeLimit(100000); setSessionTimeLimit(10000)
- #devtools::install_github("strengejacke/sjPlot")
- # ggpval
- # install.packages("spiralize")
- # library(spiralize)
- library(ggplot2)
- #library("cowplot")
- #library("gridExtra")
- library(plyr)
- library(reshape2)
- library(RColorBrewer)
- #library("ggthemes")
- #library(lemon)
- # library("sjPlot")
- library(emmeans)
- library(gridExtra)
- library(gtable)
- library(grid)
- library(egg)
- library(ggpubr)
- require(dplyr)
- library(xtable)
- library("readxl")
- library(Rcpp)
- library(equatiomatic)
- # library(CircStats)
- library(circular)
- library(kableExtra)
- library("sjPlot") # plot_model
- library(viridis)
- library(latex2exp)
- #####################
- ## Support function #
- #####################
- # replace subsequent fields with NAN for visualization purposes
- cleanf <- function(x){
- oldx <- c(FALSE, x[-1]==x[-length(x)]) # is the value equal to the previous?
- res <- x
- res[oldx] <- NA
- res}
- ###############################
- # Latex table: Clinical table #
- ###############################
- data_clinical <- read.csv("D:/Dropbox/Apps/Overleaf/Hspike/tables/clinical.csv")
- data_clinical$ID <- NULL
- data_clinical$Label <- NULL
- colnames(data_clinical) <- c("Patient","Sex","Age","Onset","Type","SOZ","MRI","PET","SPECT","Medication","Implantation","Pre-implantation surgery" )
- kbl(data_clinical, "latex", booktabs = T, label = "clinical",
- caption = "Clinical summary")%>%
- kable_styling(latex_options = c("scale_down"))%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- column_spec(1, width = "3em") %>%
- column_spec(2, width = "1em") %>%
- column_spec(3, width = "1em") %>%
- column_spec(4, width = "2em") %>%
- column_spec(5, width = "5em") %>%
- column_spec(6, width = "5em") %>%
- column_spec(7, width = "5em") %>%
- column_spec(8, width = "5em") %>%
- column_spec(9, width = "5em") %>%
- column_spec(10, width = "5em") %>%
- column_spec(11, width = "5em") %>%
- collapse_rows(columns = 1) %>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("
- AED: Antiepileptic drugs,
- CBZ: Carbamazepine,
- ESL: Eslicarabazepine,
- FBTCS: Focal to Bilateral Tonic-Clonic Seizures,
- FIAS: Focal Impaired Awareness Seizure,
- FSWLA: Focal seizures without loss of awareness,
- IEDs: Interictal Epileptiform discharges,
- LCS: Lacosamide,
- LTG: Lamotrigine,
- MRI: Indications from Magnetic Resonance Imaging,
- OXC: Oxicarbazepine,
- PER: Perampanel,
- PMG: Polymicrogyria,
- PNH: Periventricular Nodular Heterotopia,
- SNH: Subcortical Nodular Heterotopia,
- SOZ: Seizure Onset Zone,
- TPM: Topiramate
- VPA: Valproic Acid,
- ZNG: Zonisamide."))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Hspike/tables/clinical.tex")
- ###############################################
- # Latex table: electrode anatomical locations #
- ###############################################
- options(knitr.kable.NA = '')
- macro <- read.csv("D:/Dropbox/Apps/Overleaf/Hspike/tables/macro_anatomical.csv", fileEncoding = 'UTF-8-BOM')
- macro$ID <- NULL
- macro$Label <- NULL
- # clean.cols <- c("Patient")
- # macro[clean.cols] <- lapply(macro[clean.cols], cleanf)
- micro <- read.csv("D:/Dropbox/Apps/Overleaf/Hspike/tables/micro_anatomical.csv", fileEncoding = 'UTF-8-BOM')
- micro$ID <- NULL
- micro$Label <- NULL
- # clean.cols <- c("Patient")
- # micro[clean.cols] <- lapply(micro[clean.cols], cleanf)
- locations <- bind_rows(macro,micro)
- kbl(locations, "latex", booktabs = T, linesep = "", label = 'anatomical',
- caption = "Anatomical locations of macro and micro electrodes")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- pack_rows("Macro contacts", 1, 14) %>% # latex_gap_space = "2em"
- pack_rows("Micro electrodes", 15, 27) %>%
- row_spec(1, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(3, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(5, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(7, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(9, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(11, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(13, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(15, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(16, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(18, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(20, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(21, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(23, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(24, extra_latex_after = "\\cline{2-5}") %>%
- row_spec(25, extra_latex_after = "\\cline{2-5}") %>%
- save_kable("D:/Dropbox/Apps/Overleaf/Hspike/tables/anatomical.tex")
- #########################
- # Detection performance #
- #########################
- options(knitr.kable.NA = '')
- data <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/performance.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data$Patient[9] = "\\textit{Mean}"
- data$Patient[10] = "\\textit{Std.}"
- data[,2] = round(data[,2],digits=0)
- data[,3] = round(data[,3],digits=0)
- data[,4] = round(data[,4],digits=1)
- data[,5] = round(data[,5],digits=1)
- data[,6] = round(data[,6],digits=0)
- data[,7] = round(data[,7],digits=1)
- #data[,8] = round(data[,8],digits=1)
- #data[,9] = round(data[,9],digits=1)
- #data[,10] = round(data[,10],digits=0)
- #data[,11] = round(data[,11],digits=1)
- kbl(data, "latex", booktabs = T, linesep = "", label = 'performance', escape = FALSE,
- col.names = c("Patient","24 hrs.", "24 hrs.","Hit (\\%)","FA (\\%)", "Total", "Total hrs."),
- # col.names = c("Patient","24hrs", "24hrs","Hit (\\%)","FA (\\%)", "Total","24hrs","Hit (\\%)","FA (\\%)", "Total", "Total hrs."),
- caption = "Automatic IED detection performance")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- # kable_styling(latex_options = c("scale_down"))%>%
- row_spec(8, hline_after = TRUE)%>%
- add_header_above(c(" " = 1, "Visual" = 1, "Automatic detection" = 4)) %>%
- # add_header_above(c(" " = 1, "Visual" = 1, "All templates" = 4, "Selected templates" = 4)) %>%
- save_kable("D:/Dropbox/Apps/Overleaf/Hspike/tables/performance.tex")
- ########################################
- # Latex table: Electrode locations MNI #
- ########################################
- options(knitr.kable.NA = '')
- data <- read.csv(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/data/hspike/MNI_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data <- data[!data$color == 0, ] # only make table of used contacts
- data <- data[, c('patient','electrode','contact','X','Y','Z')]
- colnames(data) = c('Patient','Electrode','Contact', 'X', 'Y', 'Z')
- rownames(data) <- NULL
- clean.cols <- c("Patient","Electrode")
- data[clean.cols] <- lapply(data[clean.cols], cleanf)
- kbl(data, "latex", booktabs = T, linesep = "", label = 'MNI',
- caption = "Anatomical locations of micro electrodes") %>%
- kable_styling(font_size = 6) %>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- row_spec(5, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(10, extra_latex_after = "\\cline{2-6}") %>%
- row_spec(14, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(19, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(24, extra_latex_after = "\\cline{2-6}") %>%
- row_spec(29, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(34, extra_latex_after = "\\cline{2-6}") %>%
- row_spec(39, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(44, extra_latex_after = "\\cline{2-6}") %>%
- row_spec(49, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(54, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(59, extra_latex_after = "\\cline{2-6}") %>%
- save_kable("D:/Dropbox/Apps/Overleaf/Hspike/tables/MNI.tex")
- ###################################
- # Latex table: Time in sleepstage #
- ###################################
- options(knitr.kable.NA = '')
- # normalize by time spend in sleep stages
- data <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/hypnogram_duration.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data <- data[, c("patient", "part", "TOTAL", "pPHASE_3", "pPHASE_2", "pPHASE_1", "pREM", "pWASO")]
- colnames(data) = c("Patient", "Night","Total (hrs.)", "S3", "S2", "S1", "REM", "WASO")
- data <- round(data, digits=1)
- df <- c("\\textit{Mean}", NA, round(mean(data$Total), digits = 1), round(mean(data$S3), digits = 1), round(mean(data$S2), digits = 1), round(mean(data$S1), digits = 1), round(mean(data$REM), digits = 1), round(mean(data$WASO), digits = 1))
- data <- rbind(data, df)
- # df <- c("\\textit{Std.}", NA, round(mean(data$Total), digits = 1), round(sd(data$S3), digits = 0), round(sd(data$S2), digits = 0), round(sd(data$S1), digits = 0), round(sd(data$REM), digits = 0), round(sd(data$WASO), digits = 0))
- # data <- rbind(data, df)
- clean.cols <- c("Patient")
- data[clean.cols] <- lapply(data[clean.cols], cleanf)
- library(dplyr)
- kbl(data, "latex", booktabs = T, linesep = "", label = 'stageduration', escape = FALSE,
- caption = "Time spend in sleep stages.", digits=2) %>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- add_header_above(c(" " = 3, "Sleep stage (%)" = 5)) %>%
- row_spec(3, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(6, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(9, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(12, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(15, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(18, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(21, extra_latex_after = "\\cline{2-8}") %>%
- row_spec(24, hline_after = TRUE) %>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/stageduration.tex")
- ####################################
- # Latex table: number of SUA / MUA #
- ####################################
- #
- # options(knitr.kable.NA = '')
- #
- # data_MUA <- read.csv(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/data/hspike/DataMUASUA.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- # data_MUA <- data_MUA[, c("PatientNr", "Part", "nrSUA", "nrMUA")]
- # colnames(data_MUA) = c("Patient", "Night","SUA", "MUA")
- # df <- c("\\textit{Sum}", NA, sum(data_MUA$SUA), sum(data_MUA$MUA))
- # data_MUA <- rbind(data_MUA, df)
- #
- # clean.cols <- c("Patient")
- # data_MUA[clean.cols] <- lapply(data_MUA[clean.cols], cleanf)
- #
- # kbl(data_MUA, "latex", booktabs = T, linesep = "", label = 'SUAMUA', escape = FALSE,
- # caption = "Number of putatively isolated single units (SUA) and number of multiunits (MUA)")%>%
- # kable_styling(latex_options = c("HOLD_position"))%>%
- # row_spec(3, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(6, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(9, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(12, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(15, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(18, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(21, extra_latex_after = "\\cline{2-4}") %>%
- # row_spec(24, hline_after = TRUE)%>%
- # save_kable("D:/Dropbox/Apps/Overleaf/Hspike/tables/SUAMUA.tex")
- #
- #### ADD RESPONSIVE UNITS #######
- library(tidyr)
- # prepare data
- data_psth <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/psth_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_psth$hyplabel <- factor(data_psth$hyplabel, levels = c("Pre", "Post", "REM", "Wake", "S1", "S2", "S3"))
- data_psth$Type <- factor(data_psth$SUA)
- data_sel <- setNames(aggregate(data_psth$responsive, by = c(list(data_psth$Patient, data_psth$part, data_psth$unit, data_psth$Type)), mean), c("Patient", "part", "unit", "Type", "responsive"))
- data_sel$responsive = as.integer(data_sel$responsive > 0)
- t = data_sel %>% count(Patient, part, responsive, Type)
- t2 <- pivot_wider(t, names_from = "Type", names_prefix = "SUA", values_from = "n")
- t3 <- pivot_wider(t2, names_from = "responsive", names_prefix = "responsive", values_from = c("SUA1", "SUA0"))
- t3[is.na(t3)] <- 0
- df <- c("\\textit{Sum}", NA, sum(t3$SUA1_responsive1), sum(t3$SUA1_responsive0), sum(t3$SUA0_responsive1), sum(t3$SUA0_responsive0))
- data_MUA <- rbind(t3, df)
- colnames(data_MUA) = c("Patient", "Night","Responsive", "Unresponsive", "Responsive", "Unresponsive")
- clean.cols <- c("Patient")
- data_MUA[clean.cols] <- lapply(data_MUA[clean.cols], cleanf)
- kbl(data_MUA, "latex", booktabs = T, linesep = "", label = 'SUAMUA', escape = FALSE,
- caption = "Number of responsive or unresponsive putatively isolated single units (SUA) and multiunits (MUA)")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- add_header_above(c(" ", " ", "SUA" = 2, "MUA" = 2)) %>%
- row_spec(3, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(6, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(9, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(12, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(15, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(18, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(21, extra_latex_after = "\\cline{1-6}") %>%
- row_spec(24, hline_after = TRUE) %>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/SUAMUA.tex")
- #######################
- # LFP power circadian #
- #######################
- # prepare data
- data_power <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/power_table_long.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_power$hyplabel <- factor(data_power$hyplabel, ordered = TRUE, levels = c("NO_SCORE", "REM", "AWAKE", "PHASE_1", "PHASE_2", "PHASE_3"))
- # data_power$band <- factor(data_power$band, ordered = TRUE, levels = c("delta", "theta", "alpha", "beta", "delta_div_alpha"))
- data_power$band <- factor(data_power$band, ordered = TRUE, levels = c("Delta1", "Delta2"))
- data_power$Patient <- factor(data_power$patient, levels = c(8:1))
- data_power$part <- factor(data_power$part)
- # for finding the median for plotting
- # data_power$bin <- as.integer(cut(data_power$minute, seq(0, 60*24, by = 1)))
- # data_binned_fine <- setNames(aggregate(data_power$power, c(list(data_power$Patient), list(data_power$bin), list(data_power$band)), mean), c("Patient", "bin", "band", "power"))
- # data_binned_fine <- as.data.frame(data_binned_fine %>% group_by(Patient, band) %>% mutate(Npower = (power-min(power))/max(power-min(power))))
- # ggplot(data=data_binned_fine[data_binned_fine$band == "Delta1" & data_binned_fine$Patient == 7, ], aes(x = bin, y = power, fill=Patient, col=Patient)) + geom_smooth()
- # bin for polar representation
- data_power$bin <- as.integer(cut(data_power$minute, seq(0, 24*60, by = 60)))
- # duplicate midnight to connect in figure
- temp <- subset(data_power, bin == 24)
- temp$bin <- 0
- data_power <- bind_rows(data_power, temp)
- data_binned <- setNames(aggregate(data_power$power, c(list(data_power$Patient), list(data_power$bin), list(data_power$band)), mean), c("Patient", "bin", "band", "power"))
- data_binned <- as.data.frame(data_binned %>% group_by(Patient, band) %>% mutate(Npower = (power-min(power))/max(power-min(power))))
- # data_binned$rad <- data_binned$bin / 24 * pi
- # c <- circular(control, units = "degrees", template = "geographics")
- # data_binned$rad
- # d <- density.circular(data_binned$bin[data_binned$patient == 1], bw = 50)
- ###
- # data_binned <- as.data.frame(data_binned %>% group_by(Patient, band) %>% mutate(Npower = (mean(power)-power)/sd(power)))
- ####
- # getCentroid <- function(x, width = 1) {
- # A <- x * width # area of each bar
- # xc <- seq(width/2, length(x), 1) # x coordinates of center of bars
- # yc <- x/2 # y coordinatey
- #
- # cx <- sum(xc * A) / sum(A)
- # cy <- sum(yc * A) / sum(A)
- # return(list(x = cx, y = cy))
- # }
- # points(getCentroid(x), col = 'red', pch = 19)
- ####
- # plot
- data_binned$title1 = "Slow waves (0.1-2.5 Hz)"
- data_binned$title2 = "Delta (2.5-4 Hz)"
- # data_binned$title2 = "Theta (5-7Hz)"
- # data_binned$title3 = "Alpha (8-14Hz)"
- # data_binned$title4 = "Delta (1-4Hz) / Alpha (8-14Hz)"
- polarpowerplots <- list()
- polarpowerplots[[1]] <-
- ggplot(data=data_binned[data_binned$band == "delta", ], aes(x = bin, y = Npower, fill=Patient, col=Patient)) +
- scale_fill_brewer(palette = "Set2", direction = -1) + scale_color_brewer(palette = "Set2", direction = -1) +
- geom_vline(xintercept = seq(0, 24, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(1, 8, by = 1), colour = "grey90") +
- geom_ribbon(aes(ymin = (9-as.numeric(Patient)), ymax=Npower*2+(9-as.numeric(Patient))), alpha=0.8, colour = NA) +
- theme_article() +
- theme(
- panel.border = element_blank(),
- legend.text = element_blank(),
- axis.ticks = element_blank(),
- axis.text.x = element_blank(),
- axis.text.y = element_blank(),
- axis.title.x = element_blank(),
- axis.title.y = element_blank()) +
- scale_x_continuous(breaks=seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- coord_polar(theta = "x", start = 0, clip="off") +
- ylim(-2, 10) +
- facet_wrap(~title1)
- polardelta1power <-
- ggplot(data=data_binned[data_binned$band == "Delta1", ], aes(x = bin, y = Npower, fill=Patient, col=Patient)) +
- scale_fill_brewer(palette = "Set2", direction = -1) + scale_color_brewer(palette = "Set2", direction = -1) +
- geom_vline(xintercept = seq(0, 24, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(1, 8, by = 1), colour = "grey90") +
- geom_ribbon(aes(ymin = (9-as.numeric(Patient)), ymax=Npower*1.5+(9-as.numeric(Patient))), alpha=1, colour = NA) +
- theme_article() +
- theme(
- panel.border = element_blank(),
- legend.text = element_blank(),
- axis.ticks = element_blank(),
- axis.text.x = element_blank(),
- axis.text.y = element_blank(),
- axis.title.x = element_blank(),
- axis.title.y = element_blank()) +
- scale_x_continuous(breaks=seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- coord_polar(theta = "x", start = 0, clip="off") +
- ylim(-2, 10)
- polardelta2power <-
- ggplot(data=data_binned[data_binned$band == "Delta2", ], aes(x = bin, y = Npower, fill=Patient, col=Patient)) +
- scale_fill_brewer(palette = "Set2", direction = -1) + scale_color_brewer(palette = "Set2", direction = -1) +
- geom_vline(xintercept = seq(0, 24, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(0, 8, by = 1), colour = "grey90") +
- geom_ribbon(aes(ymin = (9-as.numeric(Patient)), ymax=Npower*1.5+(9-as.numeric(Patient))), alpha=1, colour = NA) +
- theme_article() +
- theme(
- panel.border = element_blank(),
- legend.text = element_blank(),
- axis.ticks = element_blank(),
- axis.text.x = element_blank(),
- axis.text.y = element_blank(),
- axis.title.x = element_blank(),
- axis.title.y = element_blank()) +
- scale_x_continuous(breaks=seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- coord_polar(theta = "x", start = 0, clip="off") +
- ylim(-1, 10)
- polarpowerplots[[2]] <-
- ggplot(data=data_binned[data_binned$band == "theta", ], aes(x = bin, y = Npower, fill=Patient, col=Patient)) +
- scale_fill_brewer(palette = "Set2", direction = -1) + scale_color_brewer(palette = "Set2", direction = -1) +
- geom_vline(xintercept = seq(0, 24, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(0, 8, by = 1), colour = "grey90") +
- geom_ribbon(aes(ymin = (9-as.numeric(Patient)), ymax=Npower*2+(9-as.numeric(Patient))), alpha=0.8, colour = NA) +
- theme_article() +
- theme(
- panel.border = element_blank(),
- legend.text = element_blank(),
- axis.ticks = element_blank(),
- axis.text.x = element_blank(),
- axis.text.y = element_blank(),
- axis.title.x = element_blank(),
- axis.title.y = element_blank()) +
- scale_x_continuous(breaks=seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- coord_polar(theta = "x", start = 0, clip="off") +
- ylim(0, 10) +
- facet_wrap(~title2)
- polarpowerplots[[3]] <-
- ggplot(data=data_binned[data_binned$band == "alpha", ], aes(x = bin, y = Npower, fill=Patient, col=Patient)) +
- scale_fill_brewer(palette = "Set2", direction = -1) + scale_color_brewer(palette = "Set2", direction = -1) +
- geom_vline(xintercept = seq(0, 24, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(0, 8, by = 1), colour = "grey90") +
- geom_ribbon(aes(ymin = (9-as.numeric(Patient)), ymax=Npower*2+(9-as.numeric(Patient))), alpha=0.8, colour = NA) +
- theme_article() +
- theme(
- panel.border = element_blank(),
- legend.text = element_blank(),
- axis.ticks = element_blank(),
- axis.text.x = element_blank(),
- axis.text.y = element_blank(),
- axis.title.x = element_blank(),
- axis.title.y = element_blank()) +
- scale_x_continuous(breaks=seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- coord_polar(theta = "x", start = 0, clip="off") +
- ylim(0, 10) +
- facet_wrap(~title3)
- polarpowerplots[[4]] <-
- ggplot(data=data_binned[data_binned$band == "delta_div_alpha", ], aes(x = bin, y = Npower, fill=Patient, col=Patient)) +
- scale_fill_brewer(palette = "Set2", direction = -1) + scale_color_brewer(palette = "Set2", direction = -1) +
- geom_vline(xintercept = seq(0, 24, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(0, 8, by = 1), colour = "grey90") +
- geom_ribbon(aes(ymin = (9-as.numeric(Patient)), ymax=Npower*2+(9-as.numeric(Patient))), alpha=0.8, colour = NA) +
- theme_article() +
- theme(
- panel.border = element_blank(),
- legend.text = element_blank(),
- axis.ticks = element_blank(),
- axis.text.y = element_blank(),
- axis.text.x = element_blank(),
- axis.title.x = element_blank(),
- axis.title.y = element_blank()) +
- scale_x_continuous(breaks=seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- coord_polar(theta = "x", start = 0, clip="off") +
- ylim(0, 10) +
- facet_wrap(~title4)
- powerplots <- ggarrange(plotlist=polarpowerplots[c(1,2,3)], widths = c(1,1,1,1), heights = c(1,1,1,1), nrow = 1,
- labels = c("D","E","F"), vjust = 18, hjust = -1,
- legend = "right", common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold"))
- ggarrange(plotlist=polarpowerplots[c(1,2,3)], widths = c(1,1,1,1), heights = c(1,1,1,1), nrow = 1,
- labels = c("A","B","C"), vjust = 18, hjust = -1,
- legend = "right", common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Hspike/images/polar_power_band.pdf")
- ######################
- # IED rate circadian #
- ######################
- data_IED <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/IED_table_PSG.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_IED[data_IED$hyplabel == "PRE_SLEEP", ] = "AWAKE"
- data_IED[data_IED$hyplabel == "POST_SLEEP", ] = "AWAKE"
- data_IED$hyplabel <- factor(data_IED$hyplabel, ordered = TRUE, levels = c("REM", "AWAKE", "PHASE_1", "PHASE_2", "PHASE_3"))
- data_IED$Patient <- factor(data_IED$patient, levels = c(8:1)) # same order in plot
- data_IED$part <- factor(data_IED$part)
- data_IED$marker <- factor(data_IED$marker)
- data_IED$hour <- data_IED$minute / (60)
- data_IED$rad <- data_IED$theta
- # extract distribution statistics
- dist_IED <- data.frame()
- d <- list()
- stat_IED <- list()
- for (ipatient in 1:8) {
- d <- density.circular(data_IED$rad[data_IED$patient == ipatient], bw = 100)
- temp = list()
- temp$x = as.numeric(d$x)
- temp$y = d$y
- le <- lengths(temp)
- temp$patient <- rep(ipatient,le[1])
- tempdf <- as.data.frame(temp)
- colnames(tempdf) = c('rad','density','Patient')
- dist_IED <- bind_rows(dist_IED, tempdf)
- temp = list()
- # Rayleigh Test of Uniformity: General Unimodal Alternative
- temp <- rayleigh.test(data_IED$rad[data_IED$patient == ipatient])
- stat_IED$Patient[ipatient] = ipatient
- stat_IED$p[ipatient] = temp$p.value
- stat_IED$Rayleigh_stat[ipatient] = temp$statistic
- # Rayleigh Test of Uniformity: General Unimodal Alternative
- stat_IED$median[ipatient] <- as.numeric(median(circular(data_IED$rad[data_IED$patient == ipatient]))) / (pi * 2) * 24
- if (stat_IED$median[ipatient] < 0) {
- stat_IED$median[ipatient] = stat_IED$median[ipatient] + 24
- }
- }
- # format data for plotting
- dist_IED$Khour = dist_IED$rad / (pi * 2) * 24
- dist_IED$Patient = factor(dist_IED$Patient, levels = c(8:1)) # reversed order in plot
- stat_IED <- as.data.frame(stat_IED)
- stat_IED$Patient <- factor(stat_IED$Patient, levels = c(8:1))
- # add some offset in degrees so it shows up from behind the rest
- stat_IED$medianplot <- stat_IED$median
- stat_IED$medianplot[1] = stat_IED$median[1] - 0.25
- stat_IED$medianplot[6] = stat_IED$median[6] + 0.2
- stat_IED$medianplot[stat_IED$p >= 0.05] = NA # all are significant though
- IEDpolarplot <-
- ggplot(data=data_IED, aes(x=hour, y = as.numeric(Patient), fill=Patient)) +
- geom_vline(xintercept = seq(0, 21, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(1, 8, by = 1), colour = "grey90") +
- geom_ribbon(data=dist_IED, alpha = 1, colour = NA, aes(x = Khour,
- ymin = (9-as.numeric(Patient)),
- ymax = density*3 + (9-as.numeric(Patient)),
- col = Patient), show.legend = TRUE) +
- geom_segment(data=stat_IED, aes(x=medianplot, y=9.5, xend=medianplot, yend=10, col=Patient),
- arrow = arrow(length = unit(0.25, "cm"), type="closed"), size = 0.5, show.legend = FALSE) +
- coord_polar(theta = "x", start = 0, direction = 1, clip = 'off') +
- scale_x_continuous(breaks = seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- scale_fill_brewer(palette = "Set2", direction=1) + scale_color_brewer(palette = "Set2", direction=1) +
- theme_article() +
- theme(panel.border = element_blank(),
- #legend.key = element_blank(),
- axis.ticks = element_blank(),
- axis.text.y = element_blank(),
- #axis.text.x = element_blank(),
- panel.grid = element_blank(),
- axis.title.x = element_blank(),
- #legend.text = element_blank(),
- axis.title.y = element_blank()) +
- ylim(-2, 10)
- # LaTeX table
- library(stringr)
- stat_IED$time = paste(str_pad( floor(stat_IED$median), 2, pad = "0"), ":", str_pad(floor((stat_IED$median- floor(stat_IED$median)) * 60), 2, pad = "0"), sep = "")
- stat_IED <- stat_IED[, c("Patient", "time", "Rayleigh_stat", "p")]
- stat_IED[,4] = ifelse(stat_IED[,4] > .05, paste(round(stat_IED[,4],digits=2),sep=""), ifelse(stat_IED[,4] < .0001, "<.0001\\textsuperscript{***}", ifelse(stat_IED[,4] < .001,"<.001\\textsuperscript{**}", ifelse(stat_IED[,4] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- kbl(stat_IED, "latex", booktabs = T, linesep = "", label = 'circstat_IED',
- col.names = c("Patient","Median angle (HH:mm)","Rayleigh", "\\textit{p}"),
- escape = FALSE, digits = 2,
- caption = "Circular statistics of circadian IED rate") %>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$. = p<0.05$, $* = p<0.01$, $** = p<0.001$, $*** = p<0.0001$"))%>%
- kable_styling(latex_options = c("HOLD_position")) %>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/circstat_IED.tex")
- ######################
- # Seizures circadian #
- ######################
- # load data: Patients x Units x time window
- data_seizures <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/seizuredata_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- # prepare data
- data_seizures$Patient <- factor(data_seizures$patient, levels = c(1:8))
- data_seizures$hour <- data_seizures$minute / 60
- data_seizures$rad <- data_seizures$minute / 60 / 24 * pi * 2
- # extract distribution statistics
- dist_seizures <- data.frame()
- d <- list()
- stat_seizures <- list()
- for (ipatient in 1:8) {
- d <- density.circular(data_seizures$rad[data_seizures$patient == ipatient], bw = 50)
- temp = list()
- temp$x = as.numeric(d$x)
- temp$y = d$y
- le <- lengths(temp)
- temp$patient <- rep(ipatient,le[1])
- tempdf <- as.data.frame(temp)
- colnames(tempdf) = c('rad','density','Patient')
- dist_seizures <- bind_rows(dist_seizures, tempdf)
- # Rayleigh Test of Uniformity: General Unimodal Alternative
- temp = list()
- temp <- rayleigh.test(data_seizures$rad[data_seizures$patient == ipatient])
- stat_seizures$Patient[ipatient] = ipatient
- stat_seizures$p[ipatient] = temp$p.value
- stat_seizures$Rayleigh_stat[ipatient] = temp$statistic
- # Rayleigh Test of Uniformity: General Unimodal Alternative
- stat_seizures$median[ipatient] <- as.numeric(median(circular(data_seizures$rad[data_seizures$patient == ipatient]))) / (pi * 2) * 24
- if (stat_seizures$median[ipatient] < 0) {
- stat_seizures$median[ipatient] = stat_seizures$median[ipatient] + 24
- }
- }
- # format data for plotting
- dist_seizures$Khour = dist_seizures$rad / (pi * 2) * 24
- dist_seizures$Patient = factor(dist_seizures$Patient, levels = c(8:1))
- stat_seizures <- as.data.frame(stat_seizures)
- stat_seizures$Patient = factor(stat_seizures$Patient, levels = c(8:1))
- stat_seizures$significant = stat_seizures$p < 0.05
- stat_seizures$median_sel = stat_seizures$median
- stat_seizures$median_sel[stat_seizures$p >= 0.05] = NA # all are significant though
- # tiny adjustment to make axes line out properly and arrows not overlap
- data_seizures$hourplot <- data_seizures$hour
- data_seizures$hourplot[which(data_seizures$hour==max(data_seizures$hour))] = 24
- # add jitter function for points
- jitter <- position_jitter(width = 0, height = 0.4)
- # plot
- Seizurepolarplot <-
- ggplot(data=data_seizures, aes(x=hourplot, y = as.numeric(Patient), fill=Patient)) +
- geom_vline(xintercept = seq(0, 21, by = 3), colour = "grey90") +
- geom_hline(yintercept = seq(1, 8, by = 1), colour = "grey90") +
- geom_ribbon(data=dist_seizures, alpha = 1, colour = NA, aes(x=Khour,
- ymin = (9-as.numeric(Patient)),
- ymax = density*1.3 + (9-as.numeric(Patient)),
- col = Patient), show.legend = FALSE) +
- geom_segment(data=stat_seizures, aes(x=median_sel, y=9.5, xend=median_sel, yend=10, col=Patient),
- arrow = arrow(length = unit(0.25, "cm"), type="closed"), size = 1, show.legend = FALSE) +
- geom_point(colour="black", pch=21, size=1, position = jitter) +
- coord_polar(theta = "x", start = 0, direction = 1, clip = 'off') +
- scale_x_continuous(breaks = seq(0, 21, by = 3),
- labels = c("0" = "00:00", "3" = "", "6" = "06:00", "9" = "", "12" = "12:00", "15" = "", "18" = "18:00", "21" = "")) +
- scale_fill_brewer(palette = "Set2", direction = 1) + scale_color_brewer(palette = "Set2", direction = 1) +
- theme_article() +
- theme(panel.border = element_blank(),
- #legend.key = element_blank(),
- axis.ticks = element_blank(),
- axis.text.y = element_blank(),
- axis.text.x = element_blank(),
- panel.grid = element_blank(),
- axis.title.x = element_blank(),
- #legend.text = element_blank(),
- axis.title.y = element_blank()) +
- ylim(-2, 10)
- # save combined to pdf
- # ggarrange(IEDpolarplot, Seizurepolarplot,
- # labels = c("A","B"),
- # vjust = 15, hjust = -1,
- # legend = "right",
- # common.legend = TRUE,
- # font.label = list(size = 14, color = "black", face = "bold")) %>%
- # ggexport(filename = "D:/Dropbox/Apps/Overleaf/Hspike/images/polar_density_seizures.pdf")
- # save combined to pdf, with power
- # ggarrange(IEDpolarplot, Seizurepolarplot, polardelta1power, polardelta2power,
- # labels = c("A","B","C", "D"),
- # vjust = 3, hjust = -1,
- # legend = "right",
- # common.legend = TRUE,
- # font.label = list(size = 14, color = "black", face = "bold")) %>%
- # ggexport(filename = "D:/Dropbox/Apps/Overleaf/Hspike/images/polar.pdf")
- # save combined to pdf
- ggarrange(IEDpolarplot, Seizurepolarplot,
- labels = c("A","B"),
- vjust = 15, hjust = -1,
- ncol = 2, nrow = 1,
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/polar.pdf")
- # LaTeX table
- library(stringr)
- stat_seizures$time = paste(str_pad( floor(stat_seizures$median), 2, pad = "0"), ":", str_pad(floor((stat_seizures$median- floor(stat_seizures$median)) * 60), 2, pad = "0"), sep = "")
- stat_seizures <- stat_seizures[, c("Patient", "time", "Rayleigh_stat", "p")]
- stat_seizures[,4] = ifelse(stat_seizures[,4] > .05, paste(round(stat_seizures[,4],digits=2),sep=""), ifelse(stat_seizures[,4] < .0001, "<.0001\\textsuperscript{***}", ifelse(stat_seizures[,4] < .001,"<.001\\textsuperscript{**}", ifelse(stat_seizures[,4] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- kbl(stat_seizures, "latex", booktabs = T, linesep = "", label = 'circstat_seizures',
- col.names = c("Patient","Median angle (HH:mm)","Rayleigh", "\\textit{p}"),
- escape = FALSE, digits = 2,
- caption = "Circular statistics of circadian seizure occurance")%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$. = p<0.05$, $* = p<0.01$, $** = p<0.001$, $*** = p<0.0001$"))%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/circstat_seizures.tex")
- # combined table
- temp <- stat_seizures
- colnames(temp) <- c("Patient","time2","Rayleigh_stat2","p2")
- combined = merge(stat_IED,temp)
- kbl(combined, "latex", booktabs = T, linesep = "", label = 'circstats',
- col.names = c("Patient","Time","Rayleigh", "\\textit{p}","Time","Rayleigh", "\\textit{p}"),
- escape = FALSE, digits = 2,
- caption = "Circular statistics of circadian epileptic activity")%>%
- add_header_above(c(" ", "Interictal activity" = 3, "Seizures" = 3)) %>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/circstats.tex")
- #############################
- # LFP power per sleep stage #
- #############################
- # prepare data
- data_pow <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/power_table_long.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_pow <- data_pow[!data_pow$part > 3, ] # hypnogram is only scored on first three nights
- data_pow <- data_pow[!data_pow$hyplabel == "NO_SCORE", ]
- data_pow$hyplabel[data_pow$hyplabel == "PHASE_1"] = "S1"
- data_pow$hyplabel[data_pow$hyplabel == "PHASE_2"] = "S2"
- data_pow$hyplabel[data_pow$hyplabel == "PHASE_3"] = "S3"
- data_pow$hyplabel[data_pow$hyplabel == "AWAKE"] = "WASO"
- data_pow$hyplabel[data_pow$hyplabel == "PRESLEEP"] = "Pre"
- data_pow$hyplabel[data_pow$hyplabel == "POSTSLEEP"] = "Post"
- data_pow$hyplabel <- factor(data_pow$hyplabel, levels = c("Pre", "Post", "REM", "WASO", "S1", "S2", "S3"))
- data_pow$band <- factor(data_pow$band, ordered = TRUE, levels = c("Delta1", "Delta2"))
- data_pow$patient <- factor(data_pow$patient, levels = c(8:1))
- data_pow$part <- factor(data_pow$part)
- # relative to pre-sleep
- temp <- setNames(aggregate(data_pow$power, by = list(data_pow$patient, data_pow$part, data_pow$band, data_pow$hyplabel), mean), c("patient", "part", "band", "hyplabel", "Pre"))
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_pow <- merge(data_pow, temp)
- data_pow$Zpower <- (data_pow$power-data_pow$Pre) / (data_pow$power+data_pow$Pre)
- data_pow$Zpower <- (data_pow$power/data_pow$Pre)
- data_pow_sel <- data_pow[!data_pow$hyplabel=="Pre", ]
- # averages for plotting
- data_pow_avg <- setNames(aggregate(data_pow_sel$Zpower, by = list(data_pow_sel$patient, data_pow_sel$part, data_pow_sel$band, data_pow_sel$hyplabel), mean), c("patient", "part", "band", "hyplabel", "power_avg"))
- data_pow_avg$patient <- factor(data_pow_avg$patient, levels = c(8:1))
- data_pow_avg$part <- factor(data_pow_avg$part)
- # plot
- data_pow_sel$title1 = "SWA (0.1-2.5 Hz) power"
- data_pow_sel$title2 = "Delta (2.5-4.0 Hz) power"
- plot_delta1 <-
- ggplot(data=data_pow_sel[data_pow_sel$band == "Delta1",], aes(y = hyplabel, x = Zpower)) +
- geom_boxplot(outlier.shape = NA) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_point(data = data_pow_avg[data_pow_avg$band == "Delta1",], aes(group = interaction(patient, part), x = power_avg, y = hyplabel, col = patient),
- position=position_dodge(width=0.5)) +
- guides(colour = "none") +
- coord_cartesian(xlim = c(0, 20)) +
- scale_x_continuous(breaks=c(0, 20)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- theme_article() +
- ylab(NULL) + xlab(NULL) +
- facet_wrap(~title1)
- plot_delta2 <-
- ggplot(data=data_pow_sel[data_pow_sel$band == "Delta2",], aes(y = hyplabel, x = Zpower)) +
- geom_boxplot(outlier.shape = NA) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_point(data = data_pow_avg[data_pow_avg$band == "Delta2",], aes(group = interaction(patient, part), x = power_avg, y = hyplabel, col = patient),
- position=position_dodge(width=0.5)) +
- guides(colour = "none") +
- coord_cartesian(xlim = c(0, 10)) +
- scale_x_continuous(breaks=c(0, 10)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- theme_article() +
- ylab(NULL) + xlab(NULL) +
- facet_wrap(~title2)
- ##########################
- # IED rate & sleep stage #
- ##########################
- # prepare data
- data_IED <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/IED_table_PSG.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_IED <- data_IED[!data_IED$hyplabel == "NO_SCORE", ]
- data_IED$hyplabel[data_IED$hyplabel == "PHASE_1"] = "S1"
- data_IED$hyplabel[data_IED$hyplabel == "PHASE_2"] = "S2"
- data_IED$hyplabel[data_IED$hyplabel == "PHASE_3"] = "S3"
- data_IED$hyplabel[data_IED$hyplabel == "AWAKE"] = "WASO"
- data_IED$hyplabel[data_IED$hyplabel == "PRESLEEP"] = "Pre"
- data_IED$hyplabel[data_IED$hyplabel == "POSTSLEEP"] = "Post"
- data_IED$hyplabel <- factor(data_IED$hyplabel, levels = c("Pre", "Post", "REM", "WASO", "S1", "S2", "S3"))
- data_IED$Patient <- factor(data_IED$patient, levels = c(8:1))
- data_IED$part <- factor(data_IED$part)
- data_IED$marker <- factor(data_IED$marker)
- data_IED$hour <- data_IED$minute / (60)
- # normalize by time spend in sleep stages
- data_duration <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/hypnogram_duration.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_duration <- data_duration %>% rename(
- 'S1' = 'PHASE_1',
- 'S2' = 'PHASE_2',
- 'S3' = 'PHASE_3',
- 'Pre' = 'PRESLEEP',
- 'Post' = 'POSTSLEEP',
- 'Total' = 'TOTAL')
- data_duration <- melt(data_duration, id = c('patient','part'))
- colnames(data_duration) = c('Patient','part','hyplabel','duration')
- # count IEDs per sleepstage
- data_IEDrate <- na.omit(data_IED %>% dplyr::count(Patient, part, hyplabel))
- # normalize by time spend in sleep stages
- data_IEDrate <- merge(data_IEDrate, data_duration)
- data_IEDrate$IEDrate = data_IEDrate$n / data_IEDrate$duration / 60 # original rate is in Hz, now in minute
- # normalize rate by Pre rate
- i <- data_IEDrate[data_IEDrate$hyplabel == 'Pre',]
- i <- i[, c('Patient','part','IEDrate')]
- colnames(i) = c('Patient','part','Prerate')
- data_IEDrate <- merge(data_IEDrate, i)
- data_IEDrate$IEDrateNorm <- data_IEDrate$IEDrate - data_IEDrate$Prerate
- data_IEDrate_sel <- data_IEDrate[!data_IEDrate$hyplabel=="Pre", ]
- # plot
- data_IEDrate_sel$title1 = "IED count"
- data_IEDrate_sel$title2 = "IED rate (count/minute)"
- data_IEDrate_sel$title3 = "IED rate - IED rate Pre-sleep (count/min)"
- plot_IED_count <- ggplot(data=data_IEDrate_sel, aes(y=hyplabel, x=n)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, part), col = Patient), position=position_dodge(width=0.5)) +
- # guides(colour = "none") +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(1, 3000)) +
- scale_x_continuous(breaks=c(0, 3000)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- theme(legend.position="right") +
- facet_wrap(~title1)
- plot_IED_rate <- ggplot(data=data_IEDrate_sel, aes(y=hyplabel, x=IEDrate)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, part), col = Patient), position=position_dodge(width=0.5)) +
- # guides(colour = "none") +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(0, 20)) +
- scale_x_continuous(breaks=c(0, 20)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- theme(legend.position="right") +
- facet_wrap(~title2)
- plot_IED_norm <- ggplot(data=data_IEDrate_sel, aes(y=hyplabel, x=IEDrateNorm)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, part), col = Patient), position=position_dodge(width=0.5)) +
- ylab(NULL) + xlab(NULL) +
- theme(axis.text.y = element_blank()) +
- theme_article() +
- coord_cartesian(xlim = c(0, 20)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- scale_x_continuous(breaks=c(0, 20)) +
- # theme(legend.position ="bottom") +
- # guides(colour = guide_legend(ncol = 1)) +
- # guides(fill=guide_legend(title="Patient")) +
- theme(legend.position="right") +
- labs(color='Patient') +
- facet_wrap(~title3)
- #####################################
- # IED rate explained by sleep stage #
- #####################################
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- # determine reference level
- data_IEDrate$hyplabel <- factor(data_IEDrate$hyplabel, levels = c("Pre","S3", "S2", "S1", "Wake", "REM", "Post"))
- data_IEDrate$hyplabel = relevel(data_IEDrate$hyplabel, ref="Pre")
- lIEDrate <- lmer(IEDrate ~ hyplabel + (1 | part) + (1 | Patient), data_IEDrate, control = lmerControl(optimizer ='Nelder_Mead'))
- summary(lIEDrate)
- plot_model(lIEDrate)
- # Coefficients
- temp = summary(lIEDrate)
- coefs <- as.data.frame(temp$coefficients)
- coefs[,5] = ifelse(coefs[,5] > .05, paste(round(coefs[,5],digits=2),sep=""), ifelse(coefs[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(coefs[,5] < .001,"<.001\\textsuperscript{**}", ifelse(coefs[,5] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- rownames(coefs) <- c("\\textit{Intercept}", "S3", "S2", "S1", "Wake", "REM", "Post")
- # Post-hoc tests
- temp = emmeans(lIEDrate, list(pairwise ~ hyplabel), adjust = "tukey")
- phIEDrate <- as.data.frame(temp$`pairwise differences of hyplabel`)
- phIEDrate <- phIEDrate[, -4] # remove df since they are at inf
- phIEDrate[,5] = ifelse(phIEDrate[,5] > .05, paste(round(phIEDrate[,5],digits=2),sep=""), ifelse(phIEDrate[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(phIEDrate[,5] < .001,"<.001\\textsuperscript{**}", ifelse(phIEDrate[,5] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- # Concatenate in one LaTeX table
- coefs <- data.frame(Predictor = row.names(coefs), coefs);
- rownames(coefs) <- NULL
- colnames(phIEDrate) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","z", "\\textit{p}")
- colnames(coefs) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)", "df", "z","\\textit{p}")
- stats_IEDrate <- bind_rows(coefs,phIEDrate)
- options(knitr.kable.NA = '')
- kbl(stats_IEDrate, "latex", booktabs = T, linesep = "", label = 'stats_IEDrate',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stages on Slow Wave activity (0.1-2.5Hz)")%>%
- pack_rows("Coefficients", 1, 7) %>%
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$. = p<0.05$, $* = p<0.01$, $** = p<0.001$, $*** = p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/stats_IEDrate.tex")
- #################################
- # IED rate vs. power STATISTICS #
- #################################
- # prepare data
- data_pow_wide <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/power_table_wide.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_pow_wide <- data_pow_wide[!data_pow_wide$hyplabel == "NO_SCORE", ]
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PHASE_1"] = "S1"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PHASE_2"] = "S2"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PHASE_3"] = "S3"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "AWAKE"] = "WASO"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PRESLEEP"] = "Pre"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "POSTSLEEP"] = "Post"
- data_pow_wide$hyplabel <- factor(data_pow_wide$hyplabel, levels = c("Pre","S3", "S2", "S1", "WASO", "REM", "Post"))
- data_pow_wide$stage <- data_pow_wide$hyplabel
- data_pow_wide$Patient <- factor(data_pow_wide$patient, levels = c(8:1))
- data_pow_wide$night <- factor(data_pow_wide$part)
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- ###################################
- # Delta1 explained by sleep stage #
- ###################################
- lDelta1 <- lmer(Delta1 ~ stage + (1 | night) + (1 | Patient), data_pow_wide, control = lmerControl(optimizer ='Nelder_Mead'))
- summary(lDelta1)
- plot_model(lDelta1)
- # Coefficients
- temp = summary(lDelta1)
- coefs <- as.data.frame(temp$coefficients)
- coefs[,5] = ifelse(coefs[,5] > .05, paste(round(coefs[,5],digits=2),sep=""), ifelse(coefs[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(coefs[,5] < .001,"<.001\\textsuperscript{**}", ifelse(coefs[,5] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- rownames(coefs) <- c("\\textit{Intercept}", "S3", "S2", "S1", "WASO", "REM", "Post")
- # Post-hoc tests
- temp = emmeans(lDelta1, list(pairwise ~ stage), adjust = "tukey")
- phDelta1 <- as.data.frame(temp$`pairwise differences of stage`)
- phDelta1 <- phDelta1[, -4] # remove df since they are at inf
- phDelta1[,5] = ifelse(phDelta1[,5] > .05, paste(round(phDelta1[,5],digits=2),sep=""), ifelse(phDelta1[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(phDelta1[,5] < .001,"<.001\\textsuperscript{**}", ifelse(phDelta1[,5] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- # Concatenate in one LaTeX table
- coefs <- data.frame(Predictor = row.names(coefs), coefs);
- rownames(coefs) <- NULL
- colnames(phDelta1) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","z", "\\textit{p}")
- colnames(coefs) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)", "df", "z","\\textit{p}")
- stats_delta1 <- bind_rows(coefs,phDelta1)
- options(knitr.kable.NA = '')
- kbl(stats_delta1, "latex", booktabs = T, linesep = "", label = 'stats_delta1',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stage on Slow Wave (0.1-2.5Hz) power")%>%
- pack_rows("Coefficients", 1, 7) %>%
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/stats_delta1.tex")
- ###################################
- # Delta2 explained by sleep stage #
- ###################################
- lDelta2 <- lmer(Delta2 ~ stage + (1 | night) + (1 | Patient), data_pow_wide, control = lmerControl(optimizer ='Nelder_Mead'))
- summary(lDelta2)
- plot_model(lDelta2)
- # Coefficients
- temp = summary(lDelta2)
- coefs <- as.data.frame(temp$coefficients)
- coefs[,5] = ifelse(coefs[,5] > .05, paste(round(coefs[,5],digits=2),sep=""), ifelse(coefs[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(coefs[,5] < .001,"<.001\\textsuperscript{**}", ifelse(coefs[,5] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- rownames(coefs) <- c("\\textit{Intercept}", "S3", "S2", "S1", "WASO", "REM", "Post")
- # Post-hoc tests
- temp = emmeans(lDelta2, list(pairwise ~ stage), adjust = "tukey")
- phDelta2 <- as.data.frame(temp$`pairwise differences of stage`)
- phDelta2 <- phDelta2[, -4] # remove df since they are at inf
- phDelta2[,5] = ifelse(phDelta2[,5] > .05, paste(round(phDelta2[,5],digits=2),sep=""), ifelse(phDelta2[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(phDelta2[,5] < .001,"<.001\\textsuperscript{**}", ifelse(phDelta2[,5] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- # Concatenate in one LaTeX table
- coefs <- data.frame(Predictor = row.names(coefs), coefs);
- rownames(coefs) <- NULL
- colnames(phDelta2) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","z", "\\textit{p}")
- colnames(coefs) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)", "df", "z","\\textit{p}")
- stats_delta2 <- bind_rows(coefs,phDelta2)
- options(knitr.kable.NA = '')
- kbl(stats_delta2, "latex", booktabs = T, linesep = "", label = 'stats_delta2',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stage on Delta (2.5-4 Hz) power")%>%
- pack_rows("Coefficients", 1, 7) %>%
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/stats_delta2.tex")
- ####################################################
- # Mixed model with sleep stage explaining IED rate #
- ####################################################
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- # determine reference level
- data_pow_wide$hyplabel = relevel(data_pow_wide$stage, ref="Pre")
- l1 <- lmer(IEDsum ~ stage + (1 | night) + (1 | patient), data_pow_wide)
- summary(l1)
- plot_model(l1)
- # get mathematical description of the model and write to latex
- # eq <- equatiomatic::extract_eq(l1)
- # fileConn<-file("D:/Dropbox/Apps/Overleaf/Hspike/formula/model1.tex")
- # writeLines(c("$$",eq,"$$"), fileConn)
- # close(fileConn)
- # Coefficients to LaTeX table
- temp = summary(l1)
- coefs <- as.data.frame(temp$coefficients)
- coefs[,5] = ifelse(coefs[,5] > .05, paste(round(coefs[,5],digits=2),sep=""), ifelse(coefs[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(coefs[,5] < .001,"<.001\\textsuperscript{**}", ifelse(coefs[,5] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- rownames(coefs) <- c("\\textit{Intercept}", "S3", "S2", "S1", "WASO", "REM", "Post")
- # Post-hoc tests to LaTeX table
- temp = emmeans(l1, list(pairwise ~ stage), adjust = "tukey")
- ph1 <- as.data.frame(temp$`pairwise differences of stage`)
- ph1 <- ph1[, -4] # remove df since they are at inf
- ph1[,5] = ifelse(ph1[,5] > .05, paste(round(ph1[,5],digits=2),sep=""), ifelse(ph1[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(ph1[,5] < .001,"<.001\\textsuperscript{**}", ifelse(ph1[,5] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- # Concatenate in one LaTeX table
- coefs <- data.frame(Predictor = row.names(coefs), coefs);
- rownames(coefs) <- NULL
- colnames(ph1) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","z", "\\textit{p}")
- colnames(coefs) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)", "df", "z","\\textit{p}")
- stats_IEDsum <- bind_rows(coefs,ph1)
- kbl(stats_IEDsum, "latex", booktabs = T, linesep = "", label = 'stats_IEDsum',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stage on IEDs rate")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- pack_rows("Sleep stages", 1, 7) %>% # latex_gap_space = "2em"
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/stats_IEDsum.tex")
- #########################################
- # correlation between power and IEDrate #
- #########################################
- # prepare data
- data_pow_wide <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/power_table_wide.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_pow_wide <- data_pow_wide[!data_pow_wide$hyplabel == "NO_SCORE", ]
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PHASE_1"] = "S1"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PHASE_2"] = "S2"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PHASE_3"] = "S3"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "AWAKE"] = "WASO"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "PRESLEEP"] = "Pre"
- data_pow_wide$hyplabel[data_pow_wide$hyplabel == "POSTSLEEP"] = "Post"
- data_pow_wide$hyplabel <- factor(data_pow_wide$hyplabel, levels = c("Pre","S3", "S2", "S1", "WASE", "REM", "Post"))
- data_pow_wide$stage <- data_pow_wide$hyplabel
- data_pow_wide$Patient <- factor(data_pow_wide$patient)
- data_pow_wide$night <- factor(data_pow_wide$part)
- data_pow_wide$Delta1_log <- log(data_pow_wide$Delta1)
- data_pow_wide$Delta2_log <- log(data_pow_wide$Delta2)
- data_pow_wide$IEDsum_log <- log(data_pow_wide$IEDsum)
- data_pow_wide$Patient <- factor(data_pow_wide$patient, levels = c(8:1))
- # Delta 1
- data_pow_wide2 <- data_pow_wide %>% mutate(Delta_log_bin = cut(Delta1_log, breaks=seq(-1.5,10.5,1)))
- levels(data_pow_wide2$Delta_log_bin) <- seq(1:12)-2
- data_pow_wide2 <- data_pow_wide2 %>% group_by(Delta_log_bin, IEDsum)
- data_pow_wide2 <- data_pow_wide2 %>% summarise(count = n(), Patient)
- data_pow_wide2 <- data_pow_wide2[order(data_pow_wide2$Patient), ]
- # # Delta 1 for S3
- # data_pow_wide2 <- data_pow_wide[data_pow_wide$hyplabel == "S3", ] %>% mutate(Delta_log_bin = cut(Delta1_log, breaks=seq(-1.5,10.5,1)))
- # levels(data_pow_wide2$Delta_log_bin) <- seq(1:12)-2
- # data_pow_wide2 <- data_pow_wide2 %>% group_by(Delta_log_bin, IEDsum)
- # data_pow_wide2 <- data_pow_wide2 %>% summarise(count = n(), Patient)
- # data_pow_wide2 <- data_pow_wide2[order(data_pow_wide2$Patient), ]
- # ggplot(data=data_pow_wide2[data_pow_wide2$IEDsum > 0, ], aes(x=Delta1_log_bin, y=IEDsum*6)) +
- D1 <- ggplot(data=data_pow_wide2, aes(x=Delta_log_bin, y=IEDsum*6, color = Patient)) +
- geom_count() +
- # geom_count(aes(size = after_stat(prop), group = Delta_log_bin, color = Patient)) +
- # scale_size_area(max_size = 3) +
- # geom_smooth(data=data_pow_wide, aes(x=Delta1_log, y=IEDsum), method="lm", fullrange = FALSE, color="red") +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- theme(axis.text.y = element_blank()) +
- theme_article() +
- theme(
- strip.background = element_blank(),
- strip.text.x = element_blank()
- ) +
- xlab("") +
- ylab("IEDs per minute") +
- # labs(size = "Proportion") +
- # coord_cartesian(xlim = c(2,11)) +
- # coord_cartesian(ylim = c(2,11)) +
- # facet_wrap(~Patient, ncol = 4, scales="free_x")
- facet_wrap(~Patient, ncol = 4)
- # ggsave("D:/Dropbox/Apps/Overleaf/Hspike/images/IEDrate_Delta1_count.pdf", width = 7, height = 4, units = "in")
- # Delta 2
- data_pow_wide2 <- data_pow_wide %>% mutate(Delta_log_bin = cut(Delta2_log, breaks=seq(-1.5,10.5,1)))
- levels(data_pow_wide2$Delta_log_bin) <- seq(1:12)-2
- data_pow_wide2 <- data_pow_wide2 %>% group_by(Delta_log_bin, IEDsum)
- data_pow_wide2 <- data_pow_wide2 %>% summarise(count = n(), Patient)
- data_pow_wide2 <- data_pow_wide2[order(data_pow_wide2$Patient), ]
- # ggplot(data=data_pow_wide2[data_pow_wide2$IEDsum > 0, ], aes(x=Delta1_log_bin, y=IEDsum*6)) +
- D2 <- ggplot(data=data_pow_wide2, aes(x=Delta_log_bin, y=IEDsum*6, color = Patient)) +
- # geom_count(aes(size = after_stat(prop), group = Delta_log_bin, color = Patient)) +
- geom_count() +
- # scale_size_area(max_size = 3) +
- # geom_smooth(data=data_pow_wide, aes(x=Delta1_log, y=IEDsum), method="lm", fullrange = FALSE, color="red") +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- theme(axis.text.y = element_blank()) +
- theme_article() +
- theme(
- strip.background = element_blank(),
- strip.text.x = element_blank()
- ) +
- # xlab("Delta2 power (log)")
- #xlab = expression(mu "Volts" / "Hertz" ^ 2) +
- # xlab = expression("Force spaces with ~" ~ mu ~ pi * sigma ~ pi) +
- # ylab( units~are~(mu*g)/L )
- # xlab(TeX(r'($\alpha x^\alpha$, where $\alpha \in \{1 \ldots 5\}$)')) +
- # xlab(TeX(r'($log(\mu V/Hz^2$))')) +
- xlab(TeX(r'($log(\mu V^2/Hz$))')) +
- ylab("IEDs per minute") +
- labs(size = "Observations") +
- # coord_cartesian(xlim = c(2,11)) +
- # coord_cartesian(ylim = c(2,11)) +
- # facet_wrap(~Patient, ncol = 4, scales="free_x")
- facet_wrap(~Patient, ncol = 4)
- # ggsave("D:/Dropbox/Apps/Overleaf/Hspike/images/IEDrate_Delta2_count.pdf", width = 7, height = 4, units = "in")
- ggarrange(D1, D2,
- ncol = 1, nrow = 2,
- vjust = 1, hjust = 0,
- labels = c("A","B"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/images/IEDrate_Delta_count.pdf")
- ###############################################
- # Mixed model with power explaining IED rate #
- ###############################################
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- # determine reference level
- data_pow_wide$hyplabel = relevel(data_pow_wide$stage, ref="Pre")
- l1 <- lmer(IEDsum ~ Delta1 + Delta2 + (1 | night) + (1 | patient), data_pow_wide)
- summary(l1)
- plot_model(l1)
- # # get mathematical description of the model and write to latex
- # eq <- equatiomatic::extract_eq(l1)
- # fileConn<-file("D:/Dropbox/Apps/Overleaf/Hspike/formula/model1.tex")
- # writeLines(c("$$",eq,"$$"), fileConn)
- # close(fileConn)
- # Coefficients to LaTeX table
- temp = summary(l1)
- coefs <- as.data.frame(temp$coefficients)
- coefs[,5] = ifelse(coefs[,5] > .05, paste(round(coefs[,5],digits=2),sep=""), ifelse(coefs[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(coefs[,5] < .001,"<.001\\textsuperscript{**}", ifelse(coefs[,5] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- rownames(coefs) <- c("\\textit{Intercept}", "Slow Wave", "Delta")
- kbl(coefs, "latex", booktabs = T, linesep = "", label = 'stats_IEDsum_vs_power',
- escape = FALSE, digits = 2,
- caption = "Effect of Slow Wave activity (0.1-2.5Hz) and Delta power (2.5-4Hz) on rate of IEDs")%>%
- kable_styling(latex_options = c("HOLD_position")) %>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/stats_IEDsum_vs_power.tex")
- # ###################################################################
- # # Mixed model with both sleep stage and power explaining IED rate #
- # ###################################################################
- #
- # # to create p-values
- # detach(package:lmerTest)
- # library(lmerTest)
- # library(lme4)
- #
- # # determine reference level
- # data_pow_wide$hyplabel = relevel(data_pow_wide$stage, ref="Pre")
- # l1 <- lmer(IEDsum ~ stage + Delta1 + Delta2 + (1 | night) + (1 | patient), data_pow_wide)
- #
- # summary(l1)
- # plot_model(l1)
- #
- # # # get mathematical description of the model and write to latex
- # # eq <- equatiomatic::extract_eq(l1)
- # # fileConn<-file("D:/Dropbox/Apps/Overleaf/Hspike/formula/model1.tex")
- # # writeLines(c("$$",eq,"$$"), fileConn)
- # # close(fileConn)
- #
- # # Coefficients to LaTeX table
- # temp = summary(l1)
- # coefs <- as.data.frame(temp$coefficients)
- # coefs[,5] = ifelse(coefs[,5] > .05, paste(round(coefs[,5],digits=2),sep=""), ifelse(coefs[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(coefs[,5] < .001,"<.001\\textsuperscript{**}", ifelse(coefs[,5] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- # rownames(coefs) <- c("\\textit{Intercept}", "S3", "S2", "S1", "Wake", "REM", "Post", "SW", "Delta")
- #
- # # Post-hoc tests to LaTeX table
- # temp = emmeans(l1, list(pairwise ~ stage), adjust = "tukey")
- # ph1 <- as.data.frame(temp$`pairwise differences of stage`)
- # ph1 <- ph1[, -4] # remove df since they are at inf
- # ph1[,5] = ifelse(ph1[,5] > .05, paste(round(ph1[,5],digits=2),sep=""), ifelse(ph1[,5] < .0001, "<.0001\\textsuperscript{***}", ifelse(ph1[,5] < .001,"<.001\\textsuperscript{**}", ifelse(ph1[,5] < .01, "<.01\\textsuperscript{*}", "<.05"))))
- #
- # # Concatenate in one LaTeX table
- # coefs <- data.frame(Predictor = row.names(coefs), coefs);
- # rownames(coefs) <- NULL
- # colnames(ph1) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","z", "\\textit{p}")
- # colnames(coefs) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)", "df", "z","\\textit{p}")
- # stats_IEDsum <- bind_rows(coefs,ph1)
- #
- # kbl(stats_IEDsum, "latex", booktabs = T, linesep = "", label = 'stats_IEDsum_power',
- # escape = FALSE, digits = 2,
- # caption = "Effect of sleepstages on IEDrate")%>%
- # kable_styling(latex_options = c("HOLD_position"))%>%
- # pack_rows("Sleep stages", 1, 7) %>% # latex_gap_space = "2em"
- # pack_rows("Power", 8, 9) %>%
- # pack_rows("Post-hoc comparisons", 10, 30) %>%
- # save_kable("D:/Dropbox/Apps/Overleaf/Hspike/tables/stats_IEDsum.tex")
- # Plot models
- set_theme(
- base = theme_article(),
- # panel.bordercol = NA
- )
- plot_IEDrate_model <- plot_model(
- lIEDrate,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- ylim(-3, 9) +
- font_size(labels.x = 9, labels.y = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(breaks=c(-2, 0, 8))
- plot_IEDrate_model$data$title = "IED rate (count/minute) model"
- plot_IEDrate_model <- plot_IEDrate_model + facet_wrap(~title, scales="free_y")
- plot_delta1_model <- plot_model(
- lDelta1,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- ylim(0, 300) +
- font_size(labels.x = 9, labels.y = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(expand=expansion(mult=c(0.1,0.1)), breaks=c(0, 270))
- plot_delta1_model$data$title = "SWA (0.1-2.5 Hz) model"
- plot_delta1_model <- plot_delta1_model + facet_wrap(~title, scales="free_y")
- plot_delta2_model <- plot_model(
- lDelta2,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- ylim(-1, 41) +
- font_size(labels.x = 9, labels.y = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(breaks=c(0, 40))
- plot_delta2_model$data$title = "Delta (2.5-4.0 Hz) model"
- plot_delta2_model <- plot_delta2_model + facet_wrap(~title, scales="free_y")
- # Boxplots together in Figure
- ggarrange(plot_IED_rate, plot_IEDrate_model, plot_delta1, plot_delta1_model, plot_delta2, plot_delta2_model,
- ncol = 2, nrow = 3,
- vjust = 1.5, hjust = -1,
- labels = c("A","B","C","D","E","F","G","H"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/images/IEDrate_delta_boxplots.pdf")
- ###############################
- # IED amplitude & sleep stage #
- ###############################
- # prepare data
- data_amp <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/amplitude_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_amp <- data_amp[!data_amp$hyplabel == "NO_SCORE", ]
- data_amp <- data_amp[!data_amp$hyplabel == "NO_SCORE", ]
- data_amp$hyplabel[data_amp$hyplabel == "PHASE_1"] = "S1"
- data_amp$hyplabel[data_amp$hyplabel == "PHASE_2"] = "S2"
- data_amp$hyplabel[data_amp$hyplabel == "PHASE_3"] = "S3"
- data_amp$hyplabel[data_amp$hyplabel == "AWAKE"] = "WASO"
- data_amp$hyplabel[data_amp$hyplabel == "PRESLEEP"] = "Pre"
- data_amp$hyplabel[data_amp$hyplabel == "POSTSLEEP"] = "Post"
- data_amp$stage <- factor(data_amp$hyplabel, levels = c("Pre","S3", "S2", "S1", "Wake", "REM", "Post"))
- data_amp$Patient <- factor(data_amp$patient, levels = c(8:1))
- data_amp$night <- factor(data_amp$part)
- data_amp$Template <- factor(data_amp$template)
- # # average over patient/part/sleepstage/template for plotting
- # posamp <- setNames(aggregate(data_amp$posamp, by = c(list(data_amp$patient, data_amp$night, data_amp$Template, data_amp$hyplabel)), mean), c("Patient", "part", "Template", "hyplabel", "posamp"))
- # negamp <- setNames(aggregate(data_amp$negamp, by = c(list(data_amp$patient, data_amp$night, data_amp$Template, data_amp$hyplabel)), mean), c("Patient", "part", "Template", "hyplabel", "negamp"))
- # data_amp_mean <- merge(posamp, negamp)
- # do not separate into templates
- posamp <- setNames(aggregate(data_amp$posamp, by = c(list(data_amp$patient, data_amp$night, data_amp$hyplabel)), mean), c("Patient", "night", "hyplabel", "posamp"))
- negamp <- setNames(aggregate(data_amp$negamp, by = c(list(data_amp$patient, data_amp$night, data_amp$hyplabel)), mean), c("Patient", "night", "hyplabel", "negamp"))
- data_amp_mean <- merge(posamp, negamp)
- # # relative to pre-sleep
- # temp_pos <- setNames(aggregate(data_amp$posamp, by = list(data_amp$patient, data_amp$part, data_amp$Template, data_amp$hyplabel), mean), c("Patient", "part", "Template", "hyplabel", "Pre_pos"))
- # temp_neg <- setNames(aggregate(data_amp$negamp, by = list(data_amp$patient, data_amp$part, data_amp$Template, data_amp$hyplabel), mean), c("Patient", "part", "Template", "hyplabel", "Pre_neg"))
- # temp_pos <- temp_pos[temp_pos$hyplabel=="Pre", ]
- # temp_neg <- temp_neg[temp_neg$hyplabel=="Pre", ]
- # temp_pos <- subset(temp_pos, select = -c(hyplabel))
- # temp_neg <- subset(temp_neg, select = -c(hyplabel))
- # data_amp_mean <- merge(data_amp_mean, temp_pos)
- # data_amp_mean <- merge(data_amp_mean, temp_neg)
- # data_amp_mean$Zposamp <- (data_amp_mean$posamp-data_amp_mean$Pre_pos)
- # data_amp_mean$Znegamp <- (data_amp_mean$negamp-data_amp_mean$Pre_neg)
- # data_amp_mean$diffamp <- data_amp_mean$Zposamp + data_amp_mean$Znegamp
- # # Normalized over all trials
- # y1 <- setNames(aggregate(data_amp_mean$posamp, by = c(list(data_amp_mean$Patient, data_amp_mean$Template)), mean), c("Patient", "Template", "Mposamp"))
- # y1sd <- setNames(aggregate(data_amp_mean$posamp, by = c(list(data_amp_mean$Patient, data_amp_mean$Template)), sd), c("Patient", "Template", "SDposamp"))
- # y2 <- setNames(aggregate(data_amp_mean$negamp, by = c(list(data_amp_mean$Patient, data_amp_mean$Template)), mean), c("Patient", "Template", "Mnegamp"))
- # y2sd <- setNames(aggregate(data_amp_mean$negamp, by = c(list(data_amp_mean$Patient, data_amp_mean$Template)), sd), c("Patient", "Template", "SDnegamp"))
- # do not separate into templates
- y1 <- setNames(aggregate(data_amp_mean$posamp, by = c(list(data_amp_mean$Patient)), mean), c("Patient", "Mposamp"))
- y1sd <- setNames(aggregate(data_amp_mean$posamp, by = c(list(data_amp_mean$Patient)), sd), c("Patient", "SDposamp"))
- y2 <- setNames(aggregate(data_amp_mean$negamp, by = c(list(data_amp_mean$Patient)), mean), c("Patient", "Mnegamp"))
- y2sd <- setNames(aggregate(data_amp_mean$negamp, by = c(list(data_amp_mean$Patient)), sd), c("Patient", "SDnegamp"))
- data_amp_mean <- merge(data_amp_mean,y1)
- data_amp_mean <- merge(data_amp_mean,y2)
- data_amp_mean <- merge(data_amp_mean,y1sd)
- data_amp_mean <- merge(data_amp_mean,y2sd)
- data_amp_mean$Zposamp <- (data_amp_mean$posamp-data_amp_mean$Mposamp)/data_amp_mean$SDposamp
- data_amp_mean$Znegamp <- (data_amp_mean$negamp-data_amp_mean$Mnegamp)/data_amp_mean$SDnegamp
- data_amp_mean$diffamp <- data_amp_mean$Zposamp - data_amp_mean$Znegamp
- data_amp_mean$Patient <- as.factor(data_amp_mean$Patient)
- data_amp_mean$hyplabel <- factor(data_amp_mean$hyplabel, levels = c("Pre","Post", "REM", "WASO", "S1", "S2", "S3"))
- data_amp_mean_sel <- data_amp_mean[!data_amp_mean$hyplabel=="Pre", ]
- # plot
- data_amp_mean_sel$title1 = "Standardized spike amplitude"
- data_amp_mean_sel$title2 = "Standardized slow-wave amplitude"
- data_amp_mean_sel$title3 = "Standardized spike vs. slow-wave amplitude"
- data_amp_mean_sel$Patient <- factor(data_amp_mean_sel$Patient, levels = c(8:1))
- plot_amp_pos <- ggplot(data=data_amp_mean_sel, aes(y=hyplabel, x=Zposamp)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, night), col = Patient), position=position_dodge(width=0.5), size = 1) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- coord_cartesian(xlim = c(-2.5, 2.5)) +
- facet_wrap(~title1)
- plot_amp_neg <- ggplot(data=data_amp_mean_sel, aes(y=hyplabel, x=Znegamp)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, night), col = Patient), position=position_dodge(width=0.5),size = 1) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- coord_cartesian(xlim = c(-3, 3)) +
- # coord_cartesian(xlim = c(-300, 100)) +
- facet_wrap(~title2)
- plot_amp_diff <- ggplot(data=data_amp_mean_sel, aes(y=hyplabel, x=diffamp)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, night), col = Patient), position=position_dodge(width=0.5), size = 1) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- coord_cartesian(xlim = c(-5, 5)) +
- scale_x_continuous(breaks=c(-5, 0, 5)) +
- facet_wrap(~title3)
- # plot pos vs neg in count scatter plot
- data_bin <- data_amp %>% group_by(Patient) %>% mutate(pos_bin = cut(posamp, 20))
- data_bin <- data_bin %>% group_by(Patient) %>% mutate(neg_bin = cut(negamp, 20))
- ggplot(data=data_bin, aes(y=pos_bin, x=neg_bin)) +
- geom_count(aes(color = Patient)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- theme(axis.text.y = element_blank()) +
- theme_article() +
- theme(
- strip.background = element_blank(),
- strip.text.x = element_blank(),
- axis.text.x = element_blank(),
- axis.text.y = element_blank(),
- axis.ticks = element_blank()
- ) +
- ylab("Peak amplitude") +
- xlab("Slow wave amplitude") +
- # labs(size = "Proportion") +
- facet_wrap(~Patient, ncol = 4, scales = "free") +
- theme(aspect.ratio = 1)
- ggsave("D:/Dropbox/Apps/Overleaf/Hspike/images/amp_corr.pdf", width = 7, height = 4, units = "in")
- #########################
- ## STATISTICS LFP peaks #
- #########################
- # prepare data
- data_amp <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/amplitude_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_amp <- data_amp[!data_amp$hyplabel == "NO_SCORE", ]
- data_amp <- data_amp[!data_amp$hyplabel == "NO_SCORE", ]
- data_amp$hyplabel[data_amp$hyplabel == "PHASE_1"] = "S1"
- data_amp$hyplabel[data_amp$hyplabel == "PHASE_2"] = "S2"
- data_amp$hyplabel[data_amp$hyplabel == "PHASE_3"] = "S3"
- data_amp$hyplabel[data_amp$hyplabel == "AWAKE"] = "WASO"
- data_amp$hyplabel[data_amp$hyplabel == "PRESLEEP"] = "Pre"
- data_amp$hyplabel[data_amp$hyplabel == "POSTSLEEP"] = "Post"
- data_amp$stage <- factor(data_amp$hyplabel, levels = c("Pre","S3", "S2", "S1", "WASO", "REM", "Post"))
- data_amp$Patient <- factor(data_amp$patient, levels = c(8:1))
- data_amp$night <- factor(data_amp$part)
- data_amp$template <- factor(data_amp$template)
- # Standardize data
- y1 <- setNames(aggregate(data_amp$posamp, by = c(list(data_amp$patient, data_amp$night, data_amp$template)), mean), c("patient", "night", "template", "Mposamp"))
- y2 <- setNames(aggregate(data_amp$negamp, by = c(list(data_amp$patient, data_amp$night, data_amp$template)), mean), c("patient", "night", "template", "Mnegamp"))
- y1sd <- setNames(aggregate(data_amp$posamp, by = c(list(data_amp$patient, data_amp$night, data_amp$template)), sd), c("patient", "night", "template", "SDposamp"))
- y2sd <- setNames(aggregate(data_amp$negamp, by = c(list(data_amp$patient, data_amp$night, data_amp$template)), sd), c("patient", "night", "template", "SDnegamp"))
- data_amp <- merge(data_amp,y1)
- data_amp <- merge(data_amp,y2)
- data_amp <- merge(data_amp,y1sd)
- data_amp <- merge(data_amp,y2sd)
- data_amp$Zposamp <- (data_amp$posamp-data_amp$Mposamp)/data_amp$SDposamp
- data_amp$Znegamp <- (data_amp$negamp-data_amp$Mnegamp)/data_amp$SDnegamp
- data_amp$Zdiffamp <- data_amp$Zposamp - data_amp$Znegamp
- # fit model
- data_amp$stage = relevel(data_amp$stage, ref="Pre")
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- lpos <- lmer(posamp ~ stage + (1 | patient) + (1 | night), data_amp, control = lmerControl(optimizer ='Nelder_Mead'))
- lneg <- lmer(negamp ~ stage + (1 | night) + (1 | template) + (1 | patient), data_amp, control = lmerControl(optimizer ='Nelder_Mead'))
- ldiff <- lmer(Zdiffamp ~ stage + (1 | night) + (1 | template) + (1 | patient), data_amp, control = lmerControl(optimizer ='Nelder_Mead'))
- summary(lpos)
- plot_model(lpos)
- summary(lneg)
- plot_model(lneg)
- summary(ldiff)
- plot_model(ldiff)
- # Post-hoc tests
- temp = emmeans(lpos, list(pairwise ~ stage), adjust = "tukey")
- phpos <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phpos) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phpos$df <- NA
- temp = emmeans(lneg, list(pairwise ~ stage), adjust = "tukey")
- phneg <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phneg) <- c("Comparison","EstimateNeg","SENeg","dfNeg","Z ratioNeg","pNeg")
- phneg$dfNeg <- NA
- temp = emmeans(ldiff, list(pairwise ~ stage), adjust = "tukey")
- phdiff <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phdiff) <- c("Comparison","EstimateDiff","SEDiff","dfDiff","Z ratioDiff","pDiff")
- phdiff$dfDiff <- NA
- # Mathematical description of the model and write to latex
- # eq <- equatiomatic::extract_eq(lpos)
- # fileConn<-file("D:/Dropbox/Apps/Overleaf/Hspike/formula/model_posamp.tex")
- # writeLines(c("$$",eq,"$$"), fileConn)
- # close(fileConn)
- #############################################
- # Coefficients to LaTeX table (and reorder) #
- #############################################
- # Model coefficients for LaTeX table
- temp = summary(lpos)
- spos <- temp$coefficients
- spos <- data.frame(Predictor = row.names(spos), spos);
- rownames(spos) <- NULL
- colnames(spos) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lneg)
- sneg <- temp$coefficients
- sneg <- data.frame(Predictor = row.names(sneg), sneg)
- colnames(sneg) <- c("Predictor","EstimateNeg","SDNeg","dfNeg","tNeg","pNeg")
- temp = summary(lneg)
- sdiff <- temp$coefficients
- sdiff <- data.frame(Predictor = row.names(sdiff), sdiff)
- colnames(sdiff) <- c("Predictor","EstimatePos","SDDiff","dfDiff","tDiff","pDiff")
- sneg$id <- 1:nrow(sneg)
- coef <- merge(spos, sneg)
- coef <- merge(coef, sdiff)
- coef <- coef[order(coef$id), ]
- coef <- coef[, c(-1, -12)]
- rownames(coef) <- NULL
- coef[, 3] = round(coef[,3],digits=0)
- coef[, 8] = round(coef[,8],digits=0)
- coef[,13] = round(coef[,8],digits=0)
- coef$Predictor <- c("\\textit{Intercept}","S3", "S2", "S1", "WASO", "Post", "REM")
- coef <- coef[, c(16,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)]
- # Post-hoc comparisons
- phneg$id <- 1:nrow(phneg)
- ph <- merge(phpos,phneg)
- ph <- merge(ph,phdiff)
- ph <- ph[order(ph$id), ]
- ph <- ph[, -12]
- rownames(ph) <- NULL
- # Concatenate in one LaTeX table
- colnames(ph) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","df", "z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}")
- colnames(coef) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","df", "z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}")
- stats_amp <- bind_rows(coef,ph)
- colnames(stats_amp) <- c("", "Coef $\\beta$","SE($\\beta$)","df", "z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}")
- stats_amp[,6] = ifelse(stats_amp[,6] > .05, paste(round(stats_amp[,6],digits=2),sep=""),
- ifelse(stats_amp[,6] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_amp[,6] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_amp[,6] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_amp[,11] = ifelse(stats_amp[,11] > .05, paste(round(stats_amp[,11],digits=2),sep=""),
- ifelse(stats_amp[,11] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_amp[,11] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_amp[,11] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_amp[,16] = ifelse(stats_amp[,16] > .05, paste(round(stats_amp[,16],digits=2),sep=""),
- ifelse(stats_amp[,16] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_amp[,16] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_amp[,16] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- options(knitr.kable.NA = '')
- kbl(stats_amp, "latex", booktabs = T, linesep = "", label = 'stats_amp',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stage on ERP peak amplitude")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- pack_rows("Sleep stages", 1, 7) %>% # latex_gap_space = "2em"
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- add_header_above(c(" ", "Spike amplitude" = 5, "Slow wave amplitude" = 5, "Difference amplitude" = 5)) %>%
- kable_styling(latex_options = c("scale_down"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/stats_amp.tex")
- #################
- ## Plot models ##
- #################
- set_theme(
- base = theme_article(),
- # panel.bordercol = NA
- )
- plot_amp_pos_model <- plot_model(
- lpos,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- font_size(labels.x = 9, labels.y = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(breaks=c(-20, 0, 50, 100, 150))
- plot_amp_pos_model$data$title = "Model fixed effects"
- plot_amp_pos_model <- plot_amp_pos_model + facet_wrap(~title, scales="free_y")
- plot_amp_neg_model <- plot_model(
- lneg,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- font_size(labels.x = 9, labels.y = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(breaks=c(0, 50, 100, 150))
- plot_amp_neg_model$data$title = "Model fixed effects"
- plot_amp_neg_model <- plot_amp_neg_model + facet_wrap(~title, scales="free_y")
- plot_amp_diff_model <- plot_model(
- ldiff,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- font_size(labels.x = 9, labels.y = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(breaks=c(-0.4, -0.2, 0, 0.2, 0.4))
- plot_amp_diff_model$data$title = "Model fixed effects"
- plot_amp_diff_model <- plot_amp_diff_model + facet_wrap(~title, scales="free_y")
- ###############################
- # Boxplots together in Figure #
- ###############################
- ggarrange(plot_amp_pos, plot_amp_pos_model, plot_amp_neg, plot_amp_neg_model, plot_amp_diff, plot_amp_diff_model,
- ncol = 2, nrow = 3,
- vjust = 1.5, hjust = -1,
- labels = c("A","B","C","D","E","F","G","H"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/images/amp_boxplots.pdf")
- ######################################
- # Plot normalized PSTH & sleep stage #
- ######################################
- # prepare data
- data_psth <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/psth_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_psth$hyplabel[data_psth$hyplabel == "Wake"] = "WASO"
- data_psth$hyplabel <- factor(data_psth$hyplabel, levels = c("Pre", "Post", "REM", "WASO", "S1", "S2", "S3"))
- data_psth$Patient <- factor(data_psth$Patient, levels = c(8:1))
- data_psth$part <- factor(data_psth$part)
- data_psth$template <- factor(data_psth$template)
- data_psth$unit <- factor(data_psth$unit)
- data_psth$Type <- factor(data_psth$SUA)
- # data_sel <- data_psth[data_psth$hyplabel=="S1", ]
- data_sel <- setNames(aggregate(data_psth$responsive, by = c(list(data_psth$Patient, data_psth$part, data_psth$unit, data_psth$Type)), mean), c("Patient", "part", "unit", "Type", "responsive"))
- data_sel$responsive = as.integer(data_sel$responsive > 0)
- t = data_sel %>% count(Patient, part, responsive, Type)
- t2 <- pivot_wider(t, names_from = "Type", names_prefix = "SUA", values_from = "n")
- t3 <- pivot_wider(t2, names_from = "responsive", names_prefix = "responsive", values_from = c("SUA1", "SUA0"))
- # t4 <- pivot_wider(t, names_from = c("responsive", "Type"), values_from = c("n"))
- #
- # ############# USE THISFOR TABLE OF SUA/MUA reporting ###############
- #
- #
- # test <- setNames(aggregate(data_psth$responsive, by = c(list(data_psth$Patient, data_psth$unit, data_psth$template, data_psth$Type)), mean), c("Patient", "unit", "template", "Type", "responsive"))
- #
- # # select responsive units
- # data_psth <- data_psth[c(data_psth$responsive == 1), ]
- #
- # # remove unresponsive patient - already done in MATLAB
- # # data_psth <- data_psth[-c(data_psth$Patient == 7), ]
- #
- # # select SUA
- # # data_psth <- data_psth[c(data_psth$SUA == 1), ]
- posrate <- setNames(aggregate(data_psth$posrate, by = c(list(data_psth$Patient, data_psth$unit, data_psth$template, data_psth$hyplabel, data_psth$Type)), mean), c("Patient", "unit", "template", "hyplabel", "Type", "posrate"))
- negrate <- setNames(aggregate(data_psth$negrate, by = c(list(data_psth$Patient, data_psth$unit, data_psth$template, data_psth$hyplabel, data_psth$Type)), mean), c("Patient", "unit", "template", "hyplabel", "Type", "negrate"))
- data_psth_mean <- merge(posrate, negrate)
- y1 <- setNames(aggregate(data_psth_mean$posrate, by = c(list(data_psth_mean$Patient, data_psth_mean$unit, data_psth_mean$template, data_psth_mean$Type)), mean), c("Patient", "unit", "template", "Type", "Mposrate"))
- y1sd <- setNames(aggregate(data_psth_mean$posrate, by = c(list(data_psth_mean$Patient, data_psth_mean$unit, data_psth_mean$template, data_psth_mean$Type)), sd), c("Patient", "unit", "template", "Type", "SDposrate"))
- y2 <- setNames(aggregate(data_psth_mean$negrate, by = c(list(data_psth_mean$Patient, data_psth_mean$unit, data_psth_mean$template, data_psth_mean$Type)), mean), c("Patient", "unit", "template", "Type", "Mnegrate"))
- y2sd <- setNames(aggregate(data_psth_mean$negrate, by = c(list(data_psth_mean$Patient, data_psth_mean$unit, data_psth_mean$template, data_psth_mean$Type)), sd), c("Patient", "unit", "template", "Type", "SDnegrate"))
- data_psth_mean <- merge(data_psth_mean,y1)
- data_psth_mean <- merge(data_psth_mean,y2)
- data_psth_mean <- merge(data_psth_mean,y1sd)
- data_psth_mean <- merge(data_psth_mean,y2sd)
- data_psth_mean$Zposrate <- (data_psth_mean$posrate-data_psth_mean$Mposrate)/data_psth_mean$SDposrate
- data_psth_mean$Znegrate <- (data_psth_mean$negrate-data_psth_mean$Mnegrate)/data_psth_mean$SDnegrate
- data_psth_mean$diffrate <- data_psth_mean$Zposrate - data_psth_mean$Znegrate
- # plot
- data_psth_mean$title1 = "Standardized firingrate during spike"
- data_psth_mean$title2 = "Standardized firingrate during slow wave"
- data_psth_mean$title3 = "Relative difference"
- data_psth_mean_sel <- data_psth_mean[!data_psth_mean$hyplabel=="Pre", ]
- plot_cnt_pos <- ggplot(data=data_psth_mean_sel, aes(y=hyplabel, x=Zposrate)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, unit), col = Patient, shape = Type), position=position_dodge(width=0.5), alpha = 0.2, size = 0.8) +
- geom_point(data=data_psth_mean_sel[data_psth_mean_sel$Type == 1, ],
- aes(group = interaction(Patient, unit), col = Patient, shape = Type), position=position_dodge(width=0.5), size = 0.8) +
- scale_shape_discrete(label = c("MUA", "SUA"))+
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- coord_cartesian(xlim = c(-2.5, 2.5)) +
- scale_x_continuous(breaks = c(-2.5, 0, 2.5)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title1)
- plot_cnt_neg <- ggplot(data=data_psth_mean_sel, aes(y=hyplabel, x=Znegrate)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, unit), col = Patient, shape = Type), position=position_dodge(width=0.5), alpha = 0.2, size = 0.8) +
- geom_point(data=data_psth_mean_sel[data_psth_mean_sel$Type == 1, ],
- aes(group = interaction(Patient, unit), col = Patient, shape = Type), position=position_dodge(width=0.5), size = 0.8) +
- scale_shape_discrete(label = c("MUA", "SUA"))+
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- coord_cartesian(xlim = c(-2.5, 2.5)) +
- scale_x_continuous(breaks = c(-2.5, 0, 2.5)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title2)
- plot_cnt_diff <- ggplot(data=data_psth_mean_sel, aes(y=hyplabel, x=diffrate)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, unit), col = Patient, shape = Type), position=position_dodge(width=0.5), alpha = 0.2, size = 0.8) +
- geom_point(data=data_psth_mean_sel[data_psth_mean_sel$Type == 1, ],
- aes(group = interaction(Patient, unit), col = Patient, shape = Type), position=position_dodge(width=0.5), size = 0.8) +
- scale_shape_discrete(label = c("MUA", "SUA"))+
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- coord_cartesian(xlim = c(-4, 4)) +
- scale_x_continuous(breaks = c(-4, 0, 4)) +
- facet_wrap(~title3)
- ###################################
- ## STATISTICS Positive peaks PSTH #
- ###################################
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- # prepare data
- data_psth <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/psth_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_psth$hyplabel[data_psth$hyplabel == "Wake"] = "WASO"
- data_psth$hyplabel <- factor(data_psth$hyplabel, levels = c("Pre", "Post", "REM", "WASO", "S1", "S2", "S3"))
- data_psth$Patient <- factor(data_psth$Patient, levels = c(8:1))
- data_psth$part <- factor(data_psth$part)
- data_psth$template <- factor(as.integer(data_psth$template) + as.integer(data_psth$part) * 100 + as.integer(data_psth$Patient) * 1000) # beacuse template nr. resets for each night/patient
- data_psth$unit <- factor(data_psth$unit)
- data_psth$responsive <- factor(data_psth$responsive)
- data_psth$diffrate <- data_psth$posrate - data_psth$negrate
- # select responsive units
- data_psth <- data_psth[c(data_psth$responsive == 1), ]
- # remove unresponsive patient
- # data_psth <- data_psth[-c(data_psth$Patient == 7), ]
- # remove NaN
- data_psth <- data_psth[!is.nan(data_psth$posrate), ]
- # Rename for plotting
- data_psth$night <- factor(data_psth$part)
- # Reorder for table
- data_psth$stage <- factor(data_psth$hyplabel, levels = c("Pre","S3", "S2", "S1", "WASO", "REM", "Post"))
- # fit model
- data_psth$stage = relevel(data_psth$stage, ref="Pre")
- lpos_SUA <- lmer(posrate ~ stage + (1 | Patient) + (1 | template) + (1 | unit), data_psth[data_psth$SUA == 1, ], control = lmerControl(optimizer ='Nelder_Mead'))
- lneg_SUA <- lmer(negrate ~ stage + (1 | Patient) + (1 | template) + (1 | unit), data_psth[data_psth$SUA == 1, ], control = lmerControl(optimizer ='Nelder_Mead'))
- ldiff_SUA <- lmer(diffrate ~ stage + (1 | Patient) + (1 | template) + (1 | unit), data_psth[data_psth$SUA == 1, ], control = lmerControl(optimizer ='Nelder_Mead'))
- lpos_MUA <- lmer(posrate ~ stage + (1 | Patient) + (1 | template) + (1 | unit), data_psth[data_psth$SUA == 0, ], control = lmerControl(optimizer ='Nelder_Mead'))
- lneg_MUA <- lmer(negrate ~ stage + (1 | Patient) + (1 | template) + (1 | unit), data_psth[data_psth$SUA == 0, ], control = lmerControl(optimizer ='Nelder_Mead'))
- ldiff_MUA <- lmer(diffrate ~ stage + (1 | Patient) + (1 | template) + (1 | unit), data_psth[data_psth$SUA == 0, ], control = lmerControl(optimizer ='Nelder_Mead'))
- lpos <- lmer(posrate ~ stage + (1 | Patient) + (1 | template) + (1 | SUA), data_psth, control = lmerControl(optimizer ='Nelder_Mead'))
- lneg <- lmer(negrate ~ stage + (1 | Patient) + (1 | template) + (1 | SUA), data_psth, control = lmerControl(optimizer ='Nelder_Mead'))
- ldiff <- lmer(diffrate ~ stage + (1 | Patient) + (1 | template) + (1 | SUA), data_psth, control = lmerControl(optimizer ='Nelder_Mead'))
- summary(lpos_SUA)
- plot_model(lpos_SUA)
- summary(lneg_SUA)
- plot_model(lneg_SUA)
- summary(ldiff_SUA)
- plot_model(ldiff_SUA)
- summary(lpos_MUA)
- plot_model(lpos_MUA)
- summary(lneg_MUA)
- plot_model(lneg_MUA)
- summary(ldiff_MUA)
- plot_model(ldiff_MUA)
- summary(lpos)
- plot_model(lpos)
- summary(lneg)
- plot_model(lneg)
- summary(ldiff)
- plot_model(ldiff)
- # Post-hoc tests
- temp = emmeans(lpos, list(pairwise ~ stage), adjust = "tukey")
- phpos <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phpos) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phpos$df <- NA
- temp = emmeans(lneg, list(pairwise ~ stage), adjust = "tukey")
- phneg <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phneg) <- c("Comparison","EstimateNeg","SENeg","dfNeg","Z ratioNeg","pNeg")
- temp = emmeans(lneg, list(pairwise ~ stage), adjust = "tukey")
- phneg <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phneg) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phneg$df <- NA
- temp = emmeans(ldiff, list(pairwise ~ stage), adjust = "tukey")
- phdiff <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phdiff) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phdiff$df <- NA
- #########################################
- # Model coefficients to table for LaTeX #
- #########################################
- # Model coefficients for table
- temp = summary(lpos)
- spos <- temp$coefficients
- spos <- data.frame(Predictor = row.names(spos), spos);
- rownames(spos) <- NULL
- colnames(spos) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lneg)
- sneg <- temp$coefficients
- sneg <- data.frame(Predictor = row.names(sneg), sneg);
- rownames(sneg) <- NULL
- colnames(sneg) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(ldiff)
- sdiff <- temp$coefficients
- sdiff <- data.frame(Predictor = row.names(sdiff), sdiff);
- rownames(sdiff) <- NULL
- colnames(sdiff) <- c("Predictor","Estimate","SD","df","t","p")
- # to LaTeX table (and reorder)
- sneg$id <- 1:nrow(sneg)
- coef <- merge(sneg, spos, by="Predictor")
- coef <- merge(coef, sdiff, by="Predictor")
- coef <- coef[order(coef$id), ]
- coef <- coef[, c(-1, -7)]
- rownames(coef) <- NULL
- coef[,3] = round(coef[,3],digits=0)
- coef[,8] = round(coef[,8],digits=0)
- coef[,13] = round(coef[,13],digits=0)
- coef$Predictor <- c("\\textit{Intercept}","S3", "S2", "S1", "WASO", "Post", "REM")
- coef <- coef[, c(16,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)]
- # posthoc coefficients
- phneg$id <- 1:nrow(phneg)
- ph <- merge(phneg,phpos, by = "Comparison")
- ph <- merge(ph,phdiff, by = "Comparison")
- ph <- ph[order(ph$id), ]
- ph <- ph[, -7]
- rownames(ph) <- NULL
- # Concatenate in one LaTeX table
- colnames(ph) <- c("Predictor",
- "Coef $\\beta$","SE($\\beta$)","df", "z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}")
- colnames(coef) <- c("Predictor",
- "Coef $\\beta$","SE($\\beta$)","df", "z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}",
- "Coef $\\beta$","SE($\\beta$)","df","z", "\\textit{p}")
- stats_cnt <- bind_rows(coef,ph)
- colnames(stats_cnt) <- c("", "Coef $\\beta$","SE($\\beta$)","df", "z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}")
- stats_cnt[,6] = ifelse(stats_cnt[,6] > .05, paste(round(stats_cnt[,6],digits=2),sep=""),
- ifelse(stats_cnt[,6] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_cnt[,6] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_cnt[,6] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_cnt[,11] = ifelse(stats_cnt[,11] > .05, paste(round(stats_cnt[,11],digits=2),sep=""),
- ifelse(stats_cnt[,11] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_cnt[,11] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_cnt[,11] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_cnt[,16] = ifelse(stats_cnt[,16] > .05, paste(round(stats_cnt[,16],digits=2),sep=""),
- ifelse(stats_cnt[,16] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_cnt[,16] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_cnt[,16] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- options(knitr.kable.NA = '')
- kbl(stats_cnt, "latex", booktabs = T, linesep = "", label = 'unit_stats',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stage on firing rates during IED")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- pack_rows("Sleep stages", 1, 7) %>% # latex_gap_space = "2em"
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- add_header_above(c(" ", "Spike" = 5, "Wave" = 5, "Ratio" = 5)) %>%
- kable_styling(latex_options = c("scale_down"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/unit_stats.tex")
- #################
- ## Plot models ##
- #################
- set_theme(
- base = theme_article(),
- # panel.bordercol = NA
- )
- plot_cnt_pos_model <- plot_model(
- lpos,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- # ylim(-5, 6) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-6, 8), breaks = c(-6, 0, 8))
- plot_cnt_pos_model$data$title = "Model of spike count during LFP spike (vs. Pre-sleep)"
- plot_cnt_pos_model$data$title = "Model fixed effects"
- plot_cnt_pos_model <- plot_cnt_pos_model + facet_wrap(~title, scales="free_y")
- plot_cnt_neg_model <- plot_model(
- lneg,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- ylim(-3, 2) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-3, 2), breaks = c(-3, 0, 2))
- plot_cnt_neg_model$data$title = "Model of spike count during slow-wave (vs. Pre-sleep)"
- plot_cnt_neg_model$data$title = "Model fixed effects"
- plot_cnt_neg_model <- plot_cnt_neg_model + facet_wrap(~title, scales="free_y")
- plot_cnt_diff_model <- plot_model(
- ldiff,
- title = "",
- colors = "bw",
- axis.labels = "",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- ylim(-5, 7) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-5, 7), breaks = c(-5, 0, 7))
- plot_cnt_diff_model$data$title = "Model of spike count difference between LFP spike & slow wave (vs. Pre-sleep)"
- plot_cnt_diff_model$data$title = "Model fixed effects"
- plot_cnt_diff_model <- plot_cnt_diff_model + facet_wrap(~title, scales="free_y")
- ggarrange(plot_cnt_pos, plot_cnt_pos_model, plot_cnt_neg, plot_cnt_neg_model, plot_cnt_diff, plot_cnt_diff_model,
- ncol = 2, nrow = 3,
- vjust = 1.5, hjust = -1,
- labels = c("A","B","C","D","E","F","G","H"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/images/unit_timelocked_boxplots.pdf")
- #########################################
- # Plot correlation between LFP and PSTH #
- #########################################
- # prepare data
- data_rho <- read.csv(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/data/hspike/rho_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_rho$Patient <- factor(data_rho$Patient, levels = c(8:1))
- data_rho$part <- factor(data_rho$part)
- data_rho$template <- factor(data_rho$template)
- data_rho$unit <- factor(data_rho$unit)
- # select responsive units
- # data_rho <- data_rho[c(data_rho$responsive == 1), ]
- plot_rho <- ggplot(data=data_rho, aes(y=Patient, x=corr_rho)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(aes(group = interaction(Patient, unit), col = Patient), position=position_dodge(width=0.3), alpha = 0.5) +
- # guides(colour = "none") +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- theme(legend.position="bottom") +
- coord_cartesian(xlim = c(-0.6, 0.6))
- final_plot = ggarrange(plot_rho,
- nrow = 1, ncol = 1,
- vjust = 1.5, hjust = -1,
- legend = "bottom",
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Hspike/images/rho_boxplots.pdf")
- ##########
- # Combine:
- data_psth
- data_amp
- ###########################
- # Unit baseline behaviour #
- ###########################
- data_window <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/window_spike_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_window$hyplabel[data_window$hyplabel == "Wake"] = "WASO"
- data_window$hyplabel <- factor(data_window$hyplabel, levels = c("Pre", "Post", "REM", "WASO", "S1", "S2", "S3"))
- data_window$Patient <- factor(data_window$patient, levels = c(8:1))
- data_window$Night <- factor(data_window$part)
- data_window$Unit <- factor(data_window$unit)
- data_window$responsive <- factor(data_window$responsive)
- data_window$Type <- factor(data_window$Type)
- levels(data_window$Type)[levels(data_window$Type)=="good"] <- "SUA"
- levels(data_window$Type)[levels(data_window$Type)=="mua"] <- "MUA"
- data_window$Type <- factor(ordered(data_window$Type, levels = c("MUA", "SUA")))
- data_sel <- na.omit(data_window) # removing rows with missing data
- data_sel <- data_sel[data_sel$BAD_cnt == 0, ] # removing rows with artefacts
- data_sel <- data_sel[data_sel$IEDsum == 0, ] # removing windows with IEDs
- data_CV2 <- setNames(aggregate(data_sel$CV2_trial, by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "CV2"))
- data_CV2_burst <- setNames(aggregate(data_sel$CV2_intraburst_trial,
- by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "CV2_burst"))
- data_FR <- setNames(aggregate(data_sel$trialfreq, by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "FR"))
- data_FRcor <- setNames(aggregate(data_sel$trialfreq_corrected, by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "FRcor"))
- data_burst <- setNames(aggregate(data_sel$burst_trialsum, by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "Bursts"))
- data_amp <- setNames(aggregate(data_sel$amplitude, by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "Amplitude"))
- data_rpv <- setNames(aggregate(data_sel$RPV, by = c(list(data_sel$Patient, data_sel$Unit, data_sel$Type, data_sel$hyplabel)), mean), c("Patient", "unit", "Type", "hyplabel", "RPV"))
- data_mean <- merge(data_CV2, data_FR)
- data_mean <- merge(data_mean, data_FRcor)
- data_mean <- merge(data_mean, data_burst)
- data_mean <- merge(data_mean, data_amp)
- data_mean <- merge(data_mean, data_rpv)
- data_mean <- merge(data_mean, data_CV2_burst)
- # relative to pre-sleep
- temp <- data_CV2
- names(temp)[names(temp) == "CV2"] <- "Pre_CV2"
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_mean <- merge(data_mean, temp)
- data_mean$CV2_rel <- (data_mean$CV2-data_mean$Pre_CV2) / (data_mean$CV2+data_mean$Pre_CV2)
- temp <- data_CV2_burst
- names(temp)[names(temp) == "CV2_burst"] <- "Pre_CV2_burst"
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_mean <- merge(data_mean, temp)
- data_mean$CV2_burst_rel <- (data_mean$CV2_burst-data_mean$Pre_CV2_burst) / (data_mean$CV2_burst+data_mean$Pre_CV2_burst)
- temp <- data_FR
- names(temp)[names(temp) == "FR"] <- "Pre_FR"
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_mean <- merge(data_mean, temp)
- data_mean$FR_rel <- (data_mean$FR-data_mean$Pre_FR) / (data_mean$FR+data_mean$Pre_FR)
- temp <- data_FRcor
- names(temp)[names(temp) == "FRcor"] <- "Pre_FRcor"
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_mean <- merge(data_mean, temp)
- data_mean$FRcor_rel <- (data_mean$FRcor-data_mean$Pre_FRcor) / (data_mean$FRcor+data_mean$Pre_FRcor)
- temp <- data_amp
- names(temp)[names(temp) == "Amplitude"] <- "Pre_Amplitude"
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_mean <- merge(data_mean, temp)
- data_mean$Amplitude_rel <- (data_mean$Amplitude-data_mean$Pre_Amplitude) / (data_mean$Amplitude+data_mean$Pre_Amplitude)
- temp <- data_burst
- names(temp)[names(temp) == "Bursts"] <- "Pre_Bursts"
- temp <- temp[temp$hyplabel=="Pre", ]
- temp <- subset(temp, select = -c(hyplabel))
- data_mean <- merge(data_mean, temp)
- data_mean$Bursts_rel <- (data_mean$Bursts-data_mean$Pre_Bursts) / (data_mean$Bursts+data_mean$Pre_Bursts)
- # Normalize per unit
- # FRmean <- setNames(aggregate(data_mean_sel$FR_corrected, by = c(list(data_mean_sel$unit)), mean), c("unit", "FRmean"))
- # FRsd <- setNames(aggregate(data_mean_sel$FR_corrected, by = c(list(data_mean_sel$unit)), sd), c("unit", "FRsd"))
- # data_mean_sel <- merge(data_mean_sel,FRmean)
- # data_mean_sel <- merge(data_mean_sel,FRsd)
- # data_mean_sel$FR_standardized <- (data_mean_sel$FR_corrected-data_mean_sel$FRmean)/data_mean_sel$FRsd
- #
- # Ampmean <- setNames(aggregate(data_mean_sel$Amplitude, by = c(list(data_mean_sel$unit)), mean), c("unit", "Ampmean"))
- # Ampsd <- setNames(aggregate(data_mean_sel$Amplitude, by = c(list(data_mean_sel$unit)), sd), c("unit", "Ampsd"))
- # data_mean_sel <- merge(data_mean_sel,Ampmean)
- # data_mean_sel <- merge(data_mean_sel,Ampsd)
- # data_mean_sel$Amp_standardized <- (data_mean_sel$Amplitude-data_mean_sel$Ampmean)/data_mean_sel$Ampsd
- # plot
- data_mean_sel <- data_mean[!data_mean$hyplabel == "Pre", ] # Remove for plotting
- data_mean_sel$title_CV2 = "CV2 (inter-spike intervals)"
- data_mean_sel$title_CV2_burst = "CV2 (inter-burst intervals)"
- data_mean_sel$title_FR = "Firing rate"
- data_mean_sel$title_FRcor = "Firing rate corrected"
- data_mean_sel$title_SUA_FRcor = "Standardized firing rate (SUA)"
- data_mean_sel$title_MUA_FRcor = "Standardized firing rate (MUA)"
- data_mean_sel$title_Amp = "Standardized amplitude"
- data_mean_sel$title_Burst = "Standardized burst rate"
- FR_plot <-
- ggplot(data=data_mean_sel, aes(y=hyplabel, x=FR_rel )) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8,
- aes(group = interaction(Patient, unit), col = Patient, shape = Type, fill = Patient),
- position = position_dodge(width = 0.5)) +
- scale_shape_manual(name = "Unit type", labels = c("MUA", "SUA"), values = c(15, 17)) +
- scale_alpha(guide = 'none') +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(-1, 1)) +
- scale_x_continuous(breaks = c(-1, 0, 1)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_FR)
- FRcor_SUA_plot <-
- ggplot(data=data_mean_sel[data_mean_sel$Type=="SUA", ], aes(y=hyplabel, x=FRcor_rel )) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8,
- aes(group = interaction(Patient, unit), col = Patient, fill = Patient),
- position = position_dodge(width = 0.5)) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(-1, 1)) +
- scale_x_continuous(breaks = c(-1, 0, 1)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_SUA_FRcor)
- FRcor_MUA_plot <-
- ggplot(data=data_mean_sel[data_mean_sel$Type=="MUA", ], aes(y=hyplabel, x=FRcor_rel )) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8,
- aes(group = interaction(Patient, unit), col = Patient, fill = Patient),
- position = position_dodge(width = 0.5)) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(-1, 1)) +
- scale_x_continuous(breaks = c(-1, 0, 1)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_MUA_FRcor)
- Amp_plot <-
- ggplot(data=data_mean_sel[data_mean_sel$Type=="SUA", ], aes(y=hyplabel, x=Amplitude_rel)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8,
- aes(group = interaction(Patient, unit), col = Patient, fill = Patient),
- position = position_dodge(width = 0.5)) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(-0.2, 0.2)) +
- scale_x_continuous(breaks = c(-0.2, 0, 0.2)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_Amp)
- CV2_plot <- # original data, not relative, since CV2 is already standardized
- ggplot(data=data_mean_sel[data_mean_sel$Type == "SUA", ], aes(y=hyplabel, x=CV2)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8, # shape = 17,
- aes(group = interaction(Patient, unit), col = Patient, fill = Patient),
- position = position_dodge(width = 0.5)) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- # coord_cartesian(xlim = c(-0.1, 0.1)) +
- coord_cartesian(xlim = c(0.6, 1.3)) +
- # scale_x_continuous(breaks = c(-0.1, 0, 0.1)) +
- scale_x_continuous(breaks = c(0.6, 1, 1.3)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_CV2)
- CV2_burst_plot <- # original data, not relative, since CV2 is already standardized
- ggplot(data=data_mean_sel[data_mean_sel$Type == "SUA", ], aes(y=hyplabel, x=CV2_burst)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8, # shape = 17,
- aes(group = interaction(Patient, unit), col = Patient, fill = Patient),
- position = position_dodge(width = 0.5)) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- # coord_cartesian(xlim = c(-0.6, 0.6)) +
- # scale_x_continuous(breaks = c(-0.6, 0, 0.6)) +
- coord_cartesian(xlim = c(0, 1)) +
- scale_x_continuous(breaks = c(0, 0.5, 1)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_CV2_burst)
- Burst_plot <- ggplot(data=data_mean_sel[data_mean_sel$Type == "SUA", ], aes(y=hyplabel, x=Bursts_rel)) +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- geom_boxplot(outlier.shape = NA) +
- geom_point(size = 0.8, # shape = 17,
- aes(group = interaction(Patient, unit), col = Patient, fill = Patient),
- position = position_dodge(width = 0.5)) +
- # scale_shape_manual(name = "Unit type", labels = c("MUA", "SUA"), values = c(15, 17)) +
- # scale_shape_discrete(label = c("MUA", "SUA")) +
- ylab(NULL) + xlab(NULL) +
- theme_article() +
- coord_cartesian(xlim = c(-0.8, 0.8)) +
- scale_x_continuous(breaks = c(-0.8, 0, 0.8)) +
- scale_y_discrete(expand=expansion(mult=c(0.1,0.2))) +
- facet_wrap(~title_Burst)
- ################
- ## STATISTICS ##
- ################
- # to create p-values
- detach(package:lmerTest)
- library(lmerTest)
- library(lme4)
- # load and prepare data
- data_window <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/window_spike_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_window$hyplabel[data_window$hyplabel == "Wake"] = "WASO"
- data_window$hyplabel <- factor(data_window$hyplabel, levels = c("Pre", "Post", "REM", "WASO", "S1", "S2", "S3"))
- data_window$Patient <- factor(data_window$patient, levels = c(8:1))
- data_window$Night <- factor(data_window$part)
- data_window$Unit <- factor(data_window$unit + data_window$part * 100) # add becaue template nr repeats over nights
- data_window$responsive <- factor(data_window$responsive)
- data_window$Type <- factor(data_window$Type)
- data_window$FR <- data_window$trialfreq
- data_window$FRcor <- data_window$trialfreq_corrected
- levels(data_window$Type)[levels(data_window$Type)=="good"] <- "SUA"
- levels(data_window$Type)[levels(data_window$Type)=="mua"] <- "MUA"
- data_window$Type <- ordered(data_window$Type, levels = c("MUA", "SUA"))
- data_sel <- na.omit(data_window) # remove rows with missing data
- data_sel <- data_sel[data_sel$BAD_cnt == 0, ] # remove rows with artefacts
- data_sel <- data_sel[data_sel$IEDsum == 0, ] # remove windows with IEDs
- # Reorder for table
- data_sel$stage <- factor(data_sel$hyplabel, levels = c("Pre","S3", "S2", "S1", "WASO", "REM", "Post"))
- # fit model
- data_sel$stage = relevel(data_sel$stage, ref="Pre")
- lFR <- lmer(FR ~ stage + (1 | Patient) + (1 | Unit), data_sel[data_sel$Type=="MUA", ])
- lFRcor_SUA <- lmer(FRcor ~ stage + (1 | Patient) + (1 | Unit), data_sel[data_sel$Type=="SUA", ])
- lFRcor_MUA <- lmer(FRcor ~ stage + (1 | Patient) + (1 | Unit), data_sel[data_sel$Type=="MUA", ])
- lAmp <- lmer(amplitude ~ stage + (1 | Patient) + (1 | Unit), data_sel)
- lCV2 <- lmer(CV2_trial ~ stage + (1 | Patient) + (1 | Unit), data_sel)
- lCV2_burst <- lmer(CV2_intraburst_trial ~ stage + (1 | Patient) + (1 | Unit), data_sel)
- lBurst <- lmer(burst_trialsum ~ stage + (1 | Patient) + (1 | Unit), data_sel)
- summary(lFR)
- summary(lFRcor_SUA)
- summary(lFRcor_MUA)
- summary(lAmp)
- summary(lCV2)
- summary(lCV2_burst)
- summary(lBurst)
- plot_model(lFR)
- plot_model(lFRcor_SUA)
- plot_model(lFRcor_MUA)
- plot_model(lAmp)
- plot_model(lCV2)
- plot_model(lCV2_burst)
- plot_model(lBurst)
- # Post-hoc tests
- temp = emmeans(lFR, list(pairwise ~ stage), adjust = "tukey")
- phFR <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phFR) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phFR$df <- NA
- temp = emmeans(lFRcor_SUA, list(pairwise ~ stage), adjust = "tukey")
- phFR_SUA <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phFR_SUA) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phFR_SUA$df <- NA
- temp = emmeans(lFRcor_MUA, list(pairwise ~ stage), adjust = "tukey")
- phFR_MUA <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phFR_MUA) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phFR_MUA$df <- NA
- temp = emmeans(lFRcor, list(pairwise ~ stage), adjust = "tukey")
- phFRcor <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phFRcor) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phFRcor$df <- NA
- temp = emmeans(lAmp, list(pairwise ~ stage), adjust = "tukey")
- phAmp <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phAmp) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phAmp$df <- NA
- temp = emmeans(lCV2, list(pairwise ~ stage), adjust = "tukey")
- phCV2 <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phCV2) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phCV2$df <- NA
- temp = emmeans(lCV2_burst, list(pairwise ~ stage), adjust = "tukey")
- phCV2_burst <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phCV2_burst) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phCV2_burst$df <- NA
- temp = emmeans(lBurst, list(pairwise ~ stage), adjust = "tukey")
- phBurst <- as.data.frame(temp$`pairwise differences of stage`)
- colnames(phBurst) <- c("Comparison","Estimate","SE","df","Z ratio","p")
- phBurst$df <- NA
- #########################################
- # Model coefficients to table for LaTeX #
- #########################################
- # Model coefficients for table
- temp = summary(lFR)
- sFR <- temp$coefficients
- sFR <- data.frame(Predictor = row.names(sFR), sFR);
- rownames(sFR) <- NULL
- colnames(sFR) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lFRcor_SUA)
- sFRcor_SUA <- temp$coefficients
- sFRcor_SUA <- data.frame(Predictor = row.names(sFRcor_SUA), sFRcor_SUA);
- rownames(sFRcor_SUA) <- NULL
- colnames(sFRcor_SUA) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lFRcor_MUA)
- sFRcor_MUA <- temp$coefficients
- sFRcor_MUA <- data.frame(Predictor = row.names(sFRcor_MUA), sFRcor_MUA);
- rownames(sFRcor_MUA) <- NULL
- colnames(sFRcor_MUA) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lAmp)
- sAmp <- temp$coefficients
- sAmp <- data.frame(Predictor = row.names(sAmp), sAmp);
- rownames(sAmp) <- NULL
- colnames(sAmp) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lCV2)
- sCV2 <- temp$coefficients
- sCV2 <- data.frame(Predictor = row.names(sCV2), sCV2);
- rownames(sCV2) <- NULL
- colnames(sCV2) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lCV2_burst)
- sCV2_burst <- temp$coefficients
- sCV2_burst <- data.frame(Predictor = row.names(sCV2_burst), sCV2_burst);
- rownames(sCV2_burst) <- NULL
- colnames(sCV2_burst) <- c("Predictor","Estimate","SD","df","t","p")
- temp = summary(lBurst)
- sBurst <- temp$coefficients
- sBurst <- data.frame(Predictor = row.names(sBurst), sBurst);
- rownames(sBurst) <- NULL
- colnames(sBurst) <- c("Predictor","Estimate","SD","df","t","p")
- # Model coefficients to LaTeX table (and reorder)
- sFRcor_SUA$id <- 1:nrow(sFRcor_SUA)
- coef <- merge(sFRcor_SUA, sFRcor_MUA, by="Predictor")
- coef <- merge(coef, sBurst, by="Predictor")
- coef <- merge(coef, sAmp, by="Predictor")
- coef <- merge(coef, sCV2, by="Predictor")
- coef <- merge(coef, sCV2_burst, by="Predictor")
- coef <- coef[order(coef$id), ]
- coef <- coef[, c(-1, -7)]
- rownames(coef) <- NULL
- coef[,3] = round(coef[,3],digits=0)
- coef[,8] = round(coef[,8],digits=0)
- coef[,13] = round(coef[,13],digits=0)
- coef[,18] = round(coef[,18],digits=0)
- coef[,23] = round(coef[,23],digits=0)
- coef$Predictor <- c("\\textit{Intercept}","S3", "S2", "S1", "WASO", "REM", "Post")
- coef <- coef[, c(31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30)]
- # posthoc coefficients
- phFR_SUA$id <- 1:nrow(phFR_SUA)
- ph <- merge(phFR_SUA, phFR_MUA, by="Comparison")
- ph <- merge(ph,phBurst, by = "Comparison")
- ph <- merge(ph,phAmp, by = "Comparison")
- ph <- merge(ph,phCV2, by = "Comparison")
- ph <- merge(ph,phCV2_burst, by = "Comparison")
- ph <- ph[order(ph$id), ]
- ph <- ph[, -7]
- rownames(ph) <- NULL
- # Concatenate in one LaTeX table
- colnames(ph) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","df", "z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}")
- colnames(coef) <- c("Predictor", "Coef $\\beta$","SE($\\beta$)","df", "z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}")
- stats_window <- bind_rows(coef,ph)
- colnames(stats_window) <- c("", "Coef $\\beta$","SE($\\beta$)","df", "z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}", "Coef $\\beta$","SE($\\beta$)","df","z",
- "\\textit{p}")
- stats_window[,6] = ifelse(stats_window[,6] > .05, paste(round(stats_window[,6], digits=2),sep=""),
- ifelse(stats_window[,6] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_window[,6] < .001, "<.001\\textsuperscript{**}",
- ifelse(stats_window[,6] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_window[,11] = ifelse(stats_window[,11] > .05, paste(round(stats_window[,11],digits=2),sep=""),
- ifelse(stats_window[,11] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_window[,11] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_window[,11] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_window[,16] = ifelse(stats_window[,16] > .05, paste(round(stats_window[,16],digits=2),sep=""),
- ifelse(stats_window[,16] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_window[,16] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_window[,16] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_window[,21] = ifelse(stats_window[,21] > .05, paste(round(stats_window[,21],digits=2),sep=""),
- ifelse(stats_window[,21] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_window[,21] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_window[,21] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_window[,26] = ifelse(stats_window[,26] > .05, paste(round(stats_window[,26],digits=2),sep=""),
- ifelse(stats_window[,26] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_window[,26] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_window[,26] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- stats_window[,31] = ifelse(stats_window[,31] > .05, paste(round(stats_window[,31],digits=2),sep=""),
- ifelse(stats_window[,31] < .0001, "<.0001\\textsuperscript{***}",
- ifelse(stats_window[,31] < .001,"<.001\\textsuperscript{**}",
- ifelse(stats_window[,31] < .01, "<.01\\textsuperscript{*}", "<.05\\textsuperscript{.}"))))
- options(knitr.kable.NA = '')
- kbl(stats_window, "latex", booktabs = T, linesep = "", label = 'unit_window_stats',
- escape = FALSE, digits = 2,
- caption = "Effect of sleep stage on spontanious neuronal behaviour")%>%
- kable_styling(latex_options = c("HOLD_position"))%>%
- pack_rows("Sleep stages", 1, 7) %>% # latex_gap_space = "2em"
- pack_rows("Post-hoc comparisons", 8, 28) %>%
- add_header_above(c(" ", "Firing Rate (SUA)" = 5, "Firing Rate (MUA)" = 5, "Bursts" = 5, "Amplitude" = 5, "CV2" = 5, "CV2 (bursts)" = 5)) %>%
- kable_styling(latex_options = c("scale_down"))%>%
- footnote(general_title = "",
- footnote_as_chunk = TRUE,
- threeparttable = TRUE,
- escape = FALSE,
- general = c("$.=p<0.05$, $*=p<0.01$, $**=p<0.001$, $***=p<0.0001$"))%>%
- save_kable("D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/tables/unit_window_stats.tex")
- set_theme(
- base = theme_article(),
- # panel.bordercol = NA
- axis.textsize = 0.9
- )
- FRcor_SUA_plot_model <- plot_model(
- lFRcor_SUA,
- title = "",
- colors = "bw",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-4.2, -1.8), breaks = c(-4, -2))
- FRcor_MUA_plot_model <- plot_model(
- lFRcor_MUA,
- title = "",
- colors = "bw",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-7, 1), breaks = c(-7, 0, 1))
- CV2_plot_model <- plot_model(
- lCV2,
- title = "",
- colors = "bw",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5,
- axis.labels = c("REM","Post","WASO","S1","S2","S3")) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1, 0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(0, 0.12), breaks = c(0, 0.1))
- CV2_burst_plot_model <- plot_model(
- lCV2_burst,
- title = "",
- colors = "bw",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5,
- axis.labels = c("REM","Post","WASO","S1","S2","S3")) +
- font_size(labels.y = 9, labels.x = 9) +
- ylim(-0.05, 0.05) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-0.04, 0.01), breaks = c(-0.04, 0, 0.01))
- Amp_plot_model <- plot_model(
- lAmp,
- title = "",
- colors = "bw",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5,
- axis.labels = c("REM","Post","WASO","S1","S2","S3")) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-1, 2), breaks = c(-1, 0, 2))
- Burst_plot_model <- plot_model(
- lBurst,
- title = "",
- colors = "bw",
- axis.title = "",
- show.values = TRUE,
- show.p = TRUE,
- decimals = 4,
- digits = 2,
- value.offset = 0.5,
- value.size = 2.5,
- axis.labels = c("REM","Post","WASO","S1","S2","S3")) +
- font_size(labels.y = 9, labels.x = 9) +
- scale_x_discrete(expand=expansion(mult=c(0.1,0.2)),
- labels=c("Post","REM","WASO","S1","S2","S3")) +
- scale_y_continuous(limits = c(-20, 0), breaks = c(-20, 0))
- Burst_plot_model$data$title = "Model fixed effects"
- Burst_plot_model <- Burst_plot_model + facet_wrap(~title, scales="free_y")
- # FR_plot_model$data$title = "Model fixed effects"
- # FR_plot_model <- FR_plot_model + facet_wrap(~title, scales="free_y")
- FRcor_SUA_plot_model$data$title = "Model fixed effects"
- FRcor_SUA_plot_model <- FRcor_SUA_plot_model + facet_wrap(~title, scales="free_y")
- FRcor_MUA_plot_model$data$title = "Model fixed effects"
- FRcor_MUA_plot_model <- FRcor_MUA_plot_model + facet_wrap(~title, scales="free_y")
- Amp_plot_model$data$title = "Model fixed effects"
- Amp_plot_model <- Amp_plot_model + facet_wrap(~title, scales="free_y")
- CV2_plot_model$data$title = "Model fixed effects"
- CV2_plot_model <- CV2_plot_model + facet_wrap(~title, scales="free_y")
- CV2_burst_plot_model$data$title = "Model fixed effects"
- CV2_burst_plot_model <- CV2_burst_plot_model + facet_wrap(~title, scales="free_y")
- ggarrange(FRcor_SUA_plot, FRcor_SUA_plot_model, FRcor_MUA_plot, FRcor_MUA_plot_model, Burst_plot, Burst_plot_model,
- ncol = 2, nrow = 3,
- vjust = 1.5, hjust = -1,
- labels = c("A","B","C","D","E","F","G","H"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/images/window_FR_boxplots.pdf")
- ggarrange(Amp_plot, Amp_plot_model, CV2_plot, CV2_plot_model, CV2_burst_plot, CV2_burst_plot_model,
- ncol = 2, nrow = 3,
- vjust = 1.5, hjust = -1,
- labels = c("A","B","C","D","E","F","G","H"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Neuronal mechanisms underlying the modulation of interictal epileptic activity during sleep/images/window_CV2_boxplots.pdf")
- ##########################################################################
- ### Combine spike and power data
- ##########################################################################
- # load and prepare data
- data_window <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/window_spike_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_window$hyplabel <- factor(data_window$hyplabel, levels = c("NO_SCORE", "Pre", "Post", "REM", "Wake", "S1", "S2", "S3"))
- data_window$Patient <- factor(data_window$patient, levels = c(8:1))
- data_window$Night <- factor(data_window$part)
- data_window$Unit <- factor(data_window$unit + data_window$part * 100) # add becaue template nr repeats over nights
- data_window$responsive <- factor(data_window$responsive)
- data_window$Type <- factor(data_window$Type)
- data_window$FR <- data_window$trialfreq
- data_window$FRcor <- data_window$trialfreq_corrected
- levels(data_window$Type)[levels(data_window$Type)=="good"] <- "SUA"
- levels(data_window$Type)[levels(data_window$Type)=="mua"] <- "MUA"
- data_window$Type <- ordered(data_window$Type, levels = c("MUA", "SUA"))
- # prepare data
- data_power <- read.csv(file="Z:/analyses/stephen.whitmarsh/data/hspike/power_table_long.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- data_power$hyplabel <- factor(data_power$hyplabel, ordered = TRUE, levels = c("NO_SCORE", "REM", "AWAKE", "PHASE_1", "PHASE_2", "PHASE_3"))
- # data_power$band <- factor(data_power$band, ordered = TRUE, levels = c("delta", "theta", "alpha", "beta", "delta_div_alpha"))
- data_power$band <- factor(data_power$band, ordered = TRUE, levels = c("Delta1", "Delta2"))
- data_power$Patient <- factor(data_power$patient, levels = c(8:1))
- data_power$part <- factor(data_power$part)
- data_power$power_log <- log(data_power$power)
- # data_sel <- na.omit(data_window) # remove rows with missing data
- # data_sel <- data_sel[data_sel$BAD_cnt == 0, ] # remove rows with artefacts
- # data_sel <- data_sel[data_sel$IEDsum == 0, ] # remove windows with IEDs
- d <- merge(data_window, data_power, by = "starttime")
- d <- d[d$band == "Delta2", ]
- d2 <- d %>% mutate(power_bin = cut(power, breaks=seq(-1.5,10.5,1)))
- levels(d2$power_bin) <- seq(1:12)-2
- d$IEDsum.x[105:108] - d$IEDsum.y[105:108]
- d$IEDsum.x[665:672] - d$IEDsum.y[665:672]
- d$IEDsum.x
- d$IEDsum.y
- test <- d$IEDsum.x - d$IEDsum.y
- hist(test[test != 0])
- h1 <- hist(d$IEDsum.y[d$IEDsum.y != 0])
- h2 <- hist(d$IEDsum.x[d$IEDsum.x != 0])
- h3 <- hist(d$IEDsum.x - d$IEDsum.y, 10)
- d[104:109, ]
- # bin data
- # prepare datastructure
- d2 <- d2 %>% group_by(power_bin, IEDsum)
- d2 <- d2 %>% summarise(count = n(), Patient)
- d2 <- d2[order(data_pow_wide2$Patient), ]
- # ggplot(data=data_pow_wide2[data_pow_wide2$IEDsum > 0, ], aes(x=Delta1_log_bin, y=IEDsum*6)) +
- D2 <- ggplot(data=data_pow_wide2, aes(x=Delta_log_bin, y=IEDsum*6, color = Patient)) +
- # geom_count(aes(size = after_stat(prop), group = Delta_log_bin, color = Patient)) +
- geom_count() +
- # scale_size_area(max_size = 3) +
- # geom_smooth(data=data_pow_wide, aes(x=Delta1_log, y=IEDsum), method="lm", fullrange = FALSE, color="red") +
- scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- theme(axis.text.y = element_blank()) +
- theme_article() +
- theme(
- strip.background = element_blank(),
- strip.text.x = element_blank()
- ) +
- # xlab("Delta2 power (log)")
- #xlab = expression(mu "Volts" / "Hertz" ^ 2) +
- # xlab = expression("Force spaces with ~" ~ mu ~ pi * sigma ~ pi) +
- # ylab( units~are~(mu*g)/L )
- # xlab(TeX(r'($\alpha x^\alpha$, where $\alpha \in \{1 \ldots 5\}$)')) +
- # xlab(TeX(r'($log(\mu V/Hz^2$))')) +
- xlab(TeX(r'($log(\mu V^2/Hz$))')) +
- ylab("IEDs per minute") +
- labs(size = "Observations") +
- # coord_cartesian(xlim = c(2,11)) +
- # coord_cartesian(ylim = c(2,11)) +
- # facet_wrap(~Patient, ncol = 4, scales="free_x")
- facet_wrap(~Patient, ncol = 4)
- # ggsave("D:/Dropbox/Apps/Overleaf/Hspike/images/IEDrate_Delta2_count.pdf", width = 7, height = 4, units = "in")
- ggarrange(D1, D2,
- ncol = 1, nrow = 2,
- vjust = 1, hjust = 0,
- labels = c("A","B"),
- legend = "right",
- common.legend = TRUE,
- font.label = list(size = 14, color = "black", face = "bold")) %>%
- ggexport(filename = "D:/Dropbox/Apps/Overleaf/Hspike/images/IEDrate_Delta_count.pdf")
- #
- # ## POLAR ##
- #
- # library("ggplot2")
- # library("dplyr")
- #
- # ## plot power values PER HOUR
- #
- # data$bin <- as.integer(cut(data$minute, seq(0, 24*60, by = 60)))
- # data_binned <- setNames(aggregate(data$alpha, c(list(data$patient), list(data$bin)), mean), c("patient", "bin", "alpha"))
- # data_binned <- as.data.frame(data_binned %>% group_by(patient) %>% mutate(Nalpha = alpha/max(alpha)))
- #
- # ggplot(data=data_binned, aes(x = bin, y = alpha, fill=patient, col=patient)) +
- # scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- # geom_bar(stat="identity", width = 1) +
- # geom_vline(xintercept = seq(0.5, 21.5, by = 3), colour = "grey90") +
- # theme_bw() +
- # theme(panel.border = element_blank(),
- # legend.key = element_blank(),
- # axis.ticks = element_blank(),
- # axis.text.y = element_blank(),
- # panel.grid = element_blank(),
- # ) +
- # scale_x_continuous(breaks=seq(0.5, 21.5, by = 3), labels = c("0" = "00:00", "3" = "03:00", "6" = "06:00", "9" = "09:00", "12" = "12:00", "15" = "15:00", "18" = "18:00", "21" = "21:00")) +
- # coord_polar(theta = "x", start = 0)
- #
- #
- # ## plot power values (use bindivision for hour divisions)
- # bindivision = 1
- # data$bin <- as.integer(cut(data$minute, seq(0, 24*60, by = 60/bindivision)))
- # y1 <- setNames(aggregate(data$alpha, c(list(data$patient), list(data$bin)), median), c("patient", "bin", "alpha"))
- # y2 <- setNames(aggregate(data$theta, c(list(data$patient), list(data$bin)), median), c("patient", "bin", "theta"))
- # y3 <- setNames(aggregate(data$beta, c(list(data$patient), list(data$bin)), median), c("patient", "bin", "beta"))
- # y4 <- setNames(aggregate(data$delta, c(list(data$patient), list(data$bin)), median), c("patient", "bin", "delta"))
- # y1sd <- setNames(aggregate(data$alpha, c(list(data$patient), list(data$bin)), sd), c("patient", "bin", "SDalpha"))
- # y2sd <- setNames(aggregate(data$theta, c(list(data$patient), list(data$bin)), sd), c("patient", "bin", "SDtheta"))
- # y3sd <- setNames(aggregate(data$beta, c(list(data$patient), list(data$bin)), sd), c("patient", "bin", "SDbeta"))
- # y4sd <- setNames(aggregate(data$delta, c(list(data$patient), list(data$bin)), sd), c("patient", "bin", "SDdelta"))
- # data_binned <- merge(y1,y2)
- # data_binned <- merge(data_binned,y3)
- # data_binned <- merge(data_binned,y4)
- # data_binned <- merge(data_binned,y1sd)
- # data_binned <- merge(data_binned,y2sd)
- # data_binned <- merge(data_binned,y3sd)
- # data_binned <- merge(data_binned,y4sd)
- # data_binned <- as.data.frame(data_binned %>% group_by(patient) %>% mutate(Nalpha = (alpha-min(alpha)) / max(alpha-min(alpha))))
- # data_binned <- as.data.frame(data_binned %>% group_by(patient) %>% mutate(Ntheta = (theta-min(theta)) / max(theta-min(theta))))
- # data_binned <- as.data.frame(data_binned %>% group_by(patient) %>% mutate(Ndelta = (delta-min(delta)) / max(delta-min(delta))))
- # data_binned <- as.data.frame(data_binned %>% group_by(patient) %>% mutate(Nbeta = (beta-min(beta)) / max(beta-min(beta))))
- # data_binned_melt <-melt(data_binned[c("Ndelta","Ntheta","Nalpha","Nbeta","patient","bin")], id=c("patient","bin"))
- # data_binned_melt$variable <- factor(data_binned_melt$variable, labels = c("\u03B4 power (1-4Hz)","\u03B8 power (5-7Hz)","\u03B1 power (8-14Hz)","\u03B2 power (15-25Hz)"))
- # data_binned_melt$patient <- factor(data_binned_melt$patient, levels = c(8:1))
- #
- # pdf(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/images/hspike/R/polar_power_combined.pdf")
- #
- # ggplot(data=data_binned_melt, aes(x = bin, y = value, fill=patient, col=patient)) +
- # ggtitle("Normalized circadian LFP power") +
- # scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- # geom_vline(xintercept = seq(0.5, 21.5 * bindivision, by = 3 * bindivision), colour = "grey90") +
- # geom_hline(yintercept = seq(1, 8, by = 1), colour = "grey90") +
- # geom_bar(stat="identity", width = 1) +
- # theme_bw() +
- # theme(panel.border = element_blank(),
- # legend.key = element_blank(),
- # axis.ticks = element_blank(),
- # axis.text.y = element_blank(),
- # panel.grid = element_blank(),
- # axis.title.x = element_blank(),
- # axis.title.y = element_blank(),
- # strip.background = element_blank(),
- # ) +
- # scale_x_continuous(breaks=seq(0.5, 21.5*bindivision, by = 3 * bindivision),
- # labels = c("0" = "00:00", "3" = "3:00", "6" = "6:00", "9" = "9:00",
- # "12" = "12:00", "15" = "15:00", "18" = "18:00", "21" = "21:00")) +
- # coord_polar(theta = "x", start = 0) +
- # ylim(-1, 7) +
- # facet_wrap(~variable)
- #
- # dev.off()
- #
- # library(circular)
- #
- # data$radian = data$minute / (24*60) * pi * 2
- #
- # stats_circ <- median.circular(data$radian)
- #
- #
- # # load data: Patients x Units x time window
- # data_IED <- read.csv(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/data/hspike/hypdata_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- #
- # # prepare data
- # data_IED$patient <- factor(data_IED$patient, levels = c(8:1))
- # data_IED$hour <- data_IED$minute / (60)
- # data_IED$part <- factor(data_IED$part,)
- #
- # # load data: Patients x Units x time window
- # data_seizures <- read.csv(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/data/hspike/seizuredata_table.txt", sep=',', header=TRUE, dec='.', na.strings = " ")
- #
- # # prepare data
- # data_seizures$patient <- factor(data_seizures$patient, levels = c(8:1))
- # data_seizures$hour <- data_seizures$minute / (60)
- #
- # # graphics.off()
- #
- # # display.brewer.all(colorblindFriendly = TRUE)
- #
- # pdf(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/images/hspike/R/polar_density_combined.pdf")
- #
- # ggplot(data=data_IED, aes(x=hour, fill=patient, col=patient)) +
- # ggtitle("Circadian interictal density & seizure occurance") +
- # scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- # geom_vline(xintercept = seq(0, 21, by = 3), colour = "grey90") +
- # geom_hline(yintercept = seq(-0.25+0.025, -0.05, by = 0.025), colour = "grey90") +
- # geom_histogram(position = 'stack', aes(y = stat(density)), binwidth=0.1, center = 0.05) + # make sure binwidth is multiple of 24/60
- # coord_polar(theta = "x") +
- # scale_x_continuous(breaks=seq(0, 21, by = 3), labels = c("0" = "00:00", "3" = "3:00", "6" = "6:00", "9" = "9:00", "12" = "12:00", "15" = "15:00", "18" = "18:00", "21" = "21:00")) +
- # coord_polar(theta = "x", start = 0, direction = 1) +
- # theme_bw() +
- # theme(panel.border = element_blank(),
- # legend.key = element_blank(),
- # axis.ticks = element_blank(),
- # axis.text.y = element_blank(),
- # panel.grid = element_blank(),
- # ) +
- # geom_point(size=1, data = data_seizures, aes(x = hour, y = -0.05 - as.numeric(patient)*0.025+0.025, fill = patient, col = patient)) +
- # ylim(-0.3, 0.85)
- #
- # dev.off()
- #
- #
- #
- #
- #
- #
- #
- #
- # ggplot(data=data_IED, aes(x=hour, fill=patient, col=patient)) +
- # ggtitle("Circadian interictal density & seizure occurance") +
- # scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- # geom_vline(xintercept = seq(0, 21, by = 3), colour = "grey90") +
- # #geom_segment(aes(x = 0, xend = 0, y = 1, yend = 0.1)) +
- # geom_hline(yintercept = seq(-0.25+0.025, -0.05, by = 0.025), colour = "grey90") +
- # geom_histogram(position = 'stack', aes(y = stat(density)), binwidth=0.1, center = 0.05) + # make sure binwidth is multiple of 24/60
- # coord_polar(theta = "x") +
- # scale_x_continuous(breaks=seq(0, 21, by = 3), labels = c("0" = "00:00", "3" = "03:00", "6" = "06:00", "9" = "09:00", "12" = "12:00", "15" = "15:00", "18" = "18:00", "21" = "21:00")) +
- # coord_polar(theta = "x", start = 0, direction = 1) +
- # theme_bw() +
- # theme(panel.border = element_blank(),
- # legend.key = element_blank(),
- # axis.ticks = element_blank(),
- # axis.text.y = element_blank(),
- # panel.grid = element_blank(),
- # ) +
- # geom_point(size=0.5, data = data_seizures, aes(x = hour, y = -0.05 - as.numeric(patient)*0.025+0.025, fill = patient, col = patient)) +
- # ylim(-0.3, 0.85)
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- # library(circular)
- # library(units)
- #
- # plot.circular(data_seizures$radian, pch = 16, cex = 1, stack = TRUE,
- # axes = TRUE, start.sep=0, sep = 0.025, shrink = 1,
- # bins = 23, ticks = TRUE, tcl = 0.025, tcl.text = 0.125,
- # col = NULL, tol = 0.04, uin = NULL,
- # xlim = c(-1, 1), ylim = c(-1, 1), digits = 2, units = "rad",
- # template = NULL, zero = 0.1, rotation = NULL,
- # main = NULL, sub=NULL, xlab = "", ylab = "")
- #
- #
- # plot(sin, -pi, 2*pi) # see ?plot.function
- #
- # pi_rad <- as_units(pi, "radians")
- #
- #
- #
- # pdf(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/images/hspike/R/polar_density_per patient.pdf")
- #
- # ggplot(data=data, aes(x=hour, fill=patient, col=patient)) +
- # ggtitle("Circadian interictal density per patient") +
- # scale_fill_brewer(palette = "Set2") + scale_color_brewer(palette = "Set2") +
- # geom_histogram(position = 'stack', aes(y = stat(density)), binwidth=0.2, center = 0.1) + # make sure binwidth is multiple of 24/60
- # coord_polar(theta = "x") +
- # geom_vline(xintercept = seq(0, 21, by = 3), colour = "grey90") +
- # scale_x_continuous(breaks=seq(0, 21, by = 3), labels = c("0" = "00:00", "3" = "03:00", "6" = "06:00", "9" = "09:00", "12" = "12:00", "15" = "15:00", "18" = "18:00", "21" = "21:00")) +
- # coord_polar(theta = "x", start = 0, direction = 1) +
- # theme_bw() +
- #
- # theme(panel.border = element_blank(),
- # legend.key = element_blank(),
- # axis.ticks = element_blank(),
- # axis.text.y = element_blank(),
- # panel.grid = element_blank(),
- # strip.background = element_blank(),
- # ) + facet_wrap(~patient)
- # dev.off()
- #
- #
- #
- #
- #
- #
- # # get ylim and xlim from plot
- # #layer_scales(p)$y$range$range
- # #layer_scales(p)$x$range$range
- #
- #
- #
- #
- #
- # # data$SU <- data$percRPV < 0.25
- # data$SU <- factor(ifelse(data$percRPV > 0.25, "MUA", "SUA"))
- # data$SU <- c("MUA","SUA","MUA","MUA","MUA","MUA","SUA","MUA","MUA","MUA","MUA","SUA","MUA","MUA","SUA","MUA","MUA","MUA","SUA","MUA","SUA","SUA","MUA","SUA","MUA")
- # # data$PI <- factor(data$PI)
- # data$PI <- factor(ifelse(data$template_tp < 550, "Int", "Pyr"))
- # # data$PI <- revalue(data$PI, c("Int"="Interneuron", "Pyr"="Pyramidal cell"))
- #
- #
- #
- #
- # data <- read.csv(file="//lexport/iss02.charpier/analyses/stephen.whitmarsh/data/aurelie/statAH.csv", sep=';', header=TRUE, dec=',', na.strings = " ")
- # data$P <- data$ï..Patient
- #
- # # get some p-values
- # detach(package:lmerTest)
- # library(lmerTest)
- # l1 <- lmer(EEG ~ NSE +S100 + (1 | P) + (1 | Time), data); summary(l1)
- # l1 <- lmer(EEG ~ NSE + S100 + (1 | P), data); summary(l1)
- #
- # l1 <- lm(EEG ~ NSE + S100, data); summary(l1)
analysis.R at commit 46bf8dc, under GPL-3.0 · at the source
Overview
- Sorbonne Université, Institut du Cerveau - Paris Brain Institute - ICM, Inserm, CNRS, APHP, Pitié-Salpêtrière Hospital, Paris 75013, France
- Epilepsy Unit and Reference Center for Rare Epilepsies, ERN EpiCARE, AP-HP, Pitié-Salpêtrière Hospital, Paris 75013, France
- Department of Neurosurgery, AP-HP, Pitié-Salpêtrière Hospital and Sorbonne Université, Paris 75013, France
Abstract
Epileptic seizures and interictal epileptiform discharges are strongly influenced by sleep and circadian rhythms. However, human data on the effect of sleep on neuronal behaviour during interictal activity have been lacking. We analysed EEG from eight epileptic patients implanted with macro and micro electrodes in mesial temporal structures. Sleep staging was performed on polysomnography and video-EEG. Automated detection identified thousands of interictal epileptiform discharges per patient. Both their rate and amplitude increased with deeper stages of non-rapid eye movement sleep. Single- and multi-unit firing rates were often temporally coupled with local field potentials, exhibiting increased firing during the spike and decreased activity during the following slow wave. These time-locked firing rate modulations were shown to increase during deeper stages of non-rapid eye movement sleep. Furthermore, neuronal background activity showed a decrease in firing rate, bursting and regularity with deeper stages of non-rapid eye movement sleep.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 8 matches between paragraphs and lines of code.
icm-institute/dac/EpiCode
8897bd3fb06fc04482133af27ce4cad86167918c, 4 January 2023Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
648 files
- development/
TFRtrials_new.m , MATLAB, 57 lines - development/
classification_celltype. , MATLAB, 187 linesm - development/
clusterLFP.m , MATLAB, 551 lines - development/
detectSpikes.m , MATLAB, 213 lines - development/
doTFRcontinuous.m , MATLAB, 105 lines - development/
editMarkerfiles.m , MATLAB, 51 lines - development/
export_hypnogram_backup. , MATLAB, 423 linesm - development/
ft_pimpplot.m , MATLAB, 162 lines - development/
hierachical_clustering.m , MATLAB, 96 lines - development/
modified_fieldtrip_funct , MATLAB, 281 linesions/ ft_spike_maketrials_notu sed.m - development/
modified_fieldtrip_funct , MATLAB, 217 linesions/ ft_spike_select_rmfulltr ials.m - development/
modified_fieldtrip_funct , MATLAB, 424 linesions/ ft_spike_xcorr.m - development/
modified_fieldtrip_funct , MATLAB, 801 linesions/ ft_write_data.m - development/
modified_fieldtrip_funct , MATLAB, 143 linesions/ write_brainvision_eeg.m - development/
plotLFP.m , MATLAB, 644 lines - development/
plotPatterns.m , MATLAB, 170 lines - development/
plot_chan_waveform.m , MATLAB, 50 lines - development/
readHypnogram.m , MATLAB, 229 lines - development/
readMuseMarkers_old.m , MATLAB, 206 lines - development/
writemicroforspykingcirc , MATLAB, 65 linesus_concatinated_trials.m - external/
IniConfig.m , MATLAB, 1,536 lines - external/
bandpassFilter.m , MATLAB, 99 lines - external/
cbrewer/ , MATLAB, not shown herecbrewer/ ._cbrewer.m - external/
cbrewer/ , MATLAB, not shown herecbrewer/ ._interpolate_cbrewer.m - external/
cbrewer/ , MATLAB, not shown herecbrewer/ ._plot_brewer_cmap.m - external/
cbrewer/ , MATLAB, 128 linescbrewer/ cbrewer.m - external/
cbrewer/ , MATLAB, 64 linescbrewer/ change_jet.m - external/
cbrewer/ , MATLAB, 36 linescbrewer/ interpolate_cbrewer.m - external/
cbrewer/ , MATLAB, 50 linescbrewer/ plot_brewer_cmap.m - external/
dtwdist.m , MATLAB, 9 lines - external/
fdr_bh/ , MATLAB, 226 linesfdr_bh.m - external/
fieldtrip/ , MATLAB, 144 linesft_read_neuralynx_interp .m - external/
fieldtrip/ , MATLAB, 285 linesft_spike_maketrials_old. m - external/
fieldtrip/ , MATLAB, 31 linesisdir_or_mkdir.m - external/
fieldtrip/ , MATLAB, 33 linesprivate/ bigendian.m - external/
fieldtrip/ , MATLAB, 89 linesprivate/ cstructdecode.m - external/
fieldtrip/ , MATLAB, 27 linesprivate/ fopen_or_error.m - external/
fieldtrip/ , MATLAB, 237 linesread_neuralynx_nev.m - external/
iniconfig/ , MATLAB, 1,536 linesIniConfig.m - external/
intersections/ , MATLAB, 340 linesintersections.m - external/
linspecer.m , MATLAB, 261 lines - external/
mDetectSpike.m , MATLAB, 351 lines - external/
npy-matlab-master/ , MATLAB, 23 linesexamples/ exampleMemmap.m - external/
npy-matlab-master/ , MATLAB, 88 linesnpy-matlab/ constructNPYheader.m - external/
npy-matlab-master/ , MATLAB, 42 linesnpy-matlab/ datToNPY.m - external/
npy-matlab-master/ , MATLAB, 37 linesnpy-matlab/ readNPY.m - external/
npy-matlab-master/ , MATLAB, 69 linesnpy-matlab/ readNPYheader.m - external/
npy-matlab-master/ , MATLAB, 25 linesnpy-matlab/ writeNPY.m - external/
sigstar-master/ , MATLAB, 120 linesdemo_sigstar.m - external/
sigstar-master/ , MATLAB, 307 linessigstar.m - external/
smooth1q.m , MATLAB, 241 lines - external/
subaxis/ , MATLAB, 159 linesparseArgs.m - external/
subaxis/ , MATLAB, 106 linessubaxis.m - external/
xml2struct/ , MATLAB, 183 linesxml2struct.m - projects/
PET/ , MATLAB, 40 linesPET_classification_cellt ype.m - projects/
PET/ , MATLAB, 42 linesPET_prepare_spykingcircu s.m - projects/
PET/ , MATLAB, 135 linesPET_project_per_patient. m - projects/
PET/ , MATLAB, 279 linesPET_setparams.m - projects/
PET/ , MATLAB, 39 linesPET_verify_markers.m - projects/
PET/ , MATLAB, 69 linesold/ PET_project.m - projects/
PET/ , MATLAB, 28 linesold/ PET_project_grandaverage .m - projects/
PET/ , MATLAB, 93 linesold/ slurm_preictal_project.m - projects/
PET/ , Shell, 15 linesold/ slurm_preictal_project.s h - projects/
PET/ , Shell, 15 linesold/ slurm_writeSpykingCircus .sh - projects/
PET/ , MATLAB, 87 linespet_functions/ PET_add_interIED_epochs. m - projects/
PET/ , MATLAB, 68 linespet_functions/ PET_cut_long_epochs.m - projects/
PET/ , MATLAB, 126 linespet_functions/ PET_neurons_table_timelo cked.m - projects/
PET/ , MATLAB, 59 linespet_functions/ PET_plot_LFP_aligned.m - projects/
PET/ , MATLAB, 554 linespet_functions/ PET_plot_overview_units. m - projects/
PET/ , MATLAB, 37 linespet_functions/ PET_slurm_joblist.m - projects/
PET/ , MATLAB, 168 linespet_functions/ plot_PSTH_stats.m - projects/
PET/ , Shell, 15 linespet_project_per_patient_ slurm.sh - projects/
PET/ , Shell, 12 linesslurm_spyking-circus.sh - projects/
PSG/ , MATLAB, 62 linesPSG_setparams.m - projects/
dcx/ , MATLAB, 93 linesproject_dcx.m - projects/
dtx/ , MATLAB, 41 linescheck_nr_crises_startend .m - projects/
dtx/ , MATLAB, 112 linesconcatenateMuseMarkers.m - projects/
dtx/ , MATLAB, 14 linescv2.m - projects/
dtx/ , MATLAB, 61 linesdtx_TFRtrials.m - projects/
dtx/ , MATLAB, 38 linesdtx_correctDTX2name.m - projects/
dtx/ , MATLAB, 104 linesdtx_edit_Markerfiles.m - projects/
dtx/ , Shell, 16 linesdtx_eeganesth_cluster_sl urm.sh - projects/
dtx/ , MATLAB, 250 linesdtx_eeganesth_project.m - projects/
dtx/ , Shell, 15 linesdtx_eeganesth_project_sl urm.sh - projects/
dtx/ , MATLAB, 606 linesdtx_eeganesth_setparams. m - projects/
dtx/ , MATLAB, 173 linesdtx_eegretigabine_projec t.m - projects/
dtx/ , MATLAB, 179 linesdtx_eegretigabine_setpar ams.m - projects/
dtx/ , MATLAB, 118 linesdtx_eegrodents_cluster.m - projects/
dtx/ , Shell, 16 linesdtx_eegvideo_cluster_slu rm.sh - projects/
dtx/ , MATLAB, 812 linesdtx_eegvideo_project.m - projects/
dtx/ , Shell, 15 linesdtx_eegvideo_project_slu rm.sh - projects/
dtx/ , MATLAB, 347 linesdtx_eegvideo_setparams.m - projects/
dtx/ , MATLAB, 421 linesdtx_patients_lgi1_setpar ams.m - projects/
dtx/ , MATLAB, 959 linesdtx_patientslgi1_project .m - projects/
dtx/ , Shell, 16 linesdtx_patientslgi1_project _slurm.sh - projects/
dtx/ , MATLAB, 100 linesdtx_plot_patients_seizur e.m - projects/
dtx/ , MATLAB, 37 linesdtx_readLFP.m - projects/
dtx/ , MATLAB, 270 linesdtx_remove_wrong_seizure .m - projects/
dtx/ , MATLAB, 57 linesdtx_savefigure.m - projects/
dtx/ , MATLAB, 489 linesdtx_spikes_grandaverage. m - projects/
dtx/ , Shell, 18 linesdtx_spikes_grandaverage_ slurm.sh - projects/
dtx/ , MATLAB, 109 linesdtx_spikes_project.m - projects/
dtx/ , Shell, 19 linesdtx_spikes_project_slurm .sh - projects/
dtx/ , MATLAB, 339 linesdtx_spikes_setparams.m - projects/
dtx/ , MATLAB, 43 linesdtx_spikes_slurm_joblist .m - projects/
dtx/ , Shell, 12 linesdtx_spikes_slurm_runline .sh - projects/
dtx/ , MATLAB, 46 linesdtx_spikes_writeSC.m - projects/
dtx/ , Shell, 19 linesdtx_spikes_writeSC_slurm .sh - projects/
dtx/ , MATLAB, 187 linesdtx_stats_emg_timings.m - projects/
dtx/ , MATLAB, 203 linesdtx_stats_seizure_timing s.m - projects/
dtx/ , MATLAB, 12 linespatch_std.m - projects/
dtx/ , MATLAB, 485 linesplotOverviewDTXspikes.m - projects/
dtx/ , MATLAB, 184 linesplot_morpho.m - projects/
dtx/ , MATLAB, 351 linesreadMuseMarkers_disconti nuousMicromed.m - projects/
dtx/ , MATLAB, 41 linesremoveArtefactedTrials.m - projects/
dtx/ , MATLAB, 577 linesshared_old/ alignMuseMarkersPeaks.m - projects/
dtx/ , MATLAB, 444 linesshared_old/ readLFP.m - projects/
dtx/ , MATLAB, 335 linesshared_old/ readMuseMarkers.m - projects/
dtx/ , MATLAB, 303 linesshared_old/ readSpikeRaw_Phy.m - projects/
dtx/ , MATLAB, 296 linesshared_old/ readSpikeTrials_MuseMark ers.m - projects/
dtx/ , MATLAB, 247 linesshared_old/ readSpikeTrials_windowed .m - projects/
dtx/ , MATLAB, 194 linesshared_old/ readSpikeWaveforms.m - projects/
dtx/ , MATLAB, 11 linesshared_old/ saveMarker.m - projects/
dtx/ , MATLAB, 132 linesshared_old/ spikeTrialDensity.m - projects/
dtx/ , MATLAB, 203 linesshared_old/ spikeTrialStats.m - projects/
dtx/ , MATLAB, 172 linesshared_old/ spikeWaveformStats.m - projects/
dtx/ , MATLAB, 240 linesshared_old/ writeSpykingCircus.m - projects/
dtx/ , MATLAB, 149 linesshared_old/ writeSpykingCircusDeadfi les.m - projects/
dtx/ , MATLAB, 191 linesshared_old/ writeSpykingCircusParame ters.m - projects/
dtx/ , MATLAB, 52 linessummarized_neurons_table .m - projects/
hspike/ , MATLAB, 332 linesFigure1.m - projects/
hspike/ , MATLAB, 161 linesFigure2.m - projects/
hspike/ , MATLAB, 231 linesFigure3.m - projects/
hspike/ , MATLAB, 193 linesFigure_FFT.m - projects/
hspike/ , MATLAB, 738 linesFigure_LFP_stages.m - projects/
hspike/ , MATLAB, 208 linesFigure_PSTH_all.m - projects/
hspike/ , MATLAB, 696 linesFigure_firingrates.m - projects/
hspike/ , MATLAB, 161 linesFigure_hypnogarms.m - projects/
hspike/ , MATLAB, 154 linesFigure_hypnograms.m - projects/
hspike/ , MATLAB, 1,164 linesFigure_psth.m - projects/
hspike/ , MATLAB, 363 linesFigure_raster.m - projects/
hspike/ , MATLAB, 363 linesFigure_template_timing.m - projects/
hspike/ , MATLAB, 524 linesFigure_templates.m - projects/
hspike/ , R, 61 linesR_leftovers.R - projects/
hspike/ , R, 44 linesRscript.R - projects/
hspike/ , MATLAB, 127 linesTrials2GrandAverage.m - projects/
hspike/ , MATLAB, 75 linesaddparts.m - projects/
hspike/ , MATLAB, 60 linesalignClusters.m - projects/
hspike/ , MATLAB, 101 linesalignTemplates.m - projects/
hspike/ , MATLAB, 75 linesalignTemplates_new.m - projects/
hspike/ , R, 3,194 linesanalysis.R - projects/
hspike/ , R, 3,046 lines, 1 matchanalysis_12122022.R - projects/
hspike/ , Python, 1 lineclustering.py - projects/
hspike/ , MATLAB, 164 lineshspike_cluster.m - projects/
hspike/ , Shell, 18 lineshspike_cluster.sh - projects/
hspike/ , MATLAB, 42 lineshspike_cluster_FFT.m - projects/
hspike/ , Shell, 14 lineshspike_cluster_FFT.sh - projects/
hspike/ , MATLAB, 46 lineshspike_cluster_SpikeStat s_window.m - projects/
hspike/ , MATLAB, 19 lineshspike_cluster_SpykingCi rcus.m - projects/
hspike/ , MATLAB, 47 lineshspike_cluster_spikestat s.m - projects/
hspike/ , Shell, 14 lineshspike_cluster_spikestat s.sh - projects/
hspike/ , MATLAB, 68 lineshspike_cluster_template. m - projects/
hspike/ , Shell, 15 lineshspike_cluster_template. sh - projects/
hspike/ , MATLAB, 1,224 lineshspike_project.m - projects/
hspike/ , MATLAB, 344 lineshspike_project_June14_20 21.m - projects/
hspike/ , MATLAB, 926 lineshspike_setparams.m - projects/
hspike/ , MATLAB, 80 lineshspike_setparams_temp.m - projects/
hspike/ , MATLAB, 36 lineshspike_setpaths.m - projects/
hspike/ , Shell, 14 lineshspike_slurm.sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_FFT.sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_SpikeStats_ window.sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_spikestats. sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_template.sh - projects/
hspike/ , MATLAB, 62 lineshspike_spike_cluster.m - projects/
hspike/ , Shell, 14 lineshspike_spike_cluster.sh - projects/
hspike/ , Shell, 14 lineshspike_spike_slurm.sh - projects/
hspike/ , MATLAB, 132 lineshspike_write_spykingcirc us_cluster.m - projects/
hspike/ , MATLAB, 22 linesms_to_samples.m - projects/
hspike/ , MATLAB, 142 linespadHypnogram.m - projects/
hspike/ , MATLAB, 432 linesplotGrandAverage.m - projects/
hspike/ , MATLAB, 1,286 linesplotGrandAverageAll.m - projects/
hspike/ , MATLAB, 286 linesplotGrandAverageTimelock edModel.m - projects/
hspike/ , MATLAB, 211 linesplotGrandAverageWindowed Model.m - projects/
hspike/ , MATLAB, 432 linesplotGrandAverage_timeloc ked.m - projects/
hspike/ , MATLAB, 466 linesplotGrandAverage_windowe d.m - projects/
hspike/ , MATLAB, 2 linesplotHypnogramPolar.m - projects/
hspike/ , MATLAB, 268 linesplotLFP_stages.m - projects/
hspike/ , MATLAB, 767 linesplotOverviewHspike.m - projects/
hspike/ , MATLAB, 227 linesplotPSGoverview.m - projects/
hspike/ , MATLAB, 67 linesplotTimingPolar.m - projects/
hspike/ , MATLAB, 41 linesplotTimingPolar_all.m - projects/
hspike/ , MATLAB, 85 linesplotshifts.m - projects/
hspike/ , MATLAB, 76 linesplotstats.m - projects/
hspike/ , MATLAB, 19 linesplotwaveforms.m - projects/
hspike/ , MATLAB, 11 linespnh_spyking-circus.m - projects/
hspike/ , Shell, 11 linespnh_spyking-circus.sh - projects/
hspike/ , MATLAB, 70 linessdfStats.m - projects/
hspike/ , MATLAB, 31 linessetpaths.m - projects/
hspike/ , Shell, 17 linesslurm_SpykingCircus.sh - projects/
hspike/ , Shell, 11 linesslurm_runline.sh - projects/
hspike/ , Shell, 11 linesslurm_runline_normalmem. sh - projects/
hspike/ , MATLAB, 177 linesspikeTrialStats_GrandAve rage.m - projects/
hspike/ , MATLAB, 180 linestest_ncs_gaps.m - projects/
hspike/ , MATLAB, 18 linestest_waveshapes.m - projects/
hspike/ , MATLAB, 65 linestestscript_hypnogram.m - projects/
hspike/ , R, 248 linesvisualize_spikestats.R - projects/
hypconn/ , MATLAB, 39 lineshypconn_project.m - projects/
hypconn/ , MATLAB, 171 lineshypconn_setparams.m - projects/
katia/ , MATLAB, 42 lineskatia_prepare_spykingcir cus.m - projects/
katia/ , MATLAB, 46 lineskatia_project.m - projects/
katia/ , MATLAB, 135 lineskatia_project_per_patien t.m - projects/
katia/ , Shell, 15 lineskatia_project_per_patien t_slurm.sh - projects/
katia/ , MATLAB, 262 lineskatia_setparams.m - projects/
katia/ , MATLAB, 37 lineskatia_slurm_joblist.m - projects/
katia/ , Shell, 12 linesslurm_spyking-circus.sh - projects/
pnh/ , MATLAB, 373 linesFigure0.m - projects/
pnh/ , MATLAB, 292 linesFigure2.m - projects/
pnh/ , MATLAB, 278 linesFigure3.m - projects/
pnh/ , MATLAB, 276 linesFigure3_new.m - projects/
pnh/ , MATLAB, 129 linesFigure4.m - projects/
pnh/ , MATLAB, 129 linesFigureS1.m - projects/
pnh/ , MATLAB, 150 linesTable1.m - projects/
pnh/ , MATLAB, 370 linesTable2.m - projects/
pnh/ , MATLAB, 148 linesanalyze_periodicity.m - projects/
pnh/ , MATLAB, 34 linescreate_slurm_joblist.m - projects/
pnh/ , MATLAB, 216 linesft_spike_select_rmfulltr ials.m - projects/
pnh/ , MATLAB, 113 linesplotTimeCoursesExamples. m - projects/
pnh/ , MATLAB, 173 linesplot_patterns_multilevel .m - projects/
pnh/ , MATLAB, 396 linesplot_patterns_multilevel _examples.m - projects/
pnh/ , MATLAB, 83 linesplotshifts.m - projects/
pnh/ , MATLAB, 113 linespnh_cluster.m - projects/
pnh/ , Shell, 17 linespnh_cluster.sh - projects/
pnh/ , MATLAB, 413 linespnh_project.m - projects/
pnh/ , MATLAB, 924 linespnh_project_new.m - projects/
pnh/ , MATLAB, 601 linespnh_setparams.m - projects/
pnh/ , Shell, 11 linespnh_spyking-circus.sh - projects/
pnh/ , MATLAB, 210 linesstats_unit_behaviour.m - projects/
preictal/ , MATLAB, 69 linesbackup/ preictal_launch_SpykingC ircus.m - projects/
preictal/ , MATLAB, 23 linesbackup/ preictal_launch_SpykingC ircus_extracting.m - projects/
preictal/ , MATLAB, 128 linesbackup/ preictal_project.m - projects/
preictal/ , MATLAB, 135 linesbackup/ preictal_project_LC - Copie.m - projects/
preictal/ , MATLAB, 112 linesbackup/ preictal_project_LC - Copie2.m - projects/
preictal/ , MATLAB, 168 linesbackup/ preictal_project_LC_back up.m - projects/
preictal/ , MATLAB, 284 linesbackup/ preictal_setparams - Copie.m - projects/
preictal/ , Shell, 12 linesbackup/ slurm_spyking-circus.sh - projects/
preictal/ , Shell, 17 linesbackup/ slurm_spyking-circus_ext racting.sh - projects/
preictal/ , Shell, 16 linesbackup/ slurm_spyking-circus_ext racting_test.sh - projects/
preictal/ , Shell, 16 linesbackup/ slurm_spyking-circus_tes t.sh - projects/
preictal/ , MATLAB, 220 linesold/ preictal_project_LC.m - projects/
preictal/ , MATLAB, 201 linesold/ preictal_project_SW.m - projects/
preictal/ , MATLAB, 247 linesold/ preictal_setparams_SW.m - projects/
preictal/ , MATLAB, 56 linesold/ preictal_writeSpykingCir cus.m - projects/
preictal/ , MATLAB, 93 linesold/ slurm_preictal_project.m - projects/
preictal/ , Shell, 17 linesold/ slurm_spyking-circus_old .sh - projects/
preictal/ , Shell, 15 linesold/ slurm_writeSpykingCircus .sh - projects/
preictal/ , MATLAB, 201 linespreictal_functions/ addMuseBAD.m - projects/
preictal/ , MATLAB, 101 linespreictal_functions/ plotOverviewPreictal.m - projects/
preictal/ , MATLAB, 199 linespreictal_functions/ plot_spikestats_preictal .m - projects/
preictal/ , MATLAB, 54 linespreictal_functions/ preictal_gather_data.m - projects/
preictal/ , MATLAB, 214 linespreictal_functions/ preictal_plot_spikestats .m - projects/
preictal/ , MATLAB, 44 linespreictal_functions/ preictal_spikes_slurm_jo blist.m - projects/
preictal/ , MATLAB, 43 linespreictal_functions/ remove_artefacted_trials .m - projects/
preictal/ , Shell, 17 linespreictal_functions/ slurm_spyking-circus_old .sh - projects/
preictal/ , MATLAB, 56 linespreictal_prepare_spyking circus.m - projects/
preictal/ , MATLAB, 246 linespreictal_project.m - projects/
preictal/ , Shell, 14 linespreictal_project_slurm.s h - projects/
preictal/ , MATLAB, 1,359 linespreictal_setparams.m - projects/
preictal/ , Shell, 12 linesslurm_spyking-circus.sh - projects/
ripples/ , MATLAB, 321 linesripples_analysis.m - projects/
ripples/ , MATLAB, 194 linesripples_analysis_old.m - projects/
ripples/ , MATLAB, 178 linesripples_getdata.m - projects/
ripples/ , MATLAB, 189 linesripples_getdata_old.m - projects/
seg/ , MATLAB, 143 linesplotSeizureSegmentation. m - projects/
seg/ , MATLAB, 62 linesseg_cluster.m - projects/
seg/ , MATLAB, 84 linesseg_project.m - projects/
seg/ , MATLAB, 88 linesseg_setparams.m - projects/
seg/ , Shell, 13 linesseg_slurm.sh - projects/
wod/ , Shell, 26 linesconcatenate_lfp/ slurm_concat_LFP.sh - projects/
wod/ , MATLAB, 98 linesconcatenate_lfp/ wod_concatenateLFP.m - projects/
wod/ , MATLAB, 98 linesedit_markerfile.m - projects/
wod/ , MATLAB, 153 linesold/ wod_project_lfp.m - projects/
wod/ , MATLAB, 39 linesold/ wod_setparams_lfp.m - projects/
wod/ , Shell, 26 linesslurm_wod_project.sh - projects/
wod/ , Shell, 26 linesslurm_writespykingcircus .sh - projects/
wod/ , MATLAB, 72 linestemporary/ modifs_script_pour_TFR.m - projects/
wod/ , MATLAB, 160 linestemporary/ wod_plot_each_rat.m - projects/
wod/ , MATLAB, 50 linestemporary/ wor_detect.m - projects/
wod/ , MATLAB, 788 lineswod_project.m - projects/
wod/ , MATLAB, 175 lineswod_setparams.m - projects/
wod/ , MATLAB, 35 lineswod_writespykingcircus.m - shared/
FFTtrials.m , MATLAB, 137 lines - shared/
TFRtrials.m , MATLAB, 134 lines - shared/
addSlidingWindows.m , MATLAB, 104 lines - shared/
alignMuseMarkersPeaks.m , MATLAB, 564 lines - shared/
alignMuseMarkersXcorr.m , MATLAB, 335 lines - shared/
clusterLFP.m , MATLAB, 645 lines - shared/
compute_synchrony_spiky. , MATLAB, 174 linesm - shared/
detectTemplate.m , MATLAB, 469 lines - shared/
exportHypnogram.m , MATLAB, 408 lines - shared/
hypnogramMuseStats.m , MATLAB, 188 lines - shared/
inter_trial_intervals.m , MATLAB, 104 lines - shared/
plotHypnogram.m , MATLAB, 240 lines - shared/
plotWindowedData.m , MATLAB, 570 lines - shared/
plot_patterns_multilevel , MATLAB, 354 lines_examples.m - shared/
plot_spike_trial_example , MATLAB, 151 lines.m - shared/
plot_spike_waveforms.m , MATLAB, 187 lines - shared/
plotstats.m , MATLAB, 112 lines - shared/
readLFP.m , MATLAB, 476 lines - shared/
readLFPavg.m , MATLAB, 311 lines - shared/
readMuseMarker.m , MATLAB, 79 lines - shared/
readMuseMarkers.m , MATLAB, 356 lines - shared/
readRippleLab.m , MATLAB, 61 lines - shared/
readSpikeRaw_Phy.m , MATLAB, 323 lines - shared/
readSpikeRaw_SpykingCirc , MATLAB, 120 linesus.m - shared/
readSpikeTrials.m , MATLAB, 402 lines - shared/
readSpikeWaveforms.m , MATLAB, 236 lines - shared/
readSpikeWaveforms_fromR , MATLAB, 183 linesaw.m - shared/
rerefLFP.m , MATLAB, 109 lines - shared/
spikePSTH.m , MATLAB, 230 lines - shared/
spikeTrialStats.m , MATLAB, 344 lines - shared/
spikeWaveformStats.m , MATLAB, 184 lines - shared/
spikeratestatsSleepStage , MATLAB, 500 lines.m - shared/
stats_IED_behaviour.m , MATLAB, 292 lines - shared/
stats_unit_behaviour.m , MATLAB, 213 lines - shared/
stats_unit_density.m , MATLAB, 313 lines - shared/
summarized_neurons_table , MATLAB, 98 lines.m - shared/
utilities/ , MATLAB, 24 linesCommonElemTol.m - shared/
utilities/ , MATLAB, 84 linesPSG2table.m - shared/
utilities/ , MATLAB, 201 linesaddMuseBAD.m - shared/
utilities/ , MATLAB, 54 linesalignXcorr.m - shared/
utilities/ , MATLAB, 130 linesconcatenateMuseMarkers.m - shared/
utilities/ , MATLAB, 23 linesdir2.m - shared/
utilities/ , MATLAB, 119 lineseditMuseMarkers.m - shared/
utilities/ , MATLAB, 71 linesfind_muse_marker_in_tria l.m - shared/
utilities/ , MATLAB, 69 linesget_data_format.m - shared/
utilities/ , MATLAB, 79 linesget_data_format2.m - shared/
utilities/ , MATLAB, 12 linesloadload.m - shared/
utilities/ , MATLAB, 48 linesmerge_MuseMarkers.m - shared/
utilities/ , MATLAB, 9 linesnaneucdist.m - shared/
utilities/ , MATLAB, 43 linesnanxcorr.m - shared/
utilities/ , MATLAB, 13 linesnanznorm.m - shared/
utilities/ , MATLAB, 24 linesnormxcorr2e.m - shared/
utilities/ , MATLAB, 12 linespatch_std.m - shared/
utilities/ , MATLAB, 60 linesplot_hyp_lines.m - shared/
utilities/ , MATLAB, 86 linesread_nev_Muse.m - shared/
utilities/ , MATLAB, 71 linesremove_artefacted_trials .m - shared/
utilities/ , MATLAB, 60 linesremove_too_short_trials. m - shared/
utilities/ , MATLAB, 11 linessaveMarker_FFT.m - shared/
utilities/ , MATLAB, 11 linessaveMarker_LFP.m - shared/
utilities/ , MATLAB, 11 linessaveMarker_SpikeTrials.m - shared/
utilities/ , MATLAB, 11 linessaveMarker_TFR.m - shared/
utilities/ , MATLAB, 56 linessavefigure_own.m - shared/
utilities/ , MATLAB, 9 linesshift.m - shared/
utilities/ , MATLAB, 15 linesupdateBadMuseMarkers.m - shared/
utilities/ , MATLAB, 18 linesupdateHypnogramMarkers.m - shared/
utilities/ , MATLAB, 19 linesupdateMarkers.m - shared/
utilities/ , MATLAB, 85 linesverifymarkers.m - shared/
utilities/ , MATLAB, 89 lineswriteMuseMarkerfile.m - shared/
utilities/ , MATLAB, 90 lineswriteMuseMarkerfile_Brai nvision.m - shared/
utilities/ , MATLAB, 41 lineswriteProbeFile.m - shared/
writeSpykingCircusDeadfi , MATLAB, 157 linesles.m - shared/
writeSpykingCircusFileLi , MATLAB, 228 linesst.m - shared/
writeSpykingCircusParame , MATLAB, 205 linesters.m - trash/
DBSCAN/ , MATLAB, 75 linesDBSCAN.m - trash/
DBSCAN/ , MATLAB, 47 linesPlotClusterinResult.m - trash/
DBSCAN/ , MATLAB, 34 linesmain.m - trash/
MuseMarkers_update_filep , MATLAB, 52 linesath.m - trash/
MuseMarkers_update_filep , MATLAB, 29 linesath_old.m - trash/
RunLength_2017_04_08/ , MATLAB, 307 linesInstallMex.m - trash/
RunLength_2017_04_08/ , C, 459 linesRunLength.c - trash/
RunLength_2017_04_08/ , MATLAB, 77 linesRunLength.m - trash/
RunLength_2017_04_08/ , MATLAB, 162 linesRunLength_M.m - trash/
RunLength_2017_04_08/ , MATLAB, 588 linesuTest_RunLength.m - trash/
acf/ , MATLAB, 112 linesacf.m - trash/
alignMuseMarkersXcorr0.m , MATLAB, 197 lines - trash/
alignMuseMarkers_macro.m , MATLAB, 369 lines - trash/
bsearch/ , MATLAB, 67 linesbsearch.m - trash/
dtx_spikes_figure_spiked , MATLAB, 301 linesensity_slowwave.m - trash/
dtx_spikes_plot_raw.m , MATLAB, 125 lines - trash/
dynamic_time_warping_v2/ , MATLAB, 28 linesdemo_dtw.m - trash/
dynamic_time_warping_v2/ , MATLAB, 38 linesdtw.m - trash/
dynamic_time_warping_v2/ , C, 195 linesdtw_c.c - trash/
findPattern.m , MATLAB, 464 lines - trash/
findPattern2D.m , MATLAB, 534 lines - trash/
findPattern_deleted.m , MATLAB, 1 line - trash/
findPattern_saved.m , MATLAB, 448 lines - trash/
ft_spike_isi_edited.m , MATLAB, 201 lines - trash/
hypnogramStats.m , MATLAB, 595 lines - trash/
ini2struct/ , MATLAB, 123 linesini2struct.m - trash/
inifile.m , MATLAB, 891 lines - trash/
inifile/ , MATLAB, 891 linesinifile.m - trash/
plotWindowedData.m , MATLAB, 156 lines - trash/
pnh_project.m , MATLAB, 1,332 lines - trash/
pnh_seizures/ , MATLAB, 6 linesMultiOuterJoin.m - trash/
pnh_seizures/ , MATLAB, 42 linesMuse2txt.m - trash/
pnh_seizures/ , R, 248 linesR/ visualize_spikestats.R - trash/
pnh_seizures/ , R, 188 linesR/ visualize_spikestats_rev ision.R - trash/
pnh_seizures/ , MATLAB, 57 linesTFR_seizures.m - trash/
pnh_seizures/ , MATLAB, 358 linesalignMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 358 linesalignMuseMarkers2.m - trash/
pnh_seizures/ , MATLAB, 368 linesalignMuseMarkers_macro.m - trash/
pnh_seizures/ , MATLAB, 114 linesalignstimdata.m - trash/
pnh_seizures/ , MATLAB, 477 linesanalyseVF.m - trash/
pnh_seizures/ , MATLAB, 1,015 linesanalyseVF_2019.m - trash/
pnh_seizures/ , MATLAB, 636 linesanalyseVF_macro.m - trash/
pnh_seizures/ , MATLAB, 680 linesanalyseVF_multisubject.m - trash/
pnh_seizures/ , MATLAB, 162 linesanalyseVF_new.m - trash/
pnh_seizures/ , MATLAB, 150 linesanalyseVL.m - trash/
pnh_seizures/ , MATLAB, 150 linesanalyse_microstim.m - trash/
pnh_seizures/ , MATLAB, 342 linesanalyses_SW.m - trash/
pnh_seizures/ , MATLAB, 267 linesanalyze_periodicity.m - trash/
pnh_seizures/ , MATLAB, 103 linescheckspikequality.m - trash/
pnh_seizures/ , MATLAB, 23 linesdir2.m - trash/
pnh_seizures/ , MATLAB, 60 linesexample_code.m - trash/
pnh_seizures/ , MATLAB, 163 linesft_appendspike.m - trash/
pnh_seizures/ , MATLAB, 43 linesmintersect.m - trash/
pnh_seizures/ , MATLAB, 539 linesmlib6/ mcheck.m - trash/
pnh_seizures/ , MATLAB, 28 linesmlib6/ mnspx.m - trash/
pnh_seizures/ , MATLAB, 125 linesmlib6/ mpsth.m - trash/
pnh_seizures/ , MATLAB, 39 linesmlib6/ mraster.m - trash/
pnh_seizures/ , MATLAB, 27 linesmlib6/ mreshape.m - trash/
pnh_seizures/ , MATLAB, 89 linesmlib6/ mroc.m - trash/
pnh_seizures/ , MATLAB, 120 linesmlib6/ msdf.m - trash/
pnh_seizures/ , MATLAB, 90 linesmlib6/ mwa.m - trash/
pnh_seizures/ , MATLAB, 87 linesmlib6/ mwave.m - trash/
pnh_seizures/ , MATLAB, 74 linesmlib6/ test_msdf.m - trash/
pnh_seizures/ , MATLAB, 27 linesmuse2SC.m - trash/
pnh_seizures/ , MATLAB, 258 linesoverviewspikequality.m - trash/
pnh_seizures/ , MATLAB, 1,198 linespathdef.m - trash/
pnh_seizures/ , MATLAB, 624 linesplotLFP.m - trash/
pnh_seizures/ , MATLAB, 146 linesplotMarkerOverview.m - trash/
pnh_seizures/ , MATLAB, 517 linesplotMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 52 linesplotTFR.m - trash/
pnh_seizures/ , MATLAB, 53 linesplotTFRcontinuous.m - trash/
pnh_seizures/ , MATLAB, 95 linesplotTimeCourses.m - trash/
pnh_seizures/ , MATLAB, 95 linesplotTimeCourses_new.m - trash/
pnh_seizures/ , MATLAB, 223 linesplotTimeCourses_seizures .m - trash/
pnh_seizures/ , MATLAB, 36 linesplot_timecourses.m - trash/
pnh_seizures/ , MATLAB, 399 linesplotdata.m - trash/
pnh_seizures/ , MATLAB, 448 linesplotdata_corr.m - trash/
pnh_seizures/ , MATLAB, 450 linesplotdata_corr2.m - trash/
pnh_seizures/ , MATLAB, 542 linesplotdata_stim.m - trash/
pnh_seizures/ , MATLAB, 100 linesplotdata_stim_trial.m - trash/
pnh_seizures/ , MATLAB, 370 linesplotmarkers.m - trash/
pnh_seizures/ , MATLAB, 160 linesplotpeaks.m - trash/
pnh_seizures/ , MATLAB, 155 linesplotspikequality.m - trash/
pnh_seizures/ , MATLAB, 38 linesplotxcorr.m - trash/
pnh_seizures/ , MATLAB, 1,322 linespnh_project.m - trash/
pnh_seizures/ , MATLAB, 122 linespnh_project_seizures.m - trash/
pnh_seizures/ , MATLAB, 752 linespnh_setparams.m - trash/
pnh_seizures/ , MATLAB, 760 linespnh_setparams_new.m - trash/
pnh_seizures/ , MATLAB, 87 linespnh_setparams_seizures.m - trash/
pnh_seizures/ , MATLAB, 167 linesreadEEG.m - trash/
pnh_seizures/ , MATLAB, 166 linesreadLFP.m - trash/
pnh_seizures/ , MATLAB, 345 linesreadLFP_compat.m - trash/
pnh_seizures/ , MATLAB, 91 linesreadMicroFs.m - trash/
pnh_seizures/ , MATLAB, 61 linesreadMicroFs_alldata.m - trash/
pnh_seizures/ , MATLAB, 91 linesreadMicroFs_spikes.m - trash/
pnh_seizures/ , MATLAB, 181 linesreadMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 219 linesreadSpykingCircus.m - trash/
pnh_seizures/ , MATLAB, 218 linesreadSpykingCircusPSG.m - trash/
pnh_seizures/ , MATLAB, 234 linesreadSpykingCircus_all.m - trash/
pnh_seizures/ , MATLAB, 248 linesreadSpykingCircus_alldat a.m - trash/
pnh_seizures/ , MATLAB, 431 linesreadSpykingCircus_allmar kers.m - trash/
pnh_seizures/ , MATLAB, 436 linesreadSpykingCircus_allmar kers2.m - trash/
pnh_seizures/ , MATLAB, 425 linesreadSpykingCircus_allmar kers3.m - trash/
pnh_seizures/ , MATLAB, 575 linesreadSpykingCircus_allmar kers_alldata.m - trash/
pnh_seizures/ , MATLAB, 301 linesreadSpykingCircus_select ed.m - trash/
pnh_seizures/ , MATLAB, 133 linesreadSpykingCircus_select ed_stim.m - trash/
pnh_seizures/ , MATLAB, 82 linesreadstimdata.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._Mat2NlxCSC.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._Mat2NlxSE.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._Mat2NlxTT.m - trash/
pnh_seizures/ , Shell, not shown herereleaseDec2015/ ._compile.sh - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawCSCData.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawCSCTimestamps.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawSE.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawTTLs.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawCSC.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawEV.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawEV_verify.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawTT.m - trash/
pnh_seizures/ , MATLAB, 137 linesreleaseDec2015/ Mat2NlxCSC.m - trash/
pnh_seizures/ , MATLAB, 137 linesreleaseDec2015/ Mat2NlxSE.m - trash/
pnh_seizures/ , MATLAB, 137 linesreleaseDec2015/ Mat2NlxTT.m - trash/
pnh_seizures/ , Shell, 79 linesreleaseDec2015/ compile.sh - trash/
pnh_seizures/ , MATLAB, 25 linesreleaseDec2015/ getRawCSCData.m - trash/
pnh_seizures/ , MATLAB, 29 linesreleaseDec2015/ getRawCSCTimestamps.m - trash/
pnh_seizures/ , MATLAB, 40 linesreleaseDec2015/ getRawSE.m - trash/
pnh_seizures/ , MATLAB, 22 linesreleaseDec2015/ getRawTTLs.m - trash/
pnh_seizures/ , MATLAB, 53 linesreleaseDec2015/ putRawCSC.m - trash/
pnh_seizures/ , MATLAB, 45 linesreleaseDec2015/ putRawEV.m - trash/
pnh_seizures/ , MATLAB, 39 linesreleaseDec2015/ putRawEV_verify.m - trash/
pnh_seizures/ , MATLAB, 40 linesreleaseDec2015/ putRawTT.m - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._FileDataBucket.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._FileDataBucket.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._GeneralOperations.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._GeneralOperations.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxCSC.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxEV.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxSE.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxTT.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatCSC.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatEV.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx2MatEVInclude.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatSpike.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx2MatVTInclude.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatVt.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx_Code.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_Code.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_DataTypes.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_Error.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_ObjNames.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorCSC.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorCSC.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorEV.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorEV.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorSpike.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorSpike.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorVT.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorVT.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._StdString.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeBuf.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._TimeBuf.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeCSCBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeEventBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeMClustTSBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeSEBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeSTBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeTSBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeTTBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeVideoBuf.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._compatibility.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._compatibility32.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._compatibility64.h - trash/
pnh_seizures/ , C++, 470 linesreleaseDec2015/ source/ FileDataBucket.cpp - trash/
pnh_seizures/ , C/C++, 54 linesreleaseDec2015/ source/ FileDataBucket.h - trash/
pnh_seizures/ , C++, 451 linesreleaseDec2015/ source/ GeneralOperations.cpp - trash/
pnh_seizures/ , C/C++, 57 linesreleaseDec2015/ source/ GeneralOperations.h - trash/
pnh_seizures/ , C++, 150 linesreleaseDec2015/ source/ Mat2NlxCSC.cpp - trash/
pnh_seizures/ , C++, 151 linesreleaseDec2015/ source/ Mat2NlxEV.cpp - trash/
pnh_seizures/ , C++, 162 linesreleaseDec2015/ source/ Mat2NlxSE.cpp - trash/
pnh_seizures/ , C++, 161 linesreleaseDec2015/ source/ Mat2NlxTT.cpp - trash/
pnh_seizures/ , C++, 25 linesreleaseDec2015/ source/ Nlx2MatCSC.cpp - trash/
pnh_seizures/ , C++, 25 linesreleaseDec2015/ source/ Nlx2MatEV.cpp - trash/
pnh_seizures/ , C/C++, 58 linesreleaseDec2015/ source/ Nlx2MatEVInclude.h - trash/
pnh_seizures/ , C++, 24 linesreleaseDec2015/ source/ Nlx2MatSpike.cpp - trash/
pnh_seizures/ , C/C++, 57 linesreleaseDec2015/ source/ Nlx2MatVTInclude.h - trash/
pnh_seizures/ , C++, 29 linesreleaseDec2015/ source/ Nlx2MatVt.cpp - trash/
pnh_seizures/ , C++, 636 linesreleaseDec2015/ source/ Nlx_Code.cpp - trash/
pnh_seizures/ , C/C++, 300 linesreleaseDec2015/ source/ Nlx_Code.h - trash/
pnh_seizures/ , C/C++, 218 linesreleaseDec2015/ source/ Nlx_DataTypes.h - trash/
pnh_seizures/ , C/C++, 254 linesreleaseDec2015/ source/ Nlx_Error.h - trash/
pnh_seizures/ , C/C++, 59 linesreleaseDec2015/ source/ Nlx_ObjNames.h - trash/
pnh_seizures/ , C++, 255 linesreleaseDec2015/ source/ ProcessorCSC.cpp - trash/
pnh_seizures/ , C/C++, 48 linesreleaseDec2015/ source/ ProcessorCSC.h - trash/
pnh_seizures/ , C++, 260 linesreleaseDec2015/ source/ ProcessorEV.cpp - trash/
pnh_seizures/ , C/C++, 47 linesreleaseDec2015/ source/ ProcessorEV.h - trash/
pnh_seizures/ , C++, 655 linesreleaseDec2015/ source/ ProcessorSpike.cpp - trash/
pnh_seizures/ , C/C++, 65 linesreleaseDec2015/ source/ ProcessorSpike.h - trash/
pnh_seizures/ , C++, 262 linesreleaseDec2015/ source/ ProcessorVT.cpp - trash/
pnh_seizures/ , C/C++, 43 linesreleaseDec2015/ source/ ProcessorVT.h - trash/
pnh_seizures/ , C/C++, 3,017 linesreleaseDec2015/ source/ StdString.h - trash/
pnh_seizures/ , C++, 371 linesreleaseDec2015/ source/ TimeBuf.cpp - trash/
pnh_seizures/ , C/C++, 200 linesreleaseDec2015/ source/ TimeBuf.h - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeCSCBuf.cpp - trash/
pnh_seizures/ , C++, 49 linesreleaseDec2015/ source/ TimeEventBuf.cpp - trash/
pnh_seizures/ , C++, 39 linesreleaseDec2015/ source/ TimeMClustTSBuf.cpp - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeSEBuf.cpp - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeSTBuf.cpp - trash/
pnh_seizures/ , C++, 40 linesreleaseDec2015/ source/ TimeTSBuf.cpp - trash/
pnh_seizures/ , C++, 47 linesreleaseDec2015/ source/ TimeTTBuf.cpp - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeVideoBuf.cpp - trash/
pnh_seizures/ , C/C++, 45 linesreleaseDec2015/ source/ compatibility.h - trash/
pnh_seizures/ , C/C++, 46 linesreleaseDec2015/ source/ compatibility32.h - trash/
pnh_seizures/ , C/C++, 45 linesreleaseDec2015/ source/ compatibility64.h - trash/
pnh_seizures/ , MATLAB, 39 linesremoveartefacts_corr.m - trash/
pnh_seizures/ , MATLAB, 42 linesscottclowe-matlab-scheme r-f8115af/ develop/ RGBint2hex.m - trash/
pnh_seizures/ , MATLAB, 131 linesscottclowe-matlab-scheme r-f8115af/ develop/ color2javaRGBint.m - trash/
pnh_seizures/ , C++, 22 linesscottclowe-matlab-scheme r-f8115af/ develop/ sample.cpp - trash/
pnh_seizures/ , Java, 23 linesscottclowe-matlab-scheme r-f8115af/ develop/ sample.java - trash/
pnh_seizures/ , MATLAB, 21 linesscottclowe-matlab-scheme r-f8115af/ develop/ sample.m - trash/
pnh_seizures/ , MATLAB, 15 linesscottclowe-matlab-scheme r-f8115af/ develop/ short_sample.m - trash/
pnh_seizures/ , MATLAB, 677 linesscottclowe-matlab-scheme r-f8115af/ schemer_export.m - trash/
pnh_seizures/ , MATLAB, 712 linesscottclowe-matlab-scheme r-f8115af/ schemer_import.m - trash/
pnh_seizures/ , MATLAB, 683 linessetparams.m - trash/
pnh_seizures/ , MATLAB, 106 linesspikeLFP.m - trash/
pnh_seizures/ , MATLAB, 642 linesspikeratestatsPSG.m - trash/
pnh_seizures/ , MATLAB, 255 linesspiketriggeredplots.m - trash/
pnh_seizures/ , MATLAB, 159 linessubaxis/ parseArgs.m - trash/
pnh_seizures/ , MATLAB, 106 linessubaxis/ subaxis.m - trash/
pnh_seizures/ , MATLAB, 114 linessubplotXmanyY_er.m - trash/
pnh_seizures/ , MATLAB, 87 linessubplot_er.m - trash/
pnh_seizures/ , MATLAB, 7 linessubplottight.m - trash/
pnh_seizures/ , MATLAB, 261 linessynchronize_micromed.m - trash/
pnh_seizures/ , MATLAB, 253 linessynchronize_micromed2.m - trash/
pnh_seizures/ , MATLAB, 283 linessynchronize_micromed_neu ralynx.m - trash/
pnh_seizures/ , MATLAB, 17 linestest.m - trash/
pnh_seizures/ , MATLAB, 18 linestest_correlations_lfp_fr eq.m - trash/
pnh_seizures/ , MATLAB, 16 linestest_script.m - trash/
pnh_seizures/ , MATLAB, 35 linestestdeadtimes.m - trash/
pnh_seizures/ , MATLAB, 39 linestestfig.m - trash/
pnh_seizures/ , R, 248 linesvisualize_spikestats.R - trash/
pnh_seizures/ , R, 188 linesvisualize_spikestats_rev ision.R - trash/
pnh_seizures/ , MATLAB, 84 lineswriteMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 173 lineswriteSpykingCircus.m - trash/
pnh_seizures/ , MATLAB, 101 lineswriteSpykingCircusDeadFi le_concatinated.m - trash/
pnh_seizures/ , MATLAB, 65 lineswritemicroforspykingcirc us.m - trash/
pnh_seizures/ , MATLAB, 172 lineswritemicroforspykingcirc us_alldata.m - trash/
pnh_seizures/ , MATLAB, 55 lineswritemicroforspykingcirc us_alldata2.m - trash/
pnh_seizures/ , MATLAB, 47 lineswritemicroforspykingcirc us_allmarkers.m - trash/
pnh_seizures/ , MATLAB, 68 lineswritemicroforspykingcirc us_onemarker.m - trash/
pnh_seizures/ , MATLAB, 68 lineswritemicroforspykingcirc us_singlepattern.m - trash/
pnh_seizures/ , MATLAB, 76 lineswritemicrostimforspyking circus.m - trash/
readLFP_old.m , MATLAB, 300 lines - trash/
readSpikeRaw_Phy.m , MATLAB, 295 lines - trash/
readSpikeTrials_MuseMark , MATLAB, 359 linesers.m - trash/
readSpikeTrials_MuseMark , MATLAB, 128 linesersPSG.m - trash/
readSpikeTrials_MuseMark , MATLAB, 365 linesers_new.m - trash/
readSpikeTrials_MuseMark , MATLAB, 371 linesers_old.m - trash/
readSpikeTrials_windowed , MATLAB, 283 lines.m - trash/
readSpikeTrials_windowed , MATLAB, 302 lines_samples.m - trash/
readSpikeWaveforms_old.m , MATLAB, 180 lines - trash/
readSpykingCircus_old.m , MATLAB, 202 lines - trash/
readSpykingCircus_phy.m , MATLAB, 144 lines - trash/
readSpykingCircus_phy_ba , MATLAB, 190 linesckup.m - trash/
read_neuralynx_ncs.m , MATLAB, 245 lines - trash/
read_neuralynx_ncs_edite , MATLAB, 245 linesd.m - trash/
rectifywindownr.m , MATLAB, 20 lines - trash/
spikeTrialDensity.m , MATLAB, 220 lines - trash/
spikeTrialDensity_new.m , MATLAB, 226 lines - trash/
spikeratestatsEvents.m , MATLAB, 608 lines - trash/
spikeratestats_old.m , MATLAB, 563 lines - trash/
spikeratestats_parts.m , MATLAB, 582 lines - trash/
spikeratestats_temp.m , MATLAB, 475 lines - trash/
test_force.m , MATLAB, 20 lines - trash/
writeSpykingCircus.m , MATLAB, 242 lines - trash/
writeSpykingCircusDeadFi , MATLAB, 135 linesle.m - trash/
writeSpykingCircusFileLi , MATLAB, 97 linesst - Copy.m - trash/
writeSpykingCircusParame , MATLAB, 205 linesters.m - trash/
writeSpykingCircusParame , MATLAB, 127 linesters_new.m - trash/
writeSpykingCircusParame , MATLAB, 59 linesters_old.m - trash/
writeSpykingCircus_deadf , MATLAB, 125 linesiles.m - trash/
writeSpykingCircus_new.m , MATLAB, 246 lines - trash/
writeSpykingCircus_old.m , MATLAB, 214 lines - trash/
writeSpykingCircus_parfo , MATLAB, 184 linesr.m - LICENSE, License, 674 lines
- README.md, Text, 77 lines
stephenwhitmarsh/epicode
46bf8dc29553cebb50398b76ec0832a76e655be8, 18 November 2022Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
647 files
- development/
TFRtrials_new.m , MATLAB, 57 lines - development/
classification_celltype. , MATLAB, 187 linesm - development/
clusterLFP.m , MATLAB, 551 lines - development/
detectSpikes.m , MATLAB, 213 lines - development/
doTFRcontinuous.m , MATLAB, 105 lines - development/
editMarkerfiles.m , MATLAB, 51 lines - development/
export_hypnogram_backup. , MATLAB, 423 linesm - development/
ft_pimpplot.m , MATLAB, 162 lines - development/
hierachical_clustering.m , MATLAB, 96 lines - development/
modified_fieldtrip_funct , MATLAB, 281 linesions/ ft_spike_maketrials_notu sed.m - development/
modified_fieldtrip_funct , MATLAB, 217 linesions/ ft_spike_select_rmfulltr ials.m - development/
modified_fieldtrip_funct , MATLAB, 424 linesions/ ft_spike_xcorr.m - development/
modified_fieldtrip_funct , MATLAB, 801 linesions/ ft_write_data.m - development/
modified_fieldtrip_funct , MATLAB, 143 linesions/ write_brainvision_eeg.m - development/
plotLFP.m , MATLAB, 644 lines - development/
plotPatterns.m , MATLAB, 170 lines - development/
plot_chan_waveform.m , MATLAB, 50 lines - development/
readHypnogram.m , MATLAB, 229 lines - development/
readMuseMarkers_old.m , MATLAB, 206 lines - development/
writemicroforspykingcirc , MATLAB, 65 linesus_concatinated_trials.m - external/
IniConfig.m , MATLAB, 1,536 lines - external/
bandpassFilter.m , MATLAB, 99 lines - external/
cbrewer/ , MATLAB, not shown herecbrewer/ ._cbrewer.m - external/
cbrewer/ , MATLAB, not shown herecbrewer/ ._interpolate_cbrewer.m - external/
cbrewer/ , MATLAB, not shown herecbrewer/ ._plot_brewer_cmap.m - external/
cbrewer/ , MATLAB, 128 linescbrewer/ cbrewer.m - external/
cbrewer/ , MATLAB, 64 linescbrewer/ change_jet.m - external/
cbrewer/ , MATLAB, 36 linescbrewer/ interpolate_cbrewer.m - external/
cbrewer/ , MATLAB, 50 linescbrewer/ plot_brewer_cmap.m - external/
dtwdist.m , MATLAB, 9 lines - external/
fdr_bh/ , MATLAB, 226 linesfdr_bh.m - external/
fieldtrip/ , MATLAB, 144 linesft_read_neuralynx_interp .m - external/
fieldtrip/ , MATLAB, 285 linesft_spike_maketrials_old. m - external/
fieldtrip/ , MATLAB, 31 linesisdir_or_mkdir.m - external/
fieldtrip/ , MATLAB, 33 linesprivate/ bigendian.m - external/
fieldtrip/ , MATLAB, 89 linesprivate/ cstructdecode.m - external/
fieldtrip/ , MATLAB, 27 linesprivate/ fopen_or_error.m - external/
fieldtrip/ , MATLAB, 237 linesread_neuralynx_nev.m - external/
iniconfig/ , MATLAB, 1,536 linesIniConfig.m - external/
intersections/ , MATLAB, 340 linesintersections.m - external/
linspecer.m , MATLAB, 261 lines - external/
mDetectSpike.m , MATLAB, 351 lines - external/
npy-matlab-master/ , MATLAB, 23 linesexamples/ exampleMemmap.m - external/
npy-matlab-master/ , MATLAB, 88 linesnpy-matlab/ constructNPYheader.m - external/
npy-matlab-master/ , MATLAB, 42 linesnpy-matlab/ datToNPY.m - external/
npy-matlab-master/ , MATLAB, 37 linesnpy-matlab/ readNPY.m - external/
npy-matlab-master/ , MATLAB, 69 linesnpy-matlab/ readNPYheader.m - external/
npy-matlab-master/ , MATLAB, 25 linesnpy-matlab/ writeNPY.m - external/
sigstar-master/ , MATLAB, 120 linesdemo_sigstar.m - external/
sigstar-master/ , MATLAB, 307 linessigstar.m - external/
smooth1q.m , MATLAB, 241 lines - external/
subaxis/ , MATLAB, 159 linesparseArgs.m - external/
subaxis/ , MATLAB, 106 linessubaxis.m - external/
xml2struct/ , MATLAB, 183 linesxml2struct.m - projects/
PET/ , MATLAB, 40 linesPET_classification_cellt ype.m - projects/
PET/ , MATLAB, 42 linesPET_prepare_spykingcircu s.m - projects/
PET/ , MATLAB, 135 linesPET_project_per_patient. m - projects/
PET/ , MATLAB, 279 linesPET_setparams.m - projects/
PET/ , MATLAB, 39 linesPET_verify_markers.m - projects/
PET/ , MATLAB, 69 linesold/ PET_project.m - projects/
PET/ , MATLAB, 28 linesold/ PET_project_grandaverage .m - projects/
PET/ , MATLAB, 93 linesold/ slurm_preictal_project.m - projects/
PET/ , Shell, 15 linesold/ slurm_preictal_project.s h - projects/
PET/ , Shell, 15 linesold/ slurm_writeSpykingCircus .sh - projects/
PET/ , MATLAB, 87 linespet_functions/ PET_add_interIED_epochs. m - projects/
PET/ , MATLAB, 68 linespet_functions/ PET_cut_long_epochs.m - projects/
PET/ , MATLAB, 126 linespet_functions/ PET_neurons_table_timelo cked.m - projects/
PET/ , MATLAB, 59 linespet_functions/ PET_plot_LFP_aligned.m - projects/
PET/ , MATLAB, 554 linespet_functions/ PET_plot_overview_units. m - projects/
PET/ , MATLAB, 37 linespet_functions/ PET_slurm_joblist.m - projects/
PET/ , MATLAB, 168 linespet_functions/ plot_PSTH_stats.m - projects/
PET/ , Shell, 15 linespet_project_per_patient_ slurm.sh - projects/
PET/ , Shell, 12 linesslurm_spyking-circus.sh - projects/
PSG/ , MATLAB, 62 linesPSG_setparams.m - projects/
dcx/ , MATLAB, 93 linesproject_dcx.m - projects/
dtx/ , MATLAB, 41 linescheck_nr_crises_startend .m - projects/
dtx/ , MATLAB, 112 linesconcatenateMuseMarkers.m - projects/
dtx/ , MATLAB, 14 linescv2.m - projects/
dtx/ , MATLAB, 61 linesdtx_TFRtrials.m - projects/
dtx/ , MATLAB, 38 linesdtx_correctDTX2name.m - projects/
dtx/ , MATLAB, 104 linesdtx_edit_Markerfiles.m - projects/
dtx/ , Shell, 16 linesdtx_eeganesth_cluster_sl urm.sh - projects/
dtx/ , MATLAB, 250 linesdtx_eeganesth_project.m - projects/
dtx/ , Shell, 15 linesdtx_eeganesth_project_sl urm.sh - projects/
dtx/ , MATLAB, 606 linesdtx_eeganesth_setparams. m - projects/
dtx/ , MATLAB, 173 linesdtx_eegretigabine_projec t.m - projects/
dtx/ , MATLAB, 179 linesdtx_eegretigabine_setpar ams.m - projects/
dtx/ , MATLAB, 118 linesdtx_eegrodents_cluster.m - projects/
dtx/ , Shell, 16 linesdtx_eegvideo_cluster_slu rm.sh - projects/
dtx/ , MATLAB, 812 linesdtx_eegvideo_project.m - projects/
dtx/ , Shell, 15 linesdtx_eegvideo_project_slu rm.sh - projects/
dtx/ , MATLAB, 347 linesdtx_eegvideo_setparams.m - projects/
dtx/ , MATLAB, 421 linesdtx_patients_lgi1_setpar ams.m - projects/
dtx/ , MATLAB, 959 linesdtx_patientslgi1_project .m - projects/
dtx/ , Shell, 16 linesdtx_patientslgi1_project _slurm.sh - projects/
dtx/ , MATLAB, 100 linesdtx_plot_patients_seizur e.m - projects/
dtx/ , MATLAB, 37 linesdtx_readLFP.m - projects/
dtx/ , MATLAB, 270 linesdtx_remove_wrong_seizure .m - projects/
dtx/ , MATLAB, 57 linesdtx_savefigure.m - projects/
dtx/ , MATLAB, 489 linesdtx_spikes_grandaverage. m - projects/
dtx/ , Shell, 18 linesdtx_spikes_grandaverage_ slurm.sh - projects/
dtx/ , MATLAB, 109 linesdtx_spikes_project.m - projects/
dtx/ , Shell, 19 linesdtx_spikes_project_slurm .sh - projects/
dtx/ , MATLAB, 339 linesdtx_spikes_setparams.m - projects/
dtx/ , MATLAB, 43 linesdtx_spikes_slurm_joblist .m - projects/
dtx/ , Shell, 12 linesdtx_spikes_slurm_runline .sh - projects/
dtx/ , MATLAB, 46 linesdtx_spikes_writeSC.m - projects/
dtx/ , Shell, 19 linesdtx_spikes_writeSC_slurm .sh - projects/
dtx/ , MATLAB, 187 linesdtx_stats_emg_timings.m - projects/
dtx/ , MATLAB, 203 linesdtx_stats_seizure_timing s.m - projects/
dtx/ , MATLAB, 12 linespatch_std.m - projects/
dtx/ , MATLAB, 485 linesplotOverviewDTXspikes.m - projects/
dtx/ , MATLAB, 184 linesplot_morpho.m - projects/
dtx/ , MATLAB, 351 linesreadMuseMarkers_disconti nuousMicromed.m - projects/
dtx/ , MATLAB, 41 linesremoveArtefactedTrials.m - projects/
dtx/ , MATLAB, 577 linesshared_old/ alignMuseMarkersPeaks.m - projects/
dtx/ , MATLAB, 444 linesshared_old/ readLFP.m - projects/
dtx/ , MATLAB, 335 linesshared_old/ readMuseMarkers.m - projects/
dtx/ , MATLAB, 303 linesshared_old/ readSpikeRaw_Phy.m - projects/
dtx/ , MATLAB, 296 linesshared_old/ readSpikeTrials_MuseMark ers.m - projects/
dtx/ , MATLAB, 247 linesshared_old/ readSpikeTrials_windowed .m - projects/
dtx/ , MATLAB, 194 linesshared_old/ readSpikeWaveforms.m - projects/
dtx/ , MATLAB, 11 linesshared_old/ saveMarker.m - projects/
dtx/ , MATLAB, 132 linesshared_old/ spikeTrialDensity.m - projects/
dtx/ , MATLAB, 203 linesshared_old/ spikeTrialStats.m - projects/
dtx/ , MATLAB, 172 linesshared_old/ spikeWaveformStats.m - projects/
dtx/ , MATLAB, 240 linesshared_old/ writeSpykingCircus.m - projects/
dtx/ , MATLAB, 149 linesshared_old/ writeSpykingCircusDeadfi les.m - projects/
dtx/ , MATLAB, 191 linesshared_old/ writeSpykingCircusParame ters.m - projects/
dtx/ , MATLAB, 52 linessummarized_neurons_table .m - projects/
hspike/ , MATLAB, 332 linesFigure1.m - projects/
hspike/ , MATLAB, 161 linesFigure2.m - projects/
hspike/ , MATLAB, 231 linesFigure3.m - projects/
hspike/ , MATLAB, 193 linesFigure_FFT.m - projects/
hspike/ , MATLAB, 738 linesFigure_LFP_stages.m - projects/
hspike/ , MATLAB, 208 linesFigure_PSTH_all.m - projects/
hspike/ , MATLAB, 696 linesFigure_firingrates.m - projects/
hspike/ , MATLAB, 161 linesFigure_hypnogarms.m - projects/
hspike/ , MATLAB, 154 linesFigure_hypnograms.m - projects/
hspike/ , MATLAB, 1,164 linesFigure_psth.m - projects/
hspike/ , MATLAB, 363 linesFigure_raster.m - projects/
hspike/ , MATLAB, 363 linesFigure_template_timing.m - projects/
hspike/ , MATLAB, 524 linesFigure_templates.m - projects/
hspike/ , R, 61 linesR_leftovers.R - projects/
hspike/ , R, 44 linesRscript.R - projects/
hspike/ , MATLAB, 127 linesTrials2GrandAverage.m - projects/
hspike/ , MATLAB, 75 linesaddparts.m - projects/
hspike/ , MATLAB, 60 linesalignClusters.m - projects/
hspike/ , MATLAB, 101 linesalignTemplates.m - projects/
hspike/ , MATLAB, 75 linesalignTemplates_new.m - projects/
hspike/ , R, 3,194 lines, 3 matchesanalysis.R - projects/
hspike/ , Python, 1 lineclustering.py - projects/
hspike/ , MATLAB, 164 lineshspike_cluster.m - projects/
hspike/ , Shell, 18 lineshspike_cluster.sh - projects/
hspike/ , MATLAB, 42 lineshspike_cluster_FFT.m - projects/
hspike/ , Shell, 14 lineshspike_cluster_FFT.sh - projects/
hspike/ , MATLAB, 46 lineshspike_cluster_SpikeStat s_window.m - projects/
hspike/ , MATLAB, 19 lineshspike_cluster_SpykingCi rcus.m - projects/
hspike/ , MATLAB, 47 lineshspike_cluster_spikestat s.m - projects/
hspike/ , Shell, 14 lineshspike_cluster_spikestat s.sh - projects/
hspike/ , MATLAB, 68 lineshspike_cluster_template. m - projects/
hspike/ , Shell, 15 lineshspike_cluster_template. sh - projects/
hspike/ , MATLAB, 1,224 lineshspike_project.m - projects/
hspike/ , MATLAB, 344 lineshspike_project_June14_20 21.m - projects/
hspike/ , MATLAB, 926 lineshspike_setparams.m - projects/
hspike/ , MATLAB, 80 lineshspike_setparams_temp.m - projects/
hspike/ , MATLAB, 36 lineshspike_setpaths.m - projects/
hspike/ , Shell, 14 lineshspike_slurm.sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_FFT.sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_SpikeStats_ window.sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_spikestats. sh - projects/
hspike/ , Shell, 14 lineshspike_slurm_template.sh - projects/
hspike/ , MATLAB, 62 lineshspike_spike_cluster.m - projects/
hspike/ , Shell, 14 lineshspike_spike_cluster.sh - projects/
hspike/ , Shell, 14 lineshspike_spike_slurm.sh - projects/
hspike/ , MATLAB, 132 lineshspike_write_spykingcirc us_cluster.m - projects/
hspike/ , MATLAB, 22 linesms_to_samples.m - projects/
hspike/ , MATLAB, 142 linespadHypnogram.m - projects/
hspike/ , MATLAB, 432 linesplotGrandAverage.m - projects/
hspike/ , MATLAB, 1,286 linesplotGrandAverageAll.m - projects/
hspike/ , MATLAB, 286 linesplotGrandAverageTimelock edModel.m - projects/
hspike/ , MATLAB, 211 linesplotGrandAverageWindowed Model.m - projects/
hspike/ , MATLAB, 432 linesplotGrandAverage_timeloc ked.m - projects/
hspike/ , MATLAB, 466 linesplotGrandAverage_windowe d.m - projects/
hspike/ , MATLAB, 2 linesplotHypnogramPolar.m - projects/
hspike/ , MATLAB, 268 linesplotLFP_stages.m - projects/
hspike/ , MATLAB, 767 linesplotOverviewHspike.m - projects/
hspike/ , MATLAB, 227 linesplotPSGoverview.m - projects/
hspike/ , MATLAB, 67 linesplotTimingPolar.m - projects/
hspike/ , MATLAB, 41 linesplotTimingPolar_all.m - projects/
hspike/ , MATLAB, 85 linesplotshifts.m - projects/
hspike/ , MATLAB, 76 linesplotstats.m - projects/
hspike/ , MATLAB, 19 linesplotwaveforms.m - projects/
hspike/ , MATLAB, 11 linespnh_spyking-circus.m - projects/
hspike/ , Shell, 11 linespnh_spyking-circus.sh - projects/
hspike/ , MATLAB, 70 linessdfStats.m - projects/
hspike/ , MATLAB, 31 linessetpaths.m - projects/
hspike/ , Shell, 17 linesslurm_SpykingCircus.sh - projects/
hspike/ , Shell, 11 linesslurm_runline.sh - projects/
hspike/ , Shell, 11 linesslurm_runline_normalmem. sh - projects/
hspike/ , MATLAB, 177 linesspikeTrialStats_GrandAve rage.m - projects/
hspike/ , MATLAB, 180 linestest_ncs_gaps.m - projects/
hspike/ , MATLAB, 18 linestest_waveshapes.m - projects/
hspike/ , MATLAB, 65 linestestscript_hypnogram.m - projects/
hspike/ , R, 248 linesvisualize_spikestats.R - projects/
hypconn/ , MATLAB, 39 lineshypconn_project.m - projects/
hypconn/ , MATLAB, 171 lineshypconn_setparams.m - projects/
katia/ , MATLAB, 42 lineskatia_prepare_spykingcir cus.m - projects/
katia/ , MATLAB, 46 lineskatia_project.m - projects/
katia/ , MATLAB, 135 lineskatia_project_per_patien t.m - projects/
katia/ , Shell, 15 lineskatia_project_per_patien t_slurm.sh - projects/
katia/ , MATLAB, 262 lineskatia_setparams.m - projects/
katia/ , MATLAB, 37 lineskatia_slurm_joblist.m - projects/
katia/ , Shell, 12 linesslurm_spyking-circus.sh - projects/
pnh/ , MATLAB, 373 linesFigure0.m - projects/
pnh/ , MATLAB, 292 linesFigure2.m - projects/
pnh/ , MATLAB, 278 linesFigure3.m - projects/
pnh/ , MATLAB, 276 linesFigure3_new.m - projects/
pnh/ , MATLAB, 129 linesFigure4.m - projects/
pnh/ , MATLAB, 129 linesFigureS1.m - projects/
pnh/ , MATLAB, 150 linesTable1.m - projects/
pnh/ , MATLAB, 370 linesTable2.m - projects/
pnh/ , MATLAB, 148 linesanalyze_periodicity.m - projects/
pnh/ , MATLAB, 34 linescreate_slurm_joblist.m - projects/
pnh/ , MATLAB, 216 linesft_spike_select_rmfulltr ials.m - projects/
pnh/ , MATLAB, 113 linesplotTimeCoursesExamples. m - projects/
pnh/ , MATLAB, 173 linesplot_patterns_multilevel .m - projects/
pnh/ , MATLAB, 396 linesplot_patterns_multilevel _examples.m - projects/
pnh/ , MATLAB, 83 linesplotshifts.m - projects/
pnh/ , MATLAB, 113 linespnh_cluster.m - projects/
pnh/ , Shell, 17 linespnh_cluster.sh - projects/
pnh/ , MATLAB, 413 linespnh_project.m - projects/
pnh/ , MATLAB, 924 linespnh_project_new.m - projects/
pnh/ , MATLAB, 601 linespnh_setparams.m - projects/
pnh/ , Shell, 11 linespnh_spyking-circus.sh - projects/
pnh/ , MATLAB, 210 linesstats_unit_behaviour.m - projects/
preictal/ , MATLAB, 69 linesbackup/ preictal_launch_SpykingC ircus.m - projects/
preictal/ , MATLAB, 23 linesbackup/ preictal_launch_SpykingC ircus_extracting.m - projects/
preictal/ , MATLAB, 128 linesbackup/ preictal_project.m - projects/
preictal/ , MATLAB, 135 linesbackup/ preictal_project_LC - Copie.m - projects/
preictal/ , MATLAB, 112 linesbackup/ preictal_project_LC - Copie2.m - projects/
preictal/ , MATLAB, 168 linesbackup/ preictal_project_LC_back up.m - projects/
preictal/ , MATLAB, 284 linesbackup/ preictal_setparams - Copie.m - projects/
preictal/ , Shell, 12 linesbackup/ slurm_spyking-circus.sh - projects/
preictal/ , Shell, 17 linesbackup/ slurm_spyking-circus_ext racting.sh - projects/
preictal/ , Shell, 16 linesbackup/ slurm_spyking-circus_ext racting_test.sh - projects/
preictal/ , Shell, 16 linesbackup/ slurm_spyking-circus_tes t.sh - projects/
preictal/ , MATLAB, 220 linesold/ preictal_project_LC.m - projects/
preictal/ , MATLAB, 201 linesold/ preictal_project_SW.m - projects/
preictal/ , MATLAB, 247 linesold/ preictal_setparams_SW.m - projects/
preictal/ , MATLAB, 56 linesold/ preictal_writeSpykingCir cus.m - projects/
preictal/ , MATLAB, 93 linesold/ slurm_preictal_project.m - projects/
preictal/ , Shell, 17 linesold/ slurm_spyking-circus_old .sh - projects/
preictal/ , Shell, 15 linesold/ slurm_writeSpykingCircus .sh - projects/
preictal/ , MATLAB, 201 linespreictal_functions/ addMuseBAD.m - projects/
preictal/ , MATLAB, 101 linespreictal_functions/ plotOverviewPreictal.m - projects/
preictal/ , MATLAB, 199 linespreictal_functions/ plot_spikestats_preictal .m - projects/
preictal/ , MATLAB, 54 linespreictal_functions/ preictal_gather_data.m - projects/
preictal/ , MATLAB, 214 linespreictal_functions/ preictal_plot_spikestats .m - projects/
preictal/ , MATLAB, 44 linespreictal_functions/ preictal_spikes_slurm_jo blist.m - projects/
preictal/ , MATLAB, 43 linespreictal_functions/ remove_artefacted_trials .m - projects/
preictal/ , Shell, 17 linespreictal_functions/ slurm_spyking-circus_old .sh - projects/
preictal/ , MATLAB, 56 linespreictal_prepare_spyking circus.m - projects/
preictal/ , MATLAB, 246 linespreictal_project.m - projects/
preictal/ , Shell, 14 linespreictal_project_slurm.s h - projects/
preictal/ , MATLAB, 1,359 linespreictal_setparams.m - projects/
preictal/ , Shell, 12 linesslurm_spyking-circus.sh - projects/
ripples/ , MATLAB, 321 linesripples_analysis.m - projects/
ripples/ , MATLAB, 194 linesripples_analysis_old.m - projects/
ripples/ , MATLAB, 178 linesripples_getdata.m - projects/
ripples/ , MATLAB, 189 linesripples_getdata_old.m - projects/
seg/ , MATLAB, 143 linesplotSeizureSegmentation. m - projects/
seg/ , MATLAB, 62 linesseg_cluster.m - projects/
seg/ , MATLAB, 84 linesseg_project.m - projects/
seg/ , MATLAB, 88 linesseg_setparams.m - projects/
seg/ , Shell, 13 linesseg_slurm.sh - projects/
wod/ , Shell, 26 linesconcatenate_lfp/ slurm_concat_LFP.sh - projects/
wod/ , MATLAB, 98 linesconcatenate_lfp/ wod_concatenateLFP.m - projects/
wod/ , MATLAB, 98 linesedit_markerfile.m - projects/
wod/ , MATLAB, 153 linesold/ wod_project_lfp.m - projects/
wod/ , MATLAB, 39 linesold/ wod_setparams_lfp.m - projects/
wod/ , Shell, 26 linesslurm_wod_project.sh - projects/
wod/ , Shell, 26 linesslurm_writespykingcircus .sh - projects/
wod/ , MATLAB, 72 linestemporary/ modifs_script_pour_TFR.m - projects/
wod/ , MATLAB, 160 linestemporary/ wod_plot_each_rat.m - projects/
wod/ , MATLAB, 50 linestemporary/ wor_detect.m - projects/
wod/ , MATLAB, 788 lineswod_project.m - projects/
wod/ , MATLAB, 175 lineswod_setparams.m - projects/
wod/ , MATLAB, 35 lineswod_writespykingcircus.m - shared/
FFTtrials.m , MATLAB, 137 lines - shared/
TFRtrials.m , MATLAB, 134 lines - shared/
addSlidingWindows.m , MATLAB, 104 lines, 1 match - shared/
alignMuseMarkersPeaks.m , MATLAB, 564 lines - shared/
alignMuseMarkersXcorr.m , MATLAB, 335 lines - shared/
clusterLFP.m , MATLAB, 645 lines - shared/
compute_synchrony_spiky. , MATLAB, 174 linesm - shared/
detectTemplate.m , MATLAB, 469 lines - shared/
exportHypnogram.m , MATLAB, 408 lines - shared/
hypnogramMuseStats.m , MATLAB, 188 lines - shared/
inter_trial_intervals.m , MATLAB, 104 lines - shared/
plotHypnogram.m , MATLAB, 240 lines - shared/
plotWindowedData.m , MATLAB, 570 lines - shared/
plot_patterns_multilevel , MATLAB, 354 lines_examples.m - shared/
plot_spike_trial_example , MATLAB, 151 lines.m - shared/
plot_spike_waveforms.m , MATLAB, 187 lines - shared/
plotstats.m , MATLAB, 112 lines - shared/
readLFP.m , MATLAB, 476 lines - shared/
readLFPavg.m , MATLAB, 311 lines - shared/
readMuseMarker.m , MATLAB, 79 lines - shared/
readMuseMarkers.m , MATLAB, 356 lines - shared/
readRippleLab.m , MATLAB, 61 lines - shared/
readSpikeRaw_Phy.m , MATLAB, 323 lines - shared/
readSpikeRaw_SpykingCirc , MATLAB, 120 linesus.m - shared/
readSpikeTrials.m , MATLAB, 402 lines - shared/
readSpikeWaveforms.m , MATLAB, 236 lines - shared/
readSpikeWaveforms_fromR , MATLAB, 183 linesaw.m - shared/
rerefLFP.m , MATLAB, 109 lines - shared/
spikePSTH.m , MATLAB, 230 lines - shared/
spikeTrialStats.m , MATLAB, 344 lines - shared/
spikeWaveformStats.m , MATLAB, 184 lines - shared/
spikeratestatsSleepStage , MATLAB, 500 lines.m - shared/
stats_IED_behaviour.m , MATLAB, 292 lines - shared/
stats_unit_behaviour.m , MATLAB, 213 lines - shared/
stats_unit_density.m , MATLAB, 313 lines - shared/
summarized_neurons_table , MATLAB, 98 lines.m - shared/
utilities/ , MATLAB, 24 linesCommonElemTol.m - shared/
utilities/ , MATLAB, 84 linesPSG2table.m - shared/
utilities/ , MATLAB, 201 linesaddMuseBAD.m - shared/
utilities/ , MATLAB, 54 linesalignXcorr.m - shared/
utilities/ , MATLAB, 130 linesconcatenateMuseMarkers.m - shared/
utilities/ , MATLAB, 23 linesdir2.m - shared/
utilities/ , MATLAB, 119 lineseditMuseMarkers.m - shared/
utilities/ , MATLAB, 71 linesfind_muse_marker_in_tria l.m - shared/
utilities/ , MATLAB, 69 linesget_data_format.m - shared/
utilities/ , MATLAB, 79 linesget_data_format2.m - shared/
utilities/ , MATLAB, 12 linesloadload.m - shared/
utilities/ , MATLAB, 48 linesmerge_MuseMarkers.m - shared/
utilities/ , MATLAB, 9 linesnaneucdist.m - shared/
utilities/ , MATLAB, 43 linesnanxcorr.m - shared/
utilities/ , MATLAB, 13 linesnanznorm.m - shared/
utilities/ , MATLAB, 24 linesnormxcorr2e.m - shared/
utilities/ , MATLAB, 12 linespatch_std.m - shared/
utilities/ , MATLAB, 60 linesplot_hyp_lines.m - shared/
utilities/ , MATLAB, 86 linesread_nev_Muse.m - shared/
utilities/ , MATLAB, 71 linesremove_artefacted_trials .m - shared/
utilities/ , MATLAB, 60 linesremove_too_short_trials. m - shared/
utilities/ , MATLAB, 11 linessaveMarker_FFT.m - shared/
utilities/ , MATLAB, 11 linessaveMarker_LFP.m - shared/
utilities/ , MATLAB, 11 linessaveMarker_SpikeTrials.m - shared/
utilities/ , MATLAB, 11 linessaveMarker_TFR.m - shared/
utilities/ , MATLAB, 56 linessavefigure_own.m - shared/
utilities/ , MATLAB, 9 linesshift.m - shared/
utilities/ , MATLAB, 15 linesupdateBadMuseMarkers.m - shared/
utilities/ , MATLAB, 18 linesupdateHypnogramMarkers.m - shared/
utilities/ , MATLAB, 19 linesupdateMarkers.m - shared/
utilities/ , MATLAB, 85 linesverifymarkers.m - shared/
utilities/ , MATLAB, 89 lineswriteMuseMarkerfile.m - shared/
utilities/ , MATLAB, 90 lineswriteMuseMarkerfile_Brai nvision.m - shared/
utilities/ , MATLAB, 41 lineswriteProbeFile.m - shared/
writeSpykingCircusDeadfi , MATLAB, 157 linesles.m - shared/
writeSpykingCircusFileLi , MATLAB, 228 linesst.m - shared/
writeSpykingCircusParame , MATLAB, 205 linesters.m - trash/
DBSCAN/ , MATLAB, 75 linesDBSCAN.m - trash/
DBSCAN/ , MATLAB, 47 linesPlotClusterinResult.m - trash/
DBSCAN/ , MATLAB, 34 linesmain.m - trash/
MuseMarkers_update_filep , MATLAB, 52 linesath.m - trash/
MuseMarkers_update_filep , MATLAB, 29 linesath_old.m - trash/
RunLength_2017_04_08/ , MATLAB, 307 linesInstallMex.m - trash/
RunLength_2017_04_08/ , C, 459 linesRunLength.c - trash/
RunLength_2017_04_08/ , MATLAB, 77 linesRunLength.m - trash/
RunLength_2017_04_08/ , MATLAB, 162 linesRunLength_M.m - trash/
RunLength_2017_04_08/ , MATLAB, 588 linesuTest_RunLength.m - trash/
acf/ , MATLAB, 112 linesacf.m - trash/
alignMuseMarkersXcorr0.m , MATLAB, 197 lines - trash/
alignMuseMarkers_macro.m , MATLAB, 369 lines - trash/
bsearch/ , MATLAB, 67 linesbsearch.m - trash/
dtx_spikes_figure_spiked , MATLAB, 301 linesensity_slowwave.m - trash/
dtx_spikes_plot_raw.m , MATLAB, 125 lines - trash/
dynamic_time_warping_v2/ , MATLAB, 28 linesdemo_dtw.m - trash/
dynamic_time_warping_v2/ , MATLAB, 38 linesdtw.m - trash/
dynamic_time_warping_v2/ , C, 195 linesdtw_c.c - trash/
findPattern.m , MATLAB, 464 lines - trash/
findPattern2D.m , MATLAB, 534 lines - trash/
findPattern_deleted.m , MATLAB, 1 line - trash/
findPattern_saved.m , MATLAB, 448 lines - trash/
ft_spike_isi_edited.m , MATLAB, 201 lines, 1 match - trash/
hypnogramStats.m , MATLAB, 595 lines - trash/
ini2struct/ , MATLAB, 123 linesini2struct.m - trash/
inifile.m , MATLAB, 891 lines - trash/
inifile/ , MATLAB, 891 linesinifile.m - trash/
plotWindowedData.m , MATLAB, 156 lines - trash/
pnh_project.m , MATLAB, 1,332 lines - trash/
pnh_seizures/ , MATLAB, 6 linesMultiOuterJoin.m - trash/
pnh_seizures/ , MATLAB, 42 linesMuse2txt.m - trash/
pnh_seizures/ , R, 248 linesR/ visualize_spikestats.R - trash/
pnh_seizures/ , R, 188 linesR/ visualize_spikestats_rev ision.R - trash/
pnh_seizures/ , MATLAB, 57 linesTFR_seizures.m - trash/
pnh_seizures/ , MATLAB, 358 linesalignMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 358 linesalignMuseMarkers2.m - trash/
pnh_seizures/ , MATLAB, 368 linesalignMuseMarkers_macro.m - trash/
pnh_seizures/ , MATLAB, 114 linesalignstimdata.m - trash/
pnh_seizures/ , MATLAB, 477 linesanalyseVF.m - trash/
pnh_seizures/ , MATLAB, 1,015 linesanalyseVF_2019.m - trash/
pnh_seizures/ , MATLAB, 636 linesanalyseVF_macro.m - trash/
pnh_seizures/ , MATLAB, 680 linesanalyseVF_multisubject.m - trash/
pnh_seizures/ , MATLAB, 162 linesanalyseVF_new.m - trash/
pnh_seizures/ , MATLAB, 150 linesanalyseVL.m - trash/
pnh_seizures/ , MATLAB, 150 linesanalyse_microstim.m - trash/
pnh_seizures/ , MATLAB, 342 linesanalyses_SW.m - trash/
pnh_seizures/ , MATLAB, 267 linesanalyze_periodicity.m - trash/
pnh_seizures/ , MATLAB, 103 linescheckspikequality.m - trash/
pnh_seizures/ , MATLAB, 23 linesdir2.m - trash/
pnh_seizures/ , MATLAB, 60 linesexample_code.m - trash/
pnh_seizures/ , MATLAB, 163 linesft_appendspike.m - trash/
pnh_seizures/ , MATLAB, 43 linesmintersect.m - trash/
pnh_seizures/ , MATLAB, 539 lines, 1 matchmlib6/ mcheck.m - trash/
pnh_seizures/ , MATLAB, 28 linesmlib6/ mnspx.m - trash/
pnh_seizures/ , MATLAB, 125 lines, 1 matchmlib6/ mpsth.m - trash/
pnh_seizures/ , MATLAB, 39 linesmlib6/ mraster.m - trash/
pnh_seizures/ , MATLAB, 27 linesmlib6/ mreshape.m - trash/
pnh_seizures/ , MATLAB, 89 linesmlib6/ mroc.m - trash/
pnh_seizures/ , MATLAB, 120 linesmlib6/ msdf.m - trash/
pnh_seizures/ , MATLAB, 90 linesmlib6/ mwa.m - trash/
pnh_seizures/ , MATLAB, 87 linesmlib6/ mwave.m - trash/
pnh_seizures/ , MATLAB, 74 linesmlib6/ test_msdf.m - trash/
pnh_seizures/ , MATLAB, 27 linesmuse2SC.m - trash/
pnh_seizures/ , MATLAB, 258 linesoverviewspikequality.m - trash/
pnh_seizures/ , MATLAB, 1,198 linespathdef.m - trash/
pnh_seizures/ , MATLAB, 624 linesplotLFP.m - trash/
pnh_seizures/ , MATLAB, 146 linesplotMarkerOverview.m - trash/
pnh_seizures/ , MATLAB, 517 linesplotMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 52 linesplotTFR.m - trash/
pnh_seizures/ , MATLAB, 53 linesplotTFRcontinuous.m - trash/
pnh_seizures/ , MATLAB, 95 linesplotTimeCourses.m - trash/
pnh_seizures/ , MATLAB, 95 linesplotTimeCourses_new.m - trash/
pnh_seizures/ , MATLAB, 223 linesplotTimeCourses_seizures .m - trash/
pnh_seizures/ , MATLAB, 36 linesplot_timecourses.m - trash/
pnh_seizures/ , MATLAB, 399 linesplotdata.m - trash/
pnh_seizures/ , MATLAB, 448 linesplotdata_corr.m - trash/
pnh_seizures/ , MATLAB, 450 linesplotdata_corr2.m - trash/
pnh_seizures/ , MATLAB, 542 linesplotdata_stim.m - trash/
pnh_seizures/ , MATLAB, 100 linesplotdata_stim_trial.m - trash/
pnh_seizures/ , MATLAB, 370 linesplotmarkers.m - trash/
pnh_seizures/ , MATLAB, 160 linesplotpeaks.m - trash/
pnh_seizures/ , MATLAB, 155 linesplotspikequality.m - trash/
pnh_seizures/ , MATLAB, 38 linesplotxcorr.m - trash/
pnh_seizures/ , MATLAB, 1,322 linespnh_project.m - trash/
pnh_seizures/ , MATLAB, 122 linespnh_project_seizures.m - trash/
pnh_seizures/ , MATLAB, 752 linespnh_setparams.m - trash/
pnh_seizures/ , MATLAB, 760 linespnh_setparams_new.m - trash/
pnh_seizures/ , MATLAB, 87 linespnh_setparams_seizures.m - trash/
pnh_seizures/ , MATLAB, 167 linesreadEEG.m - trash/
pnh_seizures/ , MATLAB, 166 linesreadLFP.m - trash/
pnh_seizures/ , MATLAB, 345 linesreadLFP_compat.m - trash/
pnh_seizures/ , MATLAB, 91 linesreadMicroFs.m - trash/
pnh_seizures/ , MATLAB, 61 linesreadMicroFs_alldata.m - trash/
pnh_seizures/ , MATLAB, 91 linesreadMicroFs_spikes.m - trash/
pnh_seizures/ , MATLAB, 181 linesreadMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 219 linesreadSpykingCircus.m - trash/
pnh_seizures/ , MATLAB, 218 linesreadSpykingCircusPSG.m - trash/
pnh_seizures/ , MATLAB, 234 linesreadSpykingCircus_all.m - trash/
pnh_seizures/ , MATLAB, 248 linesreadSpykingCircus_alldat a.m - trash/
pnh_seizures/ , MATLAB, 431 linesreadSpykingCircus_allmar kers.m - trash/
pnh_seizures/ , MATLAB, 436 linesreadSpykingCircus_allmar kers2.m - trash/
pnh_seizures/ , MATLAB, 425 linesreadSpykingCircus_allmar kers3.m - trash/
pnh_seizures/ , MATLAB, 575 linesreadSpykingCircus_allmar kers_alldata.m - trash/
pnh_seizures/ , MATLAB, 301 linesreadSpykingCircus_select ed.m - trash/
pnh_seizures/ , MATLAB, 133 linesreadSpykingCircus_select ed_stim.m - trash/
pnh_seizures/ , MATLAB, 82 linesreadstimdata.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._Mat2NlxCSC.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._Mat2NlxSE.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._Mat2NlxTT.m - trash/
pnh_seizures/ , Shell, not shown herereleaseDec2015/ ._compile.sh - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawCSCData.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawCSCTimestamps.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawSE.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._getRawTTLs.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawCSC.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawEV.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawEV_verify.m - trash/
pnh_seizures/ , MATLAB, not shown herereleaseDec2015/ ._putRawTT.m - trash/
pnh_seizures/ , MATLAB, 137 linesreleaseDec2015/ Mat2NlxCSC.m - trash/
pnh_seizures/ , MATLAB, 137 linesreleaseDec2015/ Mat2NlxSE.m - trash/
pnh_seizures/ , MATLAB, 137 linesreleaseDec2015/ Mat2NlxTT.m - trash/
pnh_seizures/ , Shell, 79 linesreleaseDec2015/ compile.sh - trash/
pnh_seizures/ , MATLAB, 25 linesreleaseDec2015/ getRawCSCData.m - trash/
pnh_seizures/ , MATLAB, 29 linesreleaseDec2015/ getRawCSCTimestamps.m - trash/
pnh_seizures/ , MATLAB, 40 linesreleaseDec2015/ getRawSE.m - trash/
pnh_seizures/ , MATLAB, 22 linesreleaseDec2015/ getRawTTLs.m - trash/
pnh_seizures/ , MATLAB, 53 linesreleaseDec2015/ putRawCSC.m - trash/
pnh_seizures/ , MATLAB, 45 linesreleaseDec2015/ putRawEV.m - trash/
pnh_seizures/ , MATLAB, 39 linesreleaseDec2015/ putRawEV_verify.m - trash/
pnh_seizures/ , MATLAB, 40 linesreleaseDec2015/ putRawTT.m - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._FileDataBucket.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._FileDataBucket.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._GeneralOperations.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._GeneralOperations.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxCSC.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxEV.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxSE.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Mat2NlxTT.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatCSC.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatEV.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx2MatEVInclude.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatSpike.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx2MatVTInclude.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx2MatVt.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._Nlx_Code.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_Code.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_DataTypes.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_Error.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._Nlx_ObjNames.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorCSC.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorCSC.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorEV.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorEV.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorSpike.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorSpike.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._ProcessorVT.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._ProcessorVT.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._StdString.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeBuf.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._TimeBuf.h - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeCSCBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeEventBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeMClustTSBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeSEBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeSTBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeTSBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeTTBuf.cpp - trash/
pnh_seizures/ , C++, not shown herereleaseDec2015/ source/ ._TimeVideoBuf.cpp - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._compatibility.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._compatibility32.h - trash/
pnh_seizures/ , C/C++, not shown herereleaseDec2015/ source/ ._compatibility64.h - trash/
pnh_seizures/ , C++, 470 linesreleaseDec2015/ source/ FileDataBucket.cpp - trash/
pnh_seizures/ , C/C++, 54 linesreleaseDec2015/ source/ FileDataBucket.h - trash/
pnh_seizures/ , C++, 451 linesreleaseDec2015/ source/ GeneralOperations.cpp - trash/
pnh_seizures/ , C/C++, 57 linesreleaseDec2015/ source/ GeneralOperations.h - trash/
pnh_seizures/ , C++, 150 linesreleaseDec2015/ source/ Mat2NlxCSC.cpp - trash/
pnh_seizures/ , C++, 151 linesreleaseDec2015/ source/ Mat2NlxEV.cpp - trash/
pnh_seizures/ , C++, 162 linesreleaseDec2015/ source/ Mat2NlxSE.cpp - trash/
pnh_seizures/ , C++, 161 linesreleaseDec2015/ source/ Mat2NlxTT.cpp - trash/
pnh_seizures/ , C++, 25 linesreleaseDec2015/ source/ Nlx2MatCSC.cpp - trash/
pnh_seizures/ , C++, 25 linesreleaseDec2015/ source/ Nlx2MatEV.cpp - trash/
pnh_seizures/ , C/C++, 58 linesreleaseDec2015/ source/ Nlx2MatEVInclude.h - trash/
pnh_seizures/ , C++, 24 linesreleaseDec2015/ source/ Nlx2MatSpike.cpp - trash/
pnh_seizures/ , C/C++, 57 linesreleaseDec2015/ source/ Nlx2MatVTInclude.h - trash/
pnh_seizures/ , C++, 29 linesreleaseDec2015/ source/ Nlx2MatVt.cpp - trash/
pnh_seizures/ , C++, 636 linesreleaseDec2015/ source/ Nlx_Code.cpp - trash/
pnh_seizures/ , C/C++, 300 linesreleaseDec2015/ source/ Nlx_Code.h - trash/
pnh_seizures/ , C/C++, 218 linesreleaseDec2015/ source/ Nlx_DataTypes.h - trash/
pnh_seizures/ , C/C++, 254 linesreleaseDec2015/ source/ Nlx_Error.h - trash/
pnh_seizures/ , C/C++, 59 linesreleaseDec2015/ source/ Nlx_ObjNames.h - trash/
pnh_seizures/ , C++, 255 linesreleaseDec2015/ source/ ProcessorCSC.cpp - trash/
pnh_seizures/ , C/C++, 48 linesreleaseDec2015/ source/ ProcessorCSC.h - trash/
pnh_seizures/ , C++, 260 linesreleaseDec2015/ source/ ProcessorEV.cpp - trash/
pnh_seizures/ , C/C++, 47 linesreleaseDec2015/ source/ ProcessorEV.h - trash/
pnh_seizures/ , C++, 655 linesreleaseDec2015/ source/ ProcessorSpike.cpp - trash/
pnh_seizures/ , C/C++, 65 linesreleaseDec2015/ source/ ProcessorSpike.h - trash/
pnh_seizures/ , C++, 262 linesreleaseDec2015/ source/ ProcessorVT.cpp - trash/
pnh_seizures/ , C/C++, 43 linesreleaseDec2015/ source/ ProcessorVT.h - trash/
pnh_seizures/ , C/C++, 3,017 linesreleaseDec2015/ source/ StdString.h - trash/
pnh_seizures/ , C++, 371 linesreleaseDec2015/ source/ TimeBuf.cpp - trash/
pnh_seizures/ , C/C++, 200 linesreleaseDec2015/ source/ TimeBuf.h - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeCSCBuf.cpp - trash/
pnh_seizures/ , C++, 49 linesreleaseDec2015/ source/ TimeEventBuf.cpp - trash/
pnh_seizures/ , C++, 39 linesreleaseDec2015/ source/ TimeMClustTSBuf.cpp - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeSEBuf.cpp - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeSTBuf.cpp - trash/
pnh_seizures/ , C++, 40 linesreleaseDec2015/ source/ TimeTSBuf.cpp - trash/
pnh_seizures/ , C++, 47 linesreleaseDec2015/ source/ TimeTTBuf.cpp - trash/
pnh_seizures/ , C++, 45 linesreleaseDec2015/ source/ TimeVideoBuf.cpp - trash/
pnh_seizures/ , C/C++, 45 linesreleaseDec2015/ source/ compatibility.h - trash/
pnh_seizures/ , C/C++, 46 linesreleaseDec2015/ source/ compatibility32.h - trash/
pnh_seizures/ , C/C++, 45 linesreleaseDec2015/ source/ compatibility64.h - trash/
pnh_seizures/ , MATLAB, 39 linesremoveartefacts_corr.m - trash/
pnh_seizures/ , MATLAB, 42 linesscottclowe-matlab-scheme r-f8115af/ develop/ RGBint2hex.m - trash/
pnh_seizures/ , MATLAB, 131 linesscottclowe-matlab-scheme r-f8115af/ develop/ color2javaRGBint.m - trash/
pnh_seizures/ , C++, 22 linesscottclowe-matlab-scheme r-f8115af/ develop/ sample.cpp - trash/
pnh_seizures/ , Java, 23 linesscottclowe-matlab-scheme r-f8115af/ develop/ sample.java - trash/
pnh_seizures/ , MATLAB, 21 linesscottclowe-matlab-scheme r-f8115af/ develop/ sample.m - trash/
pnh_seizures/ , MATLAB, 15 linesscottclowe-matlab-scheme r-f8115af/ develop/ short_sample.m - trash/
pnh_seizures/ , MATLAB, 677 linesscottclowe-matlab-scheme r-f8115af/ schemer_export.m - trash/
pnh_seizures/ , MATLAB, 712 linesscottclowe-matlab-scheme r-f8115af/ schemer_import.m - trash/
pnh_seizures/ , MATLAB, 683 linessetparams.m - trash/
pnh_seizures/ , MATLAB, 106 linesspikeLFP.m - trash/
pnh_seizures/ , MATLAB, 642 linesspikeratestatsPSG.m - trash/
pnh_seizures/ , MATLAB, 255 linesspiketriggeredplots.m - trash/
pnh_seizures/ , MATLAB, 159 linessubaxis/ parseArgs.m - trash/
pnh_seizures/ , MATLAB, 106 linessubaxis/ subaxis.m - trash/
pnh_seizures/ , MATLAB, 114 linessubplotXmanyY_er.m - trash/
pnh_seizures/ , MATLAB, 87 linessubplot_er.m - trash/
pnh_seizures/ , MATLAB, 7 linessubplottight.m - trash/
pnh_seizures/ , MATLAB, 261 linessynchronize_micromed.m - trash/
pnh_seizures/ , MATLAB, 253 linessynchronize_micromed2.m - trash/
pnh_seizures/ , MATLAB, 283 linessynchronize_micromed_neu ralynx.m - trash/
pnh_seizures/ , MATLAB, 17 linestest.m - trash/
pnh_seizures/ , MATLAB, 18 linestest_correlations_lfp_fr eq.m - trash/
pnh_seizures/ , MATLAB, 16 linestest_script.m - trash/
pnh_seizures/ , MATLAB, 35 linestestdeadtimes.m - trash/
pnh_seizures/ , MATLAB, 39 linestestfig.m - trash/
pnh_seizures/ , R, 248 linesvisualize_spikestats.R - trash/
pnh_seizures/ , R, 188 linesvisualize_spikestats_rev ision.R - trash/
pnh_seizures/ , MATLAB, 84 lineswriteMuseMarkers.m - trash/
pnh_seizures/ , MATLAB, 173 lineswriteSpykingCircus.m - trash/
pnh_seizures/ , MATLAB, 101 lineswriteSpykingCircusDeadFi le_concatinated.m - trash/
pnh_seizures/ , MATLAB, 65 lineswritemicroforspykingcirc us.m - trash/
pnh_seizures/ , MATLAB, 172 lineswritemicroforspykingcirc us_alldata.m - trash/
pnh_seizures/ , MATLAB, 55 lineswritemicroforspykingcirc us_alldata2.m - trash/
pnh_seizures/ , MATLAB, 47 lineswritemicroforspykingcirc us_allmarkers.m - trash/
pnh_seizures/ , MATLAB, 68 lineswritemicroforspykingcirc us_onemarker.m - trash/
pnh_seizures/ , MATLAB, 68 lineswritemicroforspykingcirc us_singlepattern.m - trash/
pnh_seizures/ , MATLAB, 76 lineswritemicrostimforspyking circus.m - trash/
readLFP_old.m , MATLAB, 300 lines - trash/
readSpikeRaw_Phy.m , MATLAB, 295 lines - trash/
readSpikeTrials_MuseMark , MATLAB, 359 linesers.m - trash/
readSpikeTrials_MuseMark , MATLAB, 128 linesersPSG.m - trash/
readSpikeTrials_MuseMark , MATLAB, 365 linesers_new.m - trash/
readSpikeTrials_MuseMark , MATLAB, 371 linesers_old.m - trash/
readSpikeTrials_windowed , MATLAB, 283 lines.m - trash/
readSpikeTrials_windowed , MATLAB, 302 lines_samples.m - trash/
readSpikeWaveforms_old.m , MATLAB, 180 lines - trash/
readSpykingCircus_old.m , MATLAB, 202 lines - trash/
readSpykingCircus_phy.m , MATLAB, 144 lines - trash/
readSpykingCircus_phy_ba , MATLAB, 190 linesckup.m - trash/
read_neuralynx_ncs.m , MATLAB, 245 lines - trash/
read_neuralynx_ncs_edite , MATLAB, 245 linesd.m - trash/
rectifywindownr.m , MATLAB, 20 lines - trash/
spikeTrialDensity.m , MATLAB, 220 lines - trash/
spikeTrialDensity_new.m , MATLAB, 226 lines - trash/
spikeratestatsEvents.m , MATLAB, 608 lines - trash/
spikeratestats_old.m , MATLAB, 563 lines - trash/
spikeratestats_parts.m , MATLAB, 582 lines - trash/
spikeratestats_temp.m , MATLAB, 475 lines - trash/
test_force.m , MATLAB, 20 lines - trash/
writeSpykingCircus.m , MATLAB, 242 lines - trash/
writeSpykingCircusDeadFi , MATLAB, 135 linesle.m - trash/
writeSpykingCircusFileLi , MATLAB, 97 linesst - Copy.m - trash/
writeSpykingCircusParame , MATLAB, 205 linesters.m - trash/
writeSpykingCircusParame , MATLAB, 127 linesters_new.m - trash/
writeSpykingCircusParame , MATLAB, 59 linesters_old.m - trash/
writeSpykingCircus_deadf , MATLAB, 125 linesiles.m - trash/
writeSpykingCircus_new.m , MATLAB, 246 lines - trash/
writeSpykingCircus_old.m , MATLAB, 214 lines - trash/
writeSpykingCircus_parfo , MATLAB, 184 linesr.m - LICENSE, License, 674 lines
- README.md, Text, 83 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 1,291 scripts, each with its path and the digest of its content;
- 8 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability
All scripts are made available here (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 5 keywords, 138 references, 1 RRID, 1 integrity notice.
Cite
This paper
Whitmarsh, S., Nguyen-Michel, V.-H., Lehongre, K., Mathon, B., Adam, C., Lambrecq, V., Frazzini, V., & Navarro, V. (2026). Sleep increases firing rate modulation during interictal epileptiform discharges in mesial temporal structures. Brain communications, 8(3), fcag130. https://
BibTeX
@article{whitmarsh2026sl
author = {Whitmarsh, Stephen and Nguyen-Michel, Vi-Huong and Lehongre, Katia and Mathon, Bertrand and Adam, Claude and Lambrecq, Virginie and Frazzini, Valerio and Navarro, Vincent},
title = {{Sleep increases firing rate modulation during interictal epileptiform discharges in mesial temporal structures}},
journal = {Brain communications},
year = {2026},
month = apr,
volume = {8},
number = {3},
pages = {fcag130},
publisher = {Oxford University Press},
issn = {2632-1297},
doi = {10.1093/
url = {https://
pmid = {42244910},
pmcid = {PMC13231451}
}
RIS
TY - JOUR
AU - Whitmarsh, Stephen
AU - Nguyen-Michel, Vi-Huong
AU - Lehongre, Katia
AU - Mathon, Bertrand
AU - Adam, Claude
AU - Lambrecq, Virginie
AU - Frazzini, Valerio
AU - Navarro, Vincent
TI - Sleep increases firing rate modulation during interictal epileptiform discharges in mesial temporal structures
T2 - Brain communications
J2 - Brain Commun
PY - 2026
DA - 2026/
VL - 8
IS - 3
SP - fcag130
SN - 2632-1297
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"type": "article-journal",
"title": "Sleep increases firing rate modulation during interictal epileptiform discharges in mesial temporal structures",
"container-title": "Brain communications",
"author": [
{
"family": "Whitmarsh",
"given": "Stephen"
},
{
"family": "Nguyen-Michel",
"given": "Vi-Huong"
},
{
"family": "Lehongre",
"given": "Katia"
},
{
"family": "Mathon",
"given": "Bertrand"
},
{
"family": "Adam",
"given": "Claude"
},
{
"family": "Lambrecq",
"given": "Virginie"
},
{
"family": "Frazzini",
"given": "Valerio"
},
{
"family": "Navarro",
"given": "Vincent"
}
],
"container-title-short":
"volume": "8",
"issue": "3",
"page": "fcag130",
"DOI": "10.1093/
"PMID": "42244910",
"PMCID": "PMC13231451",
"ISSN": "2632-1297",
"publisher": "Oxford University Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
30
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1111/psyp.70265 [code]
- Neurocognitive Dynamics of Translating Information From a Spatial Map Into Action.Journal: PsychophysiologyIn common: Parallel Computing Toolbox, emmeans, lmerTest, 7 other tools, EEG, 2 references
- [2] doi:10.1016/j.celrep.2026.117646 [code]
- Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.Journal: Cell reportsIn common: export_fig, FieldTrip, Parallel Computing Toolbox, 7 other tools
- [3] doi:10.1038/s41467-026-74565-0 [code]
- The functional neurobiology of dispositions towards negative emotions.Journal: Nature communicationsIn common: fdr_bh (Benjamini-Hochberg FDR), FieldTrip, Parallel Computing Toolbox, 7 other tools
- [4] doi:10.7554/elife.107088 [code]
- Development of auditory and spontaneous movement responses to music over the first postnatal year.Journal: eLifeIn common: FieldTrip, emmeans, lme4, 6 other tools, EEG, 1 reference
- [5] doi:10.1016/j.neuroimage.2026.122115 [code]
- Midfrontal theta power relates to response speeding following frustrative nonreward.Journal: NeuroImageIn common: emmeans, lmerTest, lme4, 6 other tools, EEG, 1 reference
- [6] doi:10.1002/hbm.70605 [code]
- BrainEnrich: Revealing Biological Insights for Imaging-Derived Phenotypes Through Transcriptomic Enrichment.Journal: Human brain mappingIn common: fdr_bh (Benjamini-Hochberg FDR), emmeans, lmerTest, 6 other tools
- [7] doi:10.1038/s41467-026-74753-y [code]
- A human-specific microRNA controls the timing of excitatory synaptogenesis.Journal: Nature communicationsIn common: circlize, emmeans, lmerTest, 6 other tools
- [8] doi:10.1523/eneuro.0076-26.2026 [code]
- Exogenously Driven Neural Reactivation of Spatially Matching Visual Working-Memory Contents.Journal: eNeuroIn common: FieldTrip, emmeans, lme4, 6 other tools, EEG
- [9] doi:10.1093/nc/niag011 [code]
- Towards a bridge between intracerebral and surface EEG signatures of conscious report.Journal: Neuroscience of consciousnessIn common: EEG, 1 reference, 2 authors
- [10] doi:10.64898/2026.05.08.26348885 [code]
- Insights from nine nights of self-applied, low-density sleep EEG during sleep restriction therapy: a proof-of-concept evaluationJournal: medRxiv (preprint)In common: FieldTrip, emmeans, lmerTest, 6 other tools, EEG
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 1291 scripts, and 8 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:514f51e12c27266b…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
