OSCR

Calbindin stratifies midbrain dopaminergic neurons governing distinct aspects of locomotion.

Code ↔ Paper

6 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 6 matches
  1. [1] § Results › Silencing of CALB1− or CALB1+ DA Neurons Uncovers Dissociable Roles in Motor Learning but Shared Contributions to Voluntary Movement. ↔ Open Field Analysis/DREADD/Open Field Analysis_DREADD_TimeCentre_Batch1.R, lines 164–224 · score 0.61 · Games Howell, post hoc, way ANOVA, fDIO, mCherry, mice
  2. [2] § Results › DA Transients in the DLS May Contribute to Movement Vigor, but Are Neither Necessary Nor Sufficient to Command Their Execution. ↔ Fiberphotometry/Fiberphotometry_DA peaks to locomotor bouts analysis.R, lines 1353–1394 · score 0.54 · locomotor bouts, dLight, fDIO, transitorily, mCherry, peak
  3. [3] § Results › DA Transients in the DLS May Contribute to Movement Vigor, but Are Neither Necessary Nor Sufficient to Command Their Execution. ↔ Fiberphotometry/Fiberphotometry_DA peaks to locomotor bouts analysis.R, lines 1353–1394 · score 0.54 · pre DCZ, forcing locomotion, hM4Di, mice
  4. [4] § Results › Non-Cell-Autonomous Loss of CALB1− DA Neurons Following CALB1+ Ablation Coincides With Local Inflammation. ↔ Striatum analysis/Striatum analysis_taCasp3_Dat-Cre.R, lines 630–684 · score 0.52 · Dat ires Cre, post hoc, way ANOVA, Tukey, striatum, striatal
  5. [5] § Results › DA Transients in the DLS May Contribute to Movement Vigor, but Are Neither Necessary Nor Sufficient to Command Their Execution. ↔ Fiberphotometry/Fiberphotometry_DA peaks analysis.R, lines 322–387 · score 0.52 · DCZ injection, dLight, fDIO, intervals, mCherry, SD
  6. [6] § Results › CALB1− or CALB1+ DA Neurons’ Bilateral Ablation Yields Distinct Impairments on Weight Loss and Motor Learning, but Shared Deficits on Voluntary Movements. ↔ Rotarod Analysis.R, lines 550–602 · score 0.52 · Games Howell, taCasp3, mixed, slope, Latency, day

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 · 1,624 lines · 67 KB · no license · 2 matches

  1. library(ggplot2)
  2. library(tidyverse)
  3. library(data.table)
  4. library(ggpubr)
  5. library(tidyplots)
  6. library(data.table)
  7. library(DescTools)
  8. library(magick)
  9. library(imager)
  10. library(lattice)
  11. library(viridis)
  12. #library(paletteer)
  13. library(gplots)
  14. library(sommer)
  15. library(patchwork)
  16. library(gganimate)
  17. library(lubridate)
  18. library(ggpointdensity)
  19. library(stringr)
  20. library(scales)
  21. library(purrr)
  22. library(gglinedensity)
  23. library(ggExtra)
  24. library(WRS2)
  25. library(rstatix)
  26. #-------------------------------------------------------------------------------
  27. ################################################################################
  28. ########################## LOADING BODY MOTION TRACES ########################
  29. ################################################################################
  30. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/BodyTraces_csv")
  31. #Import the body traces as a list
  32. csv_files <- list.files(pattern = "\\.csv$")
  33. Body_motion <- list()
  34. for (n in csv_files) {
  35. Body_motion[[n]] <- read.csv(n)
  36. Body_motion[[n]]$Time <- Body_motion[[n]]$frame_idx * 0.0333333333333333 #Note add a column to provide the timescale to fibrephotometry, resolution is 0,0333 sec. per frame
  37. }
  38. names(Body_motion) <- unlist(strsplit(csv_files, split = ".analysis.csv"))
  39. #-------------------------------------------------------------------------------
  40. #Load the image
  41. #image_filenames <- list.files(pattern="*.png")
  42. #img <- readPNG(image_filenames[1])
  43. #h <- nrow(img)
  44. #w <- ncol(img)
  45. #windows(width = 10, height = 10 * (h/w))
  46. #par(mar = c(0,0,0,0), xaxs = "i", yaxs = "i")
  47. #plot(1, type = "n", xlim = c(0, w), ylim = c(h, 0), asp = 1, axes = FALSE)
  48. #rasterImage(img, 0, h, w, 0)
  49. #Place two dots in corners
  50. #pts <- locator(2)
  51. #Show the points
  52. #points(pts$x, pts$y, col = "red", pch = 19, cex = 1.5)
  53. #Extract the distance in pixels
  54. #x1 <- pts$x[1]
  55. #y1 <- pts$y[1]
  56. #x2 <- pts$x[2]
  57. #y2 <- pts$y[2]
  58. #Pixel_Distance <- sqrt((x2-x1)^2+(y2-y1)^2)
  59. #Resolution <- 39.5/Pixel_Distance
  60. #Resolution
  61. #Note: The value I got for one pixel is equivalent to 0.04483225, or 0.448mm
  62. Resolution <- 0.448
  63. #-------------------------------------------------------------------------------
  64. #Quality control
  65. Torso <- list()
  66. for (mouseID in names(Body_motion)) {
  67. Torso[[mouseID]] <- Body_motion[[mouseID]]
  68. #Remove the rows has unlablled torso points
  69. Torso[[mouseID]] <- Torso[[mouseID]][!is.na(Torso[[mouseID]]$torso.x),]
  70. Torso[[mouseID]] <- Torso[[mouseID]][!is.na(Torso[[mouseID]]$torso.y),]
  71. #Remove the rows that has no torso score
  72. Torso[[mouseID]] <- Torso[[mouseID]][!is.na(Torso[[mouseID]]$torso.score),]
  73. #Remove the torso points tnat has a confidence score < 0.8
  74. Torso[[mouseID]] <- Torso[[mouseID]][Torso[[mouseID]]$torso.score>0.8,]
  75. #Convert the x y coordinates into mm scale
  76. Torso[[mouseID]][,c("head.x", "head.y", "torso.x", "torso.y", "tail_base.x", "tail_base.y")] <- Torso[[mouseID]][,c("head.x", "head.y", "torso.x", "torso.y", "tail_base.x", "tail_base.y")] * Resolution
  77. #Remove the track column
  78. Torso[[mouseID]]$track <- NULL
  79. }
  80. #------------------------------------------------------------------------
  81. #Downsample the data to the time resolution
  82. time_resolution <- 0.1 #Time resolution in second
  83. for (mouseID in names(Torso)) {
  84. print(mouseID)
  85. Ref_frames <- seq(from = 0, to = 2100, by = time_resolution)
  86. Closest_frames <- Closest(Torso[[mouseID]]$Time, Ref_frames, which = FALSE, na.rm = FALSE)
  87. New_frames <- c()
  88. for (x in 1:length(Closest_frames)) {
  89. New_frames[x] <- Closest_frames[[x]]
  90. }
  91. New_frames <- unique(New_frames) #Some frames have been assigned in double, so need to take only the unique ones
  92. Frame_indices <- c()
  93. for (x in 1:length(New_frames)) {
  94. Frame_indices[x] <- which(Torso[[mouseID]]$Time == New_frames[x])
  95. }
  96. #Subsample the frames
  97. Torso[[mouseID]] <- Torso[[mouseID]][Frame_indices,]
  98. }
  99. #-------------------------------------------------------------------------------
  100. #Compute the values to velocity
  101. velocity <- function(X1, X2, Y1, Y2, T1, T2) {
  102. speed <- (sqrt((X2 - X1)^2 + (Y2-Y1)^2))/(T2-T1)
  103. return (speed)
  104. }
  105. for (mouseID in names(Torso)) {
  106. print(mouseID)
  107. Torso.velocity <- c()
  108. for (x in 2:nrow(Torso[[mouseID]])) {
  109. Torso.velocity[x] <- velocity(X1 = Torso[[mouseID]]$torso.x[x-1],
  110. X2 = Torso[[mouseID]]$torso.x[x],
  111. Y1 = Torso[[mouseID]]$torso.y[x-1],
  112. Y2 = Torso[[mouseID]]$torso.y[x],
  113. T1 = Torso[[mouseID]]$Time[x-1],
  114. T2 = Torso[[mouseID]]$Time[x])
  115. }
  116. Torso[[mouseID]]$Torso.velocity <- Torso.velocity
  117. }
  118. #------------------------------------------------------------------------
  119. #Rearrange the torso list keeping the sleap_data as a separate element
  120. Torso_New <- list()
  121. for (mouseID in names(Torso)) {
  122. Torso_New[[mouseID]][["Sleap_data"]] <- Torso[[mouseID]]
  123. }
  124. Torso <- Torso_New
  125. Torso_New <- NULL
  126. #------------------------------------------------------------------------
  127. # Extract the bouts
  128. #Note: Bouts will be defined as speed is defined as an occurence where the speed is suddenly increased >25mm/s for at least 600ms
  129. #Set the threshold for speed and time
  130. Speed_Threshold <- 25 #in mm/s
  131. Time_Threshold <- 0.6 #in sec.
  132. #Extract the bouts
  133. for (mouseID in names(Torso)) {
  134. #Identify the index having a velocity value higher than the time threshold
  135. idx <- which(Torso[[mouseID]][["Sleap_data"]]$Torso.velocity > Speed_Threshold)
  136. grp <- cumsum(c(1, diff(idx) != 1)) #Identify index that are seperated by more than one value
  137. Potential_bouts <- split(idx, grp)
  138. Bouts_Start_Index <- c()
  139. Bouts_End_Index <- c()
  140. for (n in 1:length(Potential_bouts)) {
  141. Start_Index <- Potential_bouts[[n]][1]
  142. End_Index <- Potential_bouts[[n]][length(Potential_bouts[[n]])]
  143. #Filter for the bouts that are longer than the time threshold
  144. if (Torso[[mouseID]][["Sleap_data"]]$Time[End_Index] - Torso[[mouseID]][["Sleap_data"]]$Time[Start_Index] > Time_Threshold) {
  145. Bouts_Start_Index[n] <- Start_Index - 1 #Adding one index prior occurence which has a speed > threshold
  146. Bouts_End_Index[n] <- End_Index + 1 #Adding one index post bout occurence which has a speed > threshold
  147. }
  148. }
  149. #Remove the NA generated
  150. Bouts_Start_Index <- Bouts_Start_Index[!is.na(Bouts_Start_Index)]
  151. Bouts_End_Index <- Bouts_End_Index[!is.na(Bouts_End_Index)]
  152. #Store the bouts index
  153. Torso[[mouseID]][["Bouts_Index"]] <- data.frame(Start_Index = Bouts_Start_Index, End_Index = Bouts_End_Index)
  154. #Generate a list to store the bouts
  155. Torso[[mouseID]][["Bouts"]] <- list()
  156. for (Bout_n in 1:nrow(Torso[[mouseID]][["Bouts_Index"]])) {
  157. Torso[[mouseID]][["Bouts"]][[Bout_n]] <- Torso[[mouseID]][["Sleap_data"]][Torso[[mouseID]][["Bouts_Index"]]$Start_Index[Bout_n]:Torso[[mouseID]][["Bouts_Index"]]$End_Index[Bout_n],]
  158. }
  159. }
  160. #------------------------------------------------------------------------
  161. #Save the RDS file
  162. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Body_motion")
  163. saveRDS(Torso, file = "Body_motion.rds")
  164. #------------------------------------------------------------------------
  165. #Integrate the body motion and DA traces together
  166. Body_motion <- readRDS("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Body_motion/Body_motion.rds")
  167. #Filter the speed of K0331 at the moment where the cable got unpluged
  168. Body_motion[["K0331"]][["Sleap_data"]] <- Body_motion[["K0331"]][["Sleap_data"]] |>
  169. dplyr::filter(!between(Time, 1640, 1680))
  170. Body_motion[["K0331"]][["Sleap_data"]] <- Body_motion[["K0331"]][["Sleap_data"]] |>
  171. dplyr::filter(!between(Time, 1820, 1860))
  172. intervals <- list(c(1640, 1680), c(1820, 1860))
  173. Body_motion[["K0331"]][["Bouts"]] <- Filter(function(bout) {
  174. bout_time <- bout$Time
  175. is_bad <- any(sapply(intervals, function(inter) {
  176. any(bout_time >= inter[1] & bout_time <= inter[2])
  177. }))
  178. return(!is_bad)
  179. }, Body_motion[["K0331"]][["Bouts"]])
  180. #Import the traces as a list
  181. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/dLightTraces/DFF/LowBF3Hz_IRLS300sec")
  182. #csv_files <- list.files(pattern = "\\.csv$")
  183. #Traces <- list()
  184. #for (n in 1:length(csv_files)) {
  185. # Traces[[n]] <- read.csv(csv_files[n])
  186. #}
  187. #names(Traces) <- unlist(strsplit(csv_files, split = "_DFF_0000.csv"))
  188. Traces <- readRDS("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Peaks analysis/LOESS_Traces.rds")
  189. names(Traces) <- unlist(strsplit(names(Traces), split = "_DFF_0000.csv"))
  190. #Add the DA trace per mouse
  191. for (mouseID in names(Body_motion)) {
  192. Body_motion[[mouseID]][["dLight_DFF"]] <- Traces[[mouseID]]
  193. }
  194. #There is a mistake of labelling to one of these ID, I will correct it later
  195. #Body_motion[["K0861"]][["dLight_DFF"]] <- Traces[["J0861"]]
  196. Body_motion[["K0871"]][["dLight_DFF"]] <- Traces[["J0871"]]
  197. #Add a AIN01 column that correspond to DFF
  198. for (mouseID in names(Body_motion)) {
  199. Body_motion[[mouseID]][["dLight_DFF"]]$AIN01 <- Body_motion[[mouseID]][["dLight_DFF"]]$DFF * 100
  200. }
  201. #Generate a column where the average trace generated by loess is substracted from the deltaF/F
  202. for (mouseID in names(Body_motion)) {
  203. Body_motion[[mouseID]][["dLight_DFF"]]$DFF_LOESSsub <- Body_motion[[mouseID]][["dLight_DFF"]]$AIN01 - Body_motion[[mouseID]][["dLight_DFF"]]$loess0.1
  204. }
  205. #------------------------------------------------------------------------
  206. #Generate an average trace for dLight prior and post-bout occurence and bout peak-speed
  207. Plot_PeakSpeed <- function(curve_to_timeloc, n_Seconds, min_time, max_time, title, ylim) {
  208. curve_col_index <- which(colnames(Body_motion[[mouseID]][["dLight_DFF"]]) == curve_to_timeloc)
  209. Bouts <- list()
  210. for (mouseID in names(Body_motion)) {
  211. Bouts[[mouseID]] <- list()
  212. Bouts[[mouseID]][["Bouts"]] <- list()
  213. for (Bout_n in seq_along(Body_motion[[mouseID]][["Bouts"]])) {
  214. start_time <- Body_motion[[mouseID]][["Bouts"]][[Bout_n]]$Time[1]
  215. if (start_time > min_time && start_time < max_time) {
  216. Bouts[[mouseID]][["Bouts"]][[length(Bouts[[mouseID]][["Bouts"]]) + 1]] <- Body_motion[[mouseID]][["Bouts"]][[Bout_n]]
  217. }
  218. }
  219. }
  220. #Time loc these bouts few seconds before and after to their occurence
  221. #n_Seconds <- 2
  222. for (mouseID in names(Bouts)) {
  223. print(paste("Time loc:", mouseID))
  224. Bouts[[mouseID]][["Time_Range"]] <- list()
  225. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  226. Bout <- Bouts[[mouseID]][["Bouts"]][[Bout_n]]
  227. Start_Time <- Bout$Time[1]
  228. Pre_Time <- Start_Time - n_Seconds
  229. Post_Time <- Start_Time + n_Seconds
  230. Peak_Time <- Bout[which.max(Bout$Time),]$Time
  231. Peak_Pre_Time <- Peak_Time - n_Seconds
  232. Peak_Post_Time <- Peak_Time + n_Seconds
  233. Bouts[[mouseID]][["Time_Range"]][[Bout_n]] <- data.frame(Start_Time = Start_Time,
  234. Pre_Time = Pre_Time,
  235. Post_Time = Post_Time,
  236. Peak_Time = Peak_Time,
  237. Peak_Pre_Time = Peak_Pre_Time,
  238. Peak_Post_Time = Peak_Post_Time)
  239. }
  240. }
  241. #Time loc the dLight traces
  242. for (mouseID in names(Bouts)) {
  243. print(paste("Time loc step2:", mouseID))
  244. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]] <- list()
  245. Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]] <- list()
  246. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  247. Start_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Start_Time
  248. Pre_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Pre_Time
  249. Post_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Post_Time
  250. Peak_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Time
  251. Peak_Pre_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Pre_Time
  252. Peak_Post_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Post_Time
  253. dLight_DFF <- Body_motion[[mouseID]][["dLight_DFF"]]
  254. dLight_DFF <- dLight_DFF[dLight_DFF$Time > Pre_Time & dLight_DFF$Time < Post_Time,]
  255. dLight_DFF$Time_Loc <- dLight_DFF$Time - Start_Time
  256. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]][[Bout_n]] <- dLight_DFF
  257. dLight_DFF <- Body_motion[[mouseID]][["dLight_DFF"]]
  258. dLight_DFF <- dLight_DFF[dLight_DFF$Time > Peak_Pre_Time & dLight_DFF$Time < Peak_Post_Time,]
  259. dLight_DFF$Time_Loc <- dLight_DFF$Time - Peak_Time
  260. Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]][[Bout_n]] <- dLight_DFF
  261. }
  262. }
  263. #Since the T times for Time loc are not exactly the same, interpolate the deltaF/F values at consensus times
  264. for (mouseID in names(Bouts)) {
  265. print(paste("Interpolation:", mouseID))
  266. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]] <- list()
  267. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]] <- list()
  268. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  269. Time <- seq(from = -n_Seconds, to = n_Seconds, by = 0.02)
  270. data <- Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]][[Bout_n]]
  271. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]] <- as.data.frame(approx(x = data$Time_Loc, y = data[,curve_col_index], xout = Time))
  272. colnames(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]]) <- c("Time", "dLight_DFF")
  273. Time <- seq(from = -n_Seconds, to = n_Seconds, by = 0.02)
  274. data <- Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]
  275. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]] <- as.data.frame(approx(x = data$Time_Loc, y = data[,curve_col_index], xout = Time))
  276. colnames(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]) <- c("Time", "dLight_DFF")
  277. }
  278. }
  279. #Combine all the interpolated traces
  280. All_traces <- list()
  281. counter <- 1
  282. for (mouseID in names(Bouts)) {
  283. for (Bout_n in seq_along(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]])) {
  284. All_traces[[counter]] <- Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]]
  285. All_traces[[counter]]$TraceID <- as.character(rep(counter, times = nrow(All_traces[[counter]])))
  286. All_traces[[counter]]$mouseID <- rep(mouseID, times = nrow(All_traces[[counter]]))
  287. counter <- counter + 1
  288. }
  289. }
  290. from_BoutStart <- bind_rows(All_traces)
  291. from_BoutStart <- from_BoutStart %>%
  292. mutate(
  293. Group = case_when(
  294. mouseID == "J0777" ~ "fDIO-mCherry",
  295. mouseID == "J0782" ~ "fDIO-mCherry",
  296. mouseID == "J0859" ~ "fDIO-mCherry",
  297. mouseID == "K0871" ~ "fDIO-mCherry",
  298. mouseID == "J0779" ~ "CoffFon-hM4Di",
  299. mouseID == "J0784" ~ "CoffFon-hM4Di",
  300. mouseID == "K0331" ~ "CoffFon-hM4Di",
  301. mouseID == "K0994" ~ "CoffFon-hM4Di",
  302. mouseID == "K0861" ~ "CoffFon-hM4Di",
  303. mouseID == "K0029" ~ "ConFon-hM4Di",
  304. mouseID == "K0863" ~ "ConFon-hM4Di",
  305. mouseID == "K0865" ~ "ConFon-hM4Di",
  306. mouseID == "K0990" ~ "ConFon-hM4Di"
  307. )
  308. )
  309. All_traces <- list()
  310. counter <- 1
  311. for (mouseID in names(Bouts)) {
  312. for (Bout_n in seq_along(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]])) {
  313. All_traces[[counter]] <- Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]
  314. All_traces[[counter]]$TraceID <- as.character(rep(counter, times = nrow(All_traces[[counter]])))
  315. All_traces[[counter]]$mouseID <- rep(mouseID, times = nrow(All_traces[[counter]]))
  316. counter <- counter + 1
  317. }
  318. }
  319. from_PeakSpeed <- bind_rows(All_traces)
  320. from_PeakSpeed <- from_PeakSpeed %>%
  321. mutate(
  322. Group = case_when(
  323. mouseID == "J0777" ~ "fDIO-mCherry",
  324. mouseID == "J0782" ~ "fDIO-mCherry",
  325. mouseID == "J0859" ~ "fDIO-mCherry",
  326. mouseID == "K0871" ~ "fDIO-mCherry",
  327. mouseID == "J0779" ~ "CoffFon-hM4Di",
  328. mouseID == "J0784" ~ "CoffFon-hM4Di",
  329. mouseID == "K0331" ~ "CoffFon-hM4Di",
  330. mouseID == "K0994" ~ "CoffFon-hM4Di",
  331. mouseID == "K0861" ~ "CoffFon-hM4Di",
  332. mouseID == "K0029" ~ "ConFon-hM4Di",
  333. mouseID == "K0863" ~ "ConFon-hM4Di",
  334. mouseID == "K0865" ~ "ConFon-hM4Di",
  335. mouseID == "K0990" ~ "ConFon-hM4Di"
  336. )
  337. )
  338. plot <- from_PeakSpeed |>
  339. tidyplot(x = Time, y = dLight_DFF, color = Group) |>
  340. add_mean_line() |>
  341. add_ci95_ribbon() |>
  342. adjust_title(title) |>
  343. adjust_x_axis_title("Time from peak speed (sec.)") |>
  344. adjust_x_axis(limits = c(-2, 1.5), breaks = seq(from = -10, to = 10, by = 0.5)) |>
  345. adjust_y_axis(limits = ylim, breaks = seq(from = -10, to = 10, by = 1)) |>
  346. adjust_y_axis_title("dLight dF/F (%)") #|>
  347. ggsave(paste(title, "_PeakSpeed.pdf", sep = ""),
  348. width = 4,
  349. height = 4,
  350. plot = plot)
  351. plot
  352. #Collect the number of bouts per mouse
  353. nBouts <- c()
  354. for (mouseID_n in 1:length(Bouts)) {
  355. nBouts[mouseID_n] <- length(Bouts[[mouseID_n]][["Bouts"]])
  356. }
  357. nBouts_df <- data.frame(mouseID = names(Bouts), nBouts = nBouts)
  358. nBouts_df <- nBouts_df %>%
  359. mutate(
  360. Group = case_when(
  361. mouseID == "J0777" ~ "fDIO-mCherry",
  362. mouseID == "J0782" ~ "fDIO-mCherry",
  363. mouseID == "J0859" ~ "fDIO-mCherry",
  364. mouseID == "K0871" ~ "fDIO-mCherry",
  365. mouseID == "J0779" ~ "CoffFon-hM4Di",
  366. mouseID == "J0784" ~ "CoffFon-hM4Di",
  367. mouseID == "K0331" ~ "CoffFon-hM4Di",
  368. mouseID == "K0994" ~ "CoffFon-hM4Di",
  369. mouseID == "K0861" ~ "CoffFon-hM4Di",
  370. mouseID == "K0029" ~ "ConFon-hM4Di",
  371. mouseID == "K0863" ~ "ConFon-hM4Di",
  372. mouseID == "K0865" ~ "ConFon-hM4Di",
  373. mouseID == "K0990" ~ "ConFon-hM4Di"
  374. )
  375. )
  376. print(nBouts_df)
  377. write.csv(nBouts_df, paste(title, "nBouts.csv", sep = "_")) #save the data to CSV
  378. nBouts_df_pergroup <- aggregate(nBouts ~ Group, data = nBouts_df, FUN = sum, na.rm = TRUE)
  379. print(nBouts_df_pergroup)
  380. write.csv(nBouts_df_pergroup, paste(title, "nBoutsperGroup.csv", sep = "_")) #save the data to CSV
  381. }
  382. Plot_BoutStart <- function(curve_to_timeloc, n_Seconds, ylim, min_time, max_time, title ) {
  383. curve_col_index <- which(colnames(Body_motion[[mouseID]][["dLight_DFF"]]) == curve_to_timeloc)
  384. Bouts <- list()
  385. for (mouseID in names(Body_motion)) {
  386. Bouts[[mouseID]] <- list()
  387. Bouts[[mouseID]][["Bouts"]] <- list()
  388. for (Bout_n in seq_along(Body_motion[[mouseID]][["Bouts"]])) {
  389. start_time <- Body_motion[[mouseID]][["Bouts"]][[Bout_n]]$Time[1]
  390. if (start_time > min_time && start_time < max_time) {
  391. Bouts[[mouseID]][["Bouts"]][[length(Bouts[[mouseID]][["Bouts"]]) + 1]] <- Body_motion[[mouseID]][["Bouts"]][[Bout_n]]
  392. }
  393. }
  394. }
  395. #Time loc these bouts few seconds before and after to their occurence
  396. #n_Seconds <- 2
  397. for (mouseID in names(Bouts)) {
  398. Bouts[[mouseID]][["Time_Range"]] <- list()
  399. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  400. Bout <- Bouts[[mouseID]][["Bouts"]][[Bout_n]]
  401. Start_Time <- Bout$Time[1]
  402. Pre_Time <- Start_Time - n_Seconds
  403. Post_Time <- Start_Time + n_Seconds
  404. Peak_Time <- Bout[which.max(Bout$Time),]$Time
  405. Peak_Pre_Time <- Peak_Time - n_Seconds
  406. Peak_Post_Time <- Peak_Time + n_Seconds
  407. Bouts[[mouseID]][["Time_Range"]][[Bout_n]] <- data.frame(Start_Time = Start_Time,
  408. Pre_Time = Pre_Time,
  409. Post_Time = Post_Time,
  410. Peak_Time = Peak_Time,
  411. Peak_Pre_Time = Peak_Pre_Time,
  412. Peak_Post_Time = Peak_Post_Time)
  413. }
  414. }
  415. #Time loc the dLight traces
  416. for (mouseID in names(Bouts)) {
  417. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]] <- list()
  418. Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]] <- list()
  419. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  420. Start_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Start_Time
  421. Pre_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Pre_Time
  422. Post_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Post_Time
  423. Peak_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Time
  424. Peak_Pre_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Pre_Time
  425. Peak_Post_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Post_Time
  426. dLight_DFF <- Body_motion[[mouseID]][["dLight_DFF"]]
  427. dLight_DFF <- dLight_DFF[dLight_DFF$Time > Pre_Time & dLight_DFF$Time < Post_Time,]
  428. dLight_DFF$Time_Loc <- dLight_DFF$Time - Start_Time
  429. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]][[Bout_n]] <- dLight_DFF
  430. dLight_DFF <- Body_motion[[mouseID]][["dLight_DFF"]]
  431. dLight_DFF <- dLight_DFF[dLight_DFF$Time > Peak_Pre_Time & dLight_DFF$Time < Peak_Post_Time,]
  432. dLight_DFF$Time_Loc <- dLight_DFF$Time - Peak_Time
  433. Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]][[Bout_n]] <- dLight_DFF
  434. }
  435. }
  436. #Since the T times for Time loc are not exactly the same, interpolate the deltaF/F values at consensus times
  437. for (mouseID in names(Bouts)) {
  438. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]] <- list()
  439. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]] <- list()
  440. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  441. Time <- seq(from = -n_Seconds, to = n_Seconds, by = 0.02)
  442. data <- Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]][[Bout_n]]
  443. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]] <- as.data.frame(approx(x = data$Time_Loc, y = data[,curve_col_index], xout = Time))
  444. colnames(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]]) <- c("Time", "dLight_DFF")
  445. Time <- seq(from = -n_Seconds, to = n_Seconds, by = 0.02)
  446. data <- Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]
  447. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]] <- as.data.frame(approx(x = data$Time_Loc, y = data[,curve_col_index], xout = Time))
  448. colnames(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]) <- c("Time", "dLight_DFF")
  449. }
  450. }
  451. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]]
  452. #Combine all the interpolated traces
  453. All_traces <- list()
  454. counter <- 1
  455. for (mouseID in names(Bouts)) {
  456. for (Bout_n in seq_along(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]])) {
  457. All_traces[[counter]] <- Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]]
  458. All_traces[[counter]]$TraceID <- as.character(rep(counter, times = nrow(All_traces[[counter]])))
  459. All_traces[[counter]]$mouseID <- rep(mouseID, times = nrow(All_traces[[counter]]))
  460. counter <- counter + 1
  461. }
  462. }
  463. from_BoutStart <- bind_rows(All_traces)
  464. from_BoutStart <- from_BoutStart %>%
  465. mutate(
  466. Group = case_when(
  467. mouseID == "J0777" ~ "fDIO-mCherry",
  468. mouseID == "J0782" ~ "fDIO-mCherry",
  469. mouseID == "J0859" ~ "fDIO-mCherry",
  470. mouseID == "K0871" ~ "fDIO-mCherry",
  471. mouseID == "J0779" ~ "CoffFon-hM4Di",
  472. mouseID == "J0784" ~ "CoffFon-hM4Di",
  473. mouseID == "K0331" ~ "CoffFon-hM4Di",
  474. mouseID == "K0994" ~ "CoffFon-hM4Di",
  475. mouseID == "K0861" ~ "CoffFon-hM4Di",
  476. mouseID == "K0029" ~ "ConFon-hM4Di",
  477. mouseID == "K0863" ~ "ConFon-hM4Di",
  478. mouseID == "K0865" ~ "ConFon-hM4Di",
  479. mouseID == "K0990" ~ "ConFon-hM4Di"
  480. )
  481. )
  482. All_traces <- list()
  483. counter <- 1
  484. for (mouseID in names(Bouts)) {
  485. for (Bout_n in seq_along(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]])) {
  486. All_traces[[counter]] <- Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]
  487. All_traces[[counter]]$TraceID <- as.character(rep(counter, times = nrow(All_traces[[counter]])))
  488. All_traces[[counter]]$mouseID <- rep(mouseID, times = nrow(All_traces[[counter]]))
  489. counter <- counter + 1
  490. }
  491. }
  492. from_PeakSpeed <- bind_rows(All_traces)
  493. from_PeakSpeed <- from_PeakSpeed %>%
  494. mutate(
  495. Group = case_when(
  496. mouseID == "J0777" ~ "fDIO-mCherry",
  497. mouseID == "J0782" ~ "fDIO-mCherry",
  498. mouseID == "J0859" ~ "fDIO-mCherry",
  499. mouseID == "K0871" ~ "fDIO-mCherry",
  500. mouseID == "J0779" ~ "CoffFon-hM4Di",
  501. mouseID == "J0784" ~ "CoffFon-hM4Di",
  502. mouseID == "K0331" ~ "CoffFon-hM4Di",
  503. mouseID == "K0994" ~ "CoffFon-hM4Di",
  504. mouseID == "K0861" ~ "CoffFon-hM4Di",
  505. mouseID == "K0029" ~ "ConFon-hM4Di",
  506. mouseID == "K0863" ~ "ConFon-hM4Di",
  507. mouseID == "K0865" ~ "ConFon-hM4Di",
  508. mouseID == "K0990" ~ "ConFon-hM4Di"
  509. )
  510. )
  511. plot <- from_BoutStart |>
  512. tidyplot(x = Time, y = dLight_DFF, color = Group) |>
  513. add_mean_line() |>
  514. add_ci95_ribbon() |>
  515. adjust_title(title) |>
  516. adjust_x_axis_title("Time from bout onset (sec.)") |>
  517. adjust_x_axis(limits = c(-10, 10), breaks = seq(from = -10, to = 10, by = 1)) |>
  518. adjust_y_axis(limits = ylim, breaks = seq(from = -10, to = 10, by = 1)) |>
  519. adjust_y_axis_title("dLight dF/F (%)") #|>
  520. ggsave(paste(title, "_BoutOnset.pdf", sep = ""),
  521. width = 4,
  522. height = 4,
  523. plot = plot)
  524. plot
  525. #Collect the number of bouts per mouse
  526. nBouts <- c()
  527. for (mouseID_n in 1:length(Bouts)) {
  528. nBouts[mouseID_n] <- length(Bouts[[mouseID_n]][["Bouts"]])
  529. }
  530. nBouts_df <- data.frame(mouseID = names(Bouts), nBouts = nBouts)
  531. nBouts_df <- nBouts_df %>%
  532. mutate(
  533. Group = case_when(
  534. mouseID == "J0777" ~ "fDIO-mCherry",
  535. mouseID == "J0782" ~ "fDIO-mCherry",
  536. mouseID == "J0859" ~ "fDIO-mCherry",
  537. mouseID == "K0871" ~ "fDIO-mCherry",
  538. mouseID == "J0779" ~ "CoffFon-hM4Di",
  539. mouseID == "J0784" ~ "CoffFon-hM4Di",
  540. mouseID == "K0331" ~ "CoffFon-hM4Di",
  541. mouseID == "K0994" ~ "CoffFon-hM4Di",
  542. mouseID == "K0861" ~ "CoffFon-hM4Di",
  543. mouseID == "K0029" ~ "ConFon-hM4Di",
  544. mouseID == "K0863" ~ "ConFon-hM4Di",
  545. mouseID == "K0865" ~ "ConFon-hM4Di",
  546. mouseID == "K0990" ~ "ConFon-hM4Di"
  547. )
  548. )
  549. print(nBouts_df)
  550. write.csv(nBouts_df, paste(title, "nBouts.csv", sep = "_")) #save the data to CSV
  551. nBouts_df_pergroup <- aggregate(nBouts ~ Group, data = nBouts_df, FUN = sum, na.rm = TRUE)
  552. print(nBouts_df_pergroup)
  553. write.csv(nBouts_df_pergroup, paste(title, "nBoutsperGroup.csv", sep = "_")) #save the data to CSV
  554. }
  555. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Peak to Bout Correlation")
  556. Plot_PeakSpeed(curve_to_timeloc = "AIN01", n_Seconds = 5, ylim = c(-10,7), min_time = 5, max_time = 300, title = "Pre-DCZ")
  557. Plot_PeakSpeed(curve_to_timeloc = "AIN01", n_Seconds = 5, ylim = c(-10,7), min_time = 500, max_time = 1500, title = "Post-DCZ")
  558. Plot_PeakSpeed(curve_to_timeloc = "AIN01", n_Seconds = 5, ylim = c(-10,7), min_time = 1500, max_time = 2100, title = "Pushed")
  559. Plot_PeakSpeed(curve_to_timeloc = "DFF_LOESSsub", n_Seconds = 2, ylim = c(-6,5), min_time = 5, max_time = 300, title = "Pre-DCZ_SubstractedfromLOESS")
  560. Plot_PeakSpeed(curve_to_timeloc = "DFF_LOESSsub", n_Seconds = 2, ylim = c(-6,5), min_time = 500, max_time = 1500, title = "Post-DCZ_SubstractedfromLOESS")
  561. Plot_PeakSpeed(curve_to_timeloc = "DFF_LOESSsub", n_Seconds = 2, ylim = c(-6,5), min_time = 1500, max_time = 2090, title = "Pushed_SubstractedfromLOESS")
  562. Plot_PeakSpeed(curve_to_timeloc = "DFF_LOESSsub", n_Seconds = 10, ylim = c(-6,5), min_time = 5, max_time = 300, title = "Pre-DCZ_SubstractedfromLOESS_10sec")
  563. Plot_PeakSpeed(curve_to_timeloc = "DFF_LOESSsub", n_Seconds = 10, ylim = c(-6,5), min_time = 500, max_time = 1500, title = "Post-DCZ_SubstractedfromLOESS_10sec")
  564. Plot_PeakSpeed(curve_to_timeloc = "DFF_LOESSsub", n_Seconds = 10, ylim = c(-6,5), min_time = 1500, max_time = 2090, title = "Pushed_SubstractedfromLOESS_10sec")
  565. Plot_BoutStart(curve_to_timeloc = "AIN01", n_Seconds = 3, ylim = c(-10,7), min_time = 5, max_time = 300, title = "Pre-DCZ Injection")
  566. Plot_BoutStart(curve_to_timeloc = "AIN01", n_Seconds = 3, ylim = c(-10,7), min_time = 500, max_time = 1500, title = "Post-DCZ Injection")
  567. Plot_BoutStart(curve_to_timeloc = "AIN01", n_Seconds = 3, ylim = c(-10,7), min_time = 1500, max_time = 2100, title = "Pushed")
  568. #------------------------------------------------------------------------
  569. #Generate an average trace per mouse for dLight prior and post-bout occurence and bout peak-speed
  570. Extract_Bouts_TimeLoc <- function(n_Seconds, min_time, max_time) {
  571. Bouts <- list()
  572. for (mouseID in names(Body_motion)) {
  573. Bouts[[mouseID]] <- list()
  574. Bouts[[mouseID]][["Bouts"]] <- list()
  575. for (Bout_n in seq_along(Body_motion[[mouseID]][["Bouts"]])) {
  576. start_time <- Body_motion[[mouseID]][["Bouts"]][[Bout_n]]$Time[1]
  577. if (start_time > min_time && start_time < max_time) {
  578. Bouts[[mouseID]][["Bouts"]][[length(Bouts[[mouseID]][["Bouts"]]) + 1]] <- Body_motion[[mouseID]][["Bouts"]][[Bout_n]]
  579. }
  580. }
  581. }
  582. #Time loc these bouts few seconds before and after to their occurence
  583. #n_Seconds <- 2
  584. for (mouseID in names(Bouts)) {
  585. Bouts[[mouseID]][["Time_Range"]] <- list()
  586. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  587. Bout <- Bouts[[mouseID]][["Bouts"]][[Bout_n]]
  588. Start_Time <- Bout$Time[1]
  589. Pre_Time <- Start_Time - n_Seconds
  590. Post_Time <- Start_Time + n_Seconds
  591. Peak_Time <- Bout[which.max(Bout$Time),]$Time
  592. Peak_Pre_Time <- Peak_Time - n_Seconds
  593. Peak_Post_Time <- Peak_Time + n_Seconds
  594. Bouts[[mouseID]][["Time_Range"]][[Bout_n]] <- data.frame(Start_Time = Start_Time,
  595. Pre_Time = Pre_Time,
  596. Post_Time = Post_Time,
  597. Peak_Time = Peak_Time,
  598. Peak_Pre_Time = Peak_Pre_Time,
  599. Peak_Post_Time = Peak_Post_Time)
  600. }
  601. }
  602. #Time loc the dLight traces
  603. for (mouseID in names(Bouts)) {
  604. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]] <- list()
  605. Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]] <- list()
  606. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  607. Start_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Start_Time
  608. Pre_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Pre_Time
  609. Post_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Post_Time
  610. Peak_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Time
  611. Peak_Pre_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Pre_Time
  612. Peak_Post_Time <- Bouts[[mouseID]][["Time_Range"]][[Bout_n]]$Peak_Post_Time
  613. dLight_DFF <- Body_motion[[mouseID]][["dLight_DFF"]]
  614. dLight_DFF <- dLight_DFF[dLight_DFF$Time > Pre_Time & dLight_DFF$Time < Post_Time,]
  615. dLight_DFF$Time_Loc <- dLight_DFF$Time - Start_Time
  616. Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]][[Bout_n]] <- dLight_DFF
  617. dLight_DFF <- Body_motion[[mouseID]][["dLight_DFF"]]
  618. dLight_DFF <- dLight_DFF[dLight_DFF$Time > Peak_Pre_Time & dLight_DFF$Time < Peak_Post_Time,]
  619. dLight_DFF$Time_Loc <- dLight_DFF$Time - Peak_Time
  620. Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]][[Bout_n]] <- dLight_DFF
  621. }
  622. }
  623. #Since the T times for Time loc are not exactly the same, interpolate the deltaF/F values at consensus times
  624. for (mouseID in names(Bouts)) {
  625. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]] <- list()
  626. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]] <- list()
  627. for (Bout_n in seq_along(Bouts[[mouseID]][["Bouts"]])) {
  628. Time <- seq(from = -n_Seconds, to = n_Seconds, by = 0.02)
  629. data <- Bouts[[mouseID]][["TimeLoc_dLight(BoutStart)"]][[Bout_n]]
  630. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]] <- as.data.frame(approx(x = data$Time_Loc, y = data[,curve_col_index], xout = Time))
  631. colnames(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(BoutStart)"]][[Bout_n]]) <- c("Time", "dLight_DFF")
  632. Time <- seq(from = -n_Seconds, to = n_Seconds, by = 0.02)
  633. data <- Bouts[[mouseID]][["TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]
  634. Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]] <- as.data.frame(approx(x = data$Time_Loc, y = data[,curve_col_index], xout = Time))
  635. colnames(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]) <- c("Time", "dLight_DFF")
  636. }
  637. }
  638. return(Bouts)
  639. }
  640. #Generate a function for plotting average deltaF/F curve per mouse and not per bout
  641. Plot_Average_Trace <- function(Object, Time_Loc_List, Title, x_Title) {
  642. Bouts <- Object
  643. for (mouseID in names(Bouts)) {
  644. if (length(Bouts[[mouseID]][["Bouts"]]) > 0) {
  645. #Extract all the traces and store them in a dataframe by binding the columns
  646. Traces <- Bouts[[mouseID]][[Time_Loc_List]] %>%
  647. map(~ .x["dLight_DFF"]) %>%
  648. bind_cols()
  649. #Average the traces together at each T time
  650. Average_dLightDFF_Trace <- rowMeans(Traces)
  651. Traces <- NULL
  652. Time <- Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[1]]$Time
  653. Bouts[[mouseID]][["AverageTrace_dLightDFF(PeakSpeed)"]] <- data.frame(Time = Time,
  654. Average_dLightDFF_Trace = Average_dLightDFF_Trace,
  655. mouseID = rep(mouseID, times = length(Time)))
  656. }
  657. }
  658. Average_Traces <- Bouts %>%
  659. map(~ .x[["AverageTrace_dLightDFF(PeakSpeed)"]]) %>%
  660. bind_rows(.id = "mouseID")
  661. #Add a group column
  662. Average_Traces <- Average_Traces %>%
  663. mutate(
  664. Group = case_when(
  665. mouseID == "J0777" ~ "fDIO-mCherry",
  666. mouseID == "J0782" ~ "fDIO-mCherry",
  667. mouseID == "J0859" ~ "fDIO-mCherry",
  668. mouseID == "K0871" ~ "fDIO-mCherry",
  669. mouseID == "J0779" ~ "CoffFon-hM4Di",
  670. mouseID == "J0784" ~ "CoffFon-hM4Di",
  671. mouseID == "K0331" ~ "CoffFon-hM4Di",
  672. mouseID == "K0994" ~ "CoffFon-hM4Di",
  673. mouseID == "K0861" ~ "CoffFon-hM4Di",
  674. mouseID == "K0029" ~ "ConFon-hM4Di",
  675. mouseID == "K0863" ~ "ConFon-hM4Di",
  676. mouseID == "K0865" ~ "ConFon-hM4Di",
  677. mouseID == "K0990" ~ "ConFon-hM4Di"
  678. )
  679. )
  680. plot <- Average_Traces |>
  681. tidyplot(x = Time, y = Average_dLightDFF_Trace, color = Group) |>
  682. add_mean_line() |>
  683. add_ci95_ribbon() |>
  684. adjust_title(Title) |>
  685. adjust_x_axis_title(x_Title) |>
  686. #adjust_x_axis(limits = c(0.5, 5.5), breaks = seq(from = 0.5, to = 5, by = 1)) |>
  687. adjust_x_axis(limits = c(-1.5, 1), breaks = seq(from = -1.5, to = 1, by = 0.5)) |>
  688. adjust_y_axis(limits = c(-12, 12), breaks = seq(from = -10, to = 10, by = 2.5)) |>
  689. adjust_y_axis_title("dLight dF/F (%)")
  690. #Save the plot
  691. ggsave(
  692. filename = paste(Title, ".pdf", sep = ""),
  693. plot = plot, # Saves the last plot displayed
  694. #device = "png", # Essential for transparency
  695. bg = "transparent", # Removes the white background
  696. width = 6, # Width in inches
  697. height = 5, # Height in inches
  698. units = "in",
  699. dpi = 300, # High resolution for publication
  700. limitsize = TRUE
  701. )
  702. }
  703. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Peak to Bout Correlation")
  704. Plot_Average_Trace(Object = Extract_Bouts_TimeLoc(n_Seconds = 1.5,
  705. min_time = 5,
  706. max_time = 300),
  707. Time_Loc_List = "Interpolated_TimeLoc_dLight(BoutStart)",
  708. Title = "AverageTrace_PreDCZ_BoutOnset_PerMouse",
  709. x_Title = "Time from bout occurence (sec.)")
  710. Plot_Average_Trace(Object = Extract_Bouts_TimeLoc(n_Seconds = 1.5,
  711. min_time = 500,
  712. max_time = 1500),
  713. Time_Loc_List = "Interpolated_TimeLoc_dLight(BoutStart)",
  714. Title = "AverageTrace_PostDCZ_BoutOnset_PerMouse",
  715. x_Title = "Time from bout occurence (sec.)")
  716. Plot_Average_Trace(Object = Extract_Bouts_TimeLoc(n_Seconds = 1.5,
  717. min_time = 1500,
  718. max_time = 2100),
  719. Time_Loc_List = "Interpolated_TimeLoc_dLight(BoutStart)",
  720. Title = "AverageTrace_PostDCZ(ForcedLocomotion)_BoutOnset_PerMouse",
  721. x_Title = "Time from bout occurence (sec.)")
  722. Plot_Average_Trace(Object = Extract_Bouts_TimeLoc(n_Seconds = 1.5,
  723. min_time = 5,
  724. max_time = 300),
  725. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  726. Title = "AverageTrace_PreDCZ_BoutPeakSpeed_PerMouse",
  727. x_Title = "Time from peak speed (sec.)")
  728. Plot_Average_Trace(Object = Extract_Bouts_TimeLoc(n_Seconds = 1.5,
  729. min_time = 500,
  730. max_time = 1500),
  731. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  732. Title = "AverageTrace_PostDCZ_BoutPeakSpeed_PerMouse",
  733. x_Title = "Time from peak speed (sec.)")
  734. Plot_Average_Trace(Object = Extract_Bouts_TimeLoc(n_Seconds = 1.5,
  735. min_time = 1500,
  736. max_time = 2100),
  737. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  738. Title = "AverageTrace_PostDCZ(ForcedLocomotion)_BoutPeakSpeed_PerMouse",
  739. x_Title = "Time from peak speed (sec.)")
  740. #------------------------------------------------------------------------
  741. #Plot density line
  742. Density_Line <- function(Object, Time_Loc_List, Group, nBins, Color_Option, Title, x_Title, Density_Range){
  743. Bouts <- Object
  744. All_traces <- list()
  745. counter <- 1
  746. for (mouseID in names(Bouts)) {
  747. for (Bout_n in seq_along(Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]])) {
  748. All_traces[[counter]] <- Bouts[[mouseID]][["Interpolated_TimeLoc_dLight(PeakSpeed)"]][[Bout_n]]
  749. All_traces[[counter]]$TraceID <- as.character(rep(counter, times = nrow(All_traces[[counter]])))
  750. All_traces[[counter]]$mouseID <- rep(mouseID, times = nrow(All_traces[[counter]]))
  751. counter <- counter + 1
  752. }
  753. }
  754. from_BoutStart <- bind_rows(All_traces)
  755. from_BoutStart <- from_BoutStart %>%
  756. mutate(
  757. Group = case_when(
  758. mouseID == "J0777" ~ "fDIO-mCherry",
  759. mouseID == "J0782" ~ "fDIO-mCherry",
  760. mouseID == "J0859" ~ "fDIO-mCherry",
  761. mouseID == "K0871" ~ "fDIO-mCherry",
  762. mouseID == "J0779" ~ "CoffFon-hM4Di",
  763. mouseID == "J0784" ~ "CoffFon-hM4Di",
  764. mouseID == "K0331" ~ "CoffFon-hM4Di",
  765. mouseID == "K0994" ~ "CoffFon-hM4Di",
  766. mouseID == "K0861" ~ "CoffFon-hM4Di",
  767. mouseID == "K0029" ~ "ConFon-hM4Di",
  768. mouseID == "K0863" ~ "ConFon-hM4Di",
  769. mouseID == "K0865" ~ "ConFon-hM4Di",
  770. mouseID == "K0990" ~ "ConFon-hM4Di"
  771. )
  772. )
  773. All_traces <- list()
  774. counter <- 1
  775. for (mouseID in names(Bouts)) {
  776. for (Bout_n in seq_along(Bouts[[mouseID]][[Time_Loc_List]])) {
  777. All_traces[[counter]] <- Bouts[[mouseID]][[Time_Loc_List]][[Bout_n]]
  778. All_traces[[counter]]$TraceID <- as.character(rep(counter, times = nrow(All_traces[[counter]])))
  779. All_traces[[counter]]$mouseID <- rep(mouseID, times = nrow(All_traces[[counter]]))
  780. counter <- counter + 1
  781. }
  782. }
  783. All_traces <- bind_rows(All_traces)
  784. All_traces <- All_traces %>%
  785. mutate(
  786. Group = case_when(
  787. mouseID == "J0777" ~ "fDIO-mCherry",
  788. mouseID == "J0782" ~ "fDIO-mCherry",
  789. mouseID == "J0859" ~ "fDIO-mCherry",
  790. mouseID == "K0871" ~ "fDIO-mCherry",
  791. mouseID == "J0779" ~ "CoffFon-hM4Di",
  792. mouseID == "J0784" ~ "CoffFon-hM4Di",
  793. mouseID == "K0331" ~ "CoffFon-hM4Di",
  794. mouseID == "K0994" ~ "CoffFon-hM4Di",
  795. mouseID == "K0861" ~ "CoffFon-hM4Di",
  796. mouseID == "K0029" ~ "ConFon-hM4Di",
  797. mouseID == "K0863" ~ "ConFon-hM4Di",
  798. mouseID == "K0865" ~ "ConFon-hM4Di",
  799. mouseID == "K0990" ~ "ConFon-hM4Di"
  800. )
  801. )
  802. #Rename the traceID
  803. All_traces$TraceID <- paste(All_traces$mouseID,All_traces$TraceID, sep = "_")
  804. #Subset the group to plot
  805. All_traces <- All_traces[All_traces$Group == Group,]
  806. #Plot
  807. plot <- ggplot(data = All_traces, aes(x = Time, y = dLight_DFF, group = TraceID)) +
  808. stat_line_density(aes(color = after_stat(density), fill = after_stat(density)),
  809. bins = nBins, drop = FALSE, na.rm = TRUE) +
  810. #scale_color_viridis_c(option = "magma") +
  811. scale_fill_viridis_c(option = Color_Option, limits = Density_Range, values = c(0,0.5,1)) +
  812. scale_x_continuous(limits = c(-2,2), expand = c(0, 0), breaks = seq(from = -2, to = 2, by = 0.5)) +
  813. scale_y_continuous(limits = c(-25,25), expand = c(0, 0), breaks = seq(from = -20, to = 20 , by = 5)) +
  814. theme_classic() +
  815. labs(
  816. title = Title, # Main title
  817. x = x_Title, # X-axis label
  818. y = "dLight deltaF/F (%)", # Y-axis label
  819. ) +
  820. theme(plot.title = element_text(size = 12, hjust = 0.5))
  821. ggsave(
  822. filename = paste(Title, "_DensityLine.png", sep = ""),
  823. plot = plot, # Saves the last plot displayed
  824. #device = "png", # Essential for transparency
  825. bg = "transparent", # Removes the white background
  826. width = 6, # Width in inches
  827. height = 5, # Height in inches
  828. units = "in",
  829. dpi = 1200, # High resolution for publication
  830. limitsize = TRUE)
  831. }
  832. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Peak to Bout Correlation")
  833. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  834. min_time = 5,
  835. max_time = 300),
  836. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  837. Group = "fDIO-mCherry",
  838. nBins = 100,
  839. Color_Option = "turbo",
  840. Title = "PreDCZ_fDIO-mCherry",
  841. x_Title = "Time from bout peak speed (sec.)",
  842. Density_Range = NULL)
  843. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  844. min_time = 500,
  845. max_time = 1500),
  846. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  847. Group = "fDIO-mCherry",
  848. nBins = 100,
  849. Color_Option = "turbo",
  850. Title = "PostDCZ_fDIO-mCherry",
  851. x_Title = "Time from bout peak speed (sec.)",
  852. Density_Range = NULL)
  853. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  854. min_time = 1500,
  855. max_time = 2100),
  856. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  857. Group = "fDIO-mCherry",
  858. nBins = 100,
  859. Color_Option = "turbo",
  860. Title = "PostDCZ(Forced)_fDIO-mCherry",
  861. x_Title = "Time from bout peak speed (sec.)",
  862. Density_Range = NULL)
  863. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  864. min_time = 5,
  865. max_time = 300),
  866. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  867. Group = "CoffFon-hM4Di",
  868. nBins = 100,
  869. Color_Option = "turbo",
  870. Title = "PreDCZ_CoffFon-hM4Di",
  871. x_Title = "Time from bout peak speed (sec.)",
  872. Density_Range = NULL)
  873. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  874. min_time = 500,
  875. max_time = 1500),
  876. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  877. Group = "CoffFon-hM4Di",
  878. nBins = 100,
  879. Color_Option = "turbo",
  880. Title = "PostDCZ_CoffFon-hM4Di",
  881. x_Title = "Time from bout peak speed (sec.)",
  882. Density_Range = NULL)
  883. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  884. min_time = 1500,
  885. max_time = 2100),
  886. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  887. Group = "CoffFon-hM4Di",
  888. nBins = 100,
  889. Color_Option = "turbo",
  890. Title = "PostDCZ(Forced)_CoffFon-hM4Di",
  891. x_Title = "Time from bout peak speed (sec.)",
  892. Density_Range = NULL)
  893. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  894. min_time = 5,
  895. max_time = 300),
  896. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  897. Group = "ConFon-hM4Di",
  898. nBins = 100,
  899. Color_Option = "turbo",
  900. Title = "PreDCZ_ConFon-hM4Di",
  901. x_Title = "Time from bout peak speed (sec.)",
  902. Density_Range = NULL)
  903. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  904. min_time = 500,
  905. max_time = 1500),
  906. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  907. Group = "ConFon-hM4Di",
  908. nBins = 100,
  909. Color_Option = "turbo",
  910. Title = "PostDCZ_ConFon-hM4Di",
  911. x_Title = "Time from bout peak speed (sec.)",
  912. Density_Range = NULL)
  913. Density_Line(Object = Extract_Bouts_TimeLoc(n_Seconds = 2,
  914. min_time = 1500,
  915. max_time = 2100),
  916. Time_Loc_List = "Interpolated_TimeLoc_dLight(PeakSpeed)",
  917. Group = "ConFon-hM4Di",
  918. nBins = 100,
  919. Color_Option = "turbo",
  920. Title = "PostDCZ(Forced)_ConFon-hM4Di",
  921. x_Title = "Time from bout peak speed (sec.)",
  922. Density_Range = NULL)
  923. #------------------------------------------------------------------------
  924. #Correlate the velocity and dLight DFF at every T times
  925. velocity_dLightDFF_datapoints <- list()
  926. for (mouseID in names(Body_motion)) {
  927. #Extract the velocity and dLight_DFF data for each frame
  928. velocity_df <- Body_motion[[mouseID]][["Sleap_data"]][,c("Time", "Torso.velocity")]
  929. dLightDFF_df <- Body_motion[[mouseID]][["dLight_DFF"]]
  930. #Approximate velocity on each T time of the dLight data
  931. approximation <- approx(x = velocity_df$Time, y = velocity_df$Torso.velocity, xout = dLightDFF_df$Time)
  932. dLightDFF_df$Torso.velocity <- approximation$y
  933. #Add a column for the mouseID
  934. dLightDFF_df$mouseID <- rep(mouseID, times = nrow(dLightDFF_df))
  935. #Add the dataframe to the list
  936. velocity_dLightDFF_datapoints[[mouseID]] <- dLightDFF_df
  937. #Clean the objects generated
  938. velocity_df <- NULL
  939. dLightDFF_df <- NULL
  940. approximation <- NULL
  941. }
  942. #Stack the dataframes
  943. velocity_dLightDFF_datapoints <- dplyr::bind_rows(velocity_dLightDFF_datapoints)
  944. #Add a group column
  945. velocity_dLightDFF_datapoints <- velocity_dLightDFF_datapoints %>%
  946. mutate(
  947. Group = case_when(
  948. mouseID == "J0777" ~ "fDIO-mCherry",
  949. mouseID == "J0782" ~ "fDIO-mCherry",
  950. mouseID == "J0859" ~ "fDIO-mCherry",
  951. mouseID == "K0871" ~ "fDIO-mCherry",
  952. mouseID == "J0779" ~ "CoffFon-hM4Di",
  953. mouseID == "J0784" ~ "CoffFon-hM4Di",
  954. mouseID == "K0331" ~ "CoffFon-hM4Di",
  955. mouseID == "K0994" ~ "CoffFon-hM4Di",
  956. mouseID == "K0861" ~ "CoffFon-hM4Di",
  957. mouseID == "K0029" ~ "ConFon-hM4Di",
  958. mouseID == "K0863" ~ "ConFon-hM4Di",
  959. mouseID == "K0865" ~ "ConFon-hM4Di",
  960. mouseID == "K0990" ~ "ConFon-hM4Di"
  961. )
  962. )
  963. Velocity_DFF_DensityPlot <- function(Start_time,
  964. End_time,
  965. Group,
  966. Title,
  967. density_limits
  968. ) {
  969. Toplot <- velocity_dLightDFF_datapoints[velocity_dLightDFF_datapoints$Time > Start_time &
  970. velocity_dLightDFF_datapoints$Time < End_time &
  971. velocity_dLightDFF_datapoints$Group == Group,]
  972. plot <- ggplot(Toplot, mapping = aes(x = Torso.velocity, y = AIN01)) +
  973. #eom_point(alpha = 1/10) +
  974. geom_pointdensity(size = 0.1,
  975. adjust = 5) +
  976. scale_color_viridis(option = "magma",
  977. limits = density_limits,
  978. oob = scales::squish, #Prevents the color from disappearing if saturated
  979. alpha = 1) +
  980. xlim(0,1000) +
  981. ylim(-8,12) +
  982. theme_classic(base_size = 10) +
  983. #geom_hline(yintercept = 0) +
  984. #geom_vline(xintercept = 0) +
  985. labs(
  986. title = Title, # Main title
  987. x = "Velocity (mm/sec.)", # X-axis label
  988. y = "dLight deltaF/F (%)", # Y-axis label
  989. ) +
  990. theme(plot.title = element_text(size = 10, hjust = 0.5)) + #Centre the title
  991. annotate("text", x = 800, y = 12, label = paste(as.character(nrow(Toplot)), "Frames"), color = "gray40", size = 3) #Add the number of frames
  992. #Save the plot
  993. ggsave(
  994. filename = paste(Title, "_Velocity&dLightDFF_DensityPlot.png", sep = ""),
  995. plot = plot, # Saves the last plot displayed
  996. #device = "png", # Essential for transparency
  997. bg = "transparent", # Removes the white background
  998. width = 6, # Width in inches
  999. height = 5, # Height in inches
  1000. units = "in",
  1001. dpi = 300, # High resolution for publication
  1002. limitsize = TRUE
  1003. )
  1004. }
  1005. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Peak to Bout Correlation")
  1006. Velocity_DFF_DensityPlot(Start_time = 5,
  1007. End_time = 300,
  1008. Group = "fDIO-mCherry",
  1009. Title = "fDIO-mCherry (PreDCZ)",
  1010. density_limits = c(0, 0.005)
  1011. )
  1012. Velocity_DFF_DensityPlot(Start_time = 500,
  1013. End_time = 1500,
  1014. Group = "fDIO-mCherry",
  1015. Title = "fDIO-mCherry (PostDCZ)",
  1016. density_limits = c(0, 0.005)
  1017. )
  1018. Velocity_DFF_DensityPlot(Start_time = 1500,
  1019. End_time = 2100,
  1020. Group = "fDIO-mCherry",
  1021. Title = "fDIO-mCherry (PostDCZ + Forced Locomotion)",
  1022. density_limits = c(0, 0.005)
  1023. )
  1024. Velocity_DFF_DensityPlot(Start_time = 5,
  1025. End_time = 300,
  1026. Group = "CoffFon-hM4Di",
  1027. Title = "CoffFon-hM4Di (PreDCZ)",
  1028. density_limits = c(0, 0.005)
  1029. )
  1030. Velocity_DFF_DensityPlot(Start_time = 500,
  1031. End_time = 1500,
  1032. Group = "CoffFon-hM4Di",
  1033. Title = "CoffFon-hM4Di (PostDCZ)",
  1034. density_limits = c(0, 0.005)
  1035. )
  1036. Velocity_DFF_DensityPlot(Start_time = 1500,
  1037. End_time = 2100,
  1038. Group = "CoffFon-hM4Di",
  1039. Title = "CoffFon-hM4Di (PostDCZ + Forced Locomotion)",
  1040. density_limits = c(0, 0.005)
  1041. )
  1042. Velocity_DFF_DensityPlot(Start_time = 5,
  1043. End_time = 300,
  1044. Group = "ConFon-hM4Di",
  1045. Title = "ConFon-hM4Di (PreDCZ)",
  1046. density_limits = c(0, 0.005)
  1047. )
  1048. Velocity_DFF_DensityPlot(Start_time = 500,
  1049. End_time = 1500,
  1050. Group = "ConFon-hM4Di",
  1051. Title = "ConFon-hM4Di (PostDCZ)",
  1052. density_limits = c(0, 0.005)
  1053. )
  1054. Velocity_DFF_DensityPlot(Start_time = 1500,
  1055. End_time = 2100,
  1056. Group = "ConFon-hM4Di",
  1057. Title = "ConFon-hM4Di (PostDCZ + Forced Locomotion)",
  1058. density_limits = c(0, 0.005)
  1059. )
  1060. #------------------------------------------------------------------------
  1061. #Plot sum deltaF/F and velocity per 10 sec., labelling PreDCZ, Transition, PostDCZ, PostDCZ+Forced
  1062. #Interpolate dLight deltaDFF
  1063. for (mouseID in names(Body_motion)) {
  1064. Body_motion[[mouseID]][["Sleap_data"]]$dLightDFF <- approx(Body_motion[[mouseID]][["dLight_DFF"]]$Time,
  1065. Body_motion[[mouseID]][["dLight_DFF"]]$AIN01,
  1066. Body_motion[[mouseID]][["Sleap_data"]]$Time)$y
  1067. Body_motion[[mouseID]][["Velocity/dLight"]] <- data.frame(Time = Body_motion[[mouseID]][["Sleap_data"]]$Time,
  1068. Velocity = Body_motion[[mouseID]][["Sleap_data"]]$Torso.velocity,
  1069. dLightDFF = Body_motion[[mouseID]][["Sleap_data"]]$dLightDFF)
  1070. }
  1071. #Assign the time values to PreDCZ, Transition, PostDCZ, PostDCZ_Forced
  1072. for (mouseID in names(Body_motion)) {
  1073. Body_motion[[mouseID]][["Velocity/dLight"]] <- Body_motion[[mouseID]][["Velocity/dLight"]] %>%
  1074. mutate(
  1075. Period = case_when(
  1076. Time >= 0 & Time < 300 ~ "PreDCZ",
  1077. Time >= 300 & Time < 500 ~ "Transition",
  1078. Time >= 500 & Time < 1500 ~ "PostDCZ",
  1079. Time >= 1500 & Time < 2100 ~ "PostDCZ (Forced Locomotion)"
  1080. )
  1081. )
  1082. }
  1083. #Assign the bins
  1084. for (mouseID in names(Body_motion)) {
  1085. bin_time <- 1 #in sec.
  1086. nbins <- 2100 / bin_time
  1087. Body_motion[[mouseID]][["Velocity/dLight"]]$BinID <- cut(Body_motion[[mouseID]][["Velocity/dLight"]]$Time,
  1088. breaks = seq(from = 0, to = 2100, by = bin_time),
  1089. labels = 1:nbins)
  1090. }
  1091. #Average the dLight and velocity values inside the bins
  1092. for (mouseID in names(Body_motion)) {
  1093. temp1 <- Body_motion[[mouseID]][["Velocity/dLight"]] %>%
  1094. group_by(BinID) %>%
  1095. summarize(mean_velocity = mean(Velocity))
  1096. temp2 <- Body_motion[[mouseID]][["Velocity/dLight"]] %>%
  1097. group_by(BinID) %>%
  1098. summarize(SD_dLightDFF = sd(dLightDFF))
  1099. Body_motion[[mouseID]][["Mean_Velocity/dLight"]] <- data.frame(BinID = temp1$BinID,
  1100. mean_velocity = temp1$mean_velocity,
  1101. SD_dLightDFF = temp2$SD_dLightDFF)
  1102. #Reassign the period time
  1103. Body_motion[[mouseID]][["Mean_Velocity/dLight"]]$BinID <- as.numeric(Body_motion[[mouseID]][["Mean_Velocity/dLight"]]$BinID)
  1104. Body_motion[[mouseID]][["Mean_Velocity/dLight"]] <- Body_motion[[mouseID]][["Mean_Velocity/dLight"]] %>%
  1105. mutate(
  1106. Period = case_when(
  1107. BinID >= 0 & BinID < 300/bin_time ~ "PreDCZ",
  1108. BinID >= 300/bin_time & BinID < 500/bin_time ~ "Transition",
  1109. BinID >= 500/bin_time & BinID < 1500/bin_time ~ "PostDCZ",
  1110. BinID >= 1500/bin_time & BinID <= 2100/bin_time ~ "PostDCZ (Forced Locomotion)")
  1111. )
  1112. #Add the mouseID
  1113. Body_motion[[mouseID]][["Mean_Velocity/dLight"]]$mouseID <- rep(mouseID, times = nrow(Body_motion[[mouseID]][["Mean_Velocity/dLight"]]))
  1114. }
  1115. #Stack the dataframes together
  1116. Binned_velocity_dLightDFF <- Body_motion %>%
  1117. map(~ .x[["Mean_Velocity/dLight"]]) %>%
  1118. bind_rows()
  1119. #Add group column
  1120. Binned_velocity_dLightDFF <- Binned_velocity_dLightDFF %>%
  1121. mutate(
  1122. Group = case_when(
  1123. mouseID == "J0777" ~ "fDIO-mCherry",
  1124. mouseID == "J0782" ~ "fDIO-mCherry",
  1125. mouseID == "J0859" ~ "fDIO-mCherry",
  1126. mouseID == "K0871" ~ "fDIO-mCherry",
  1127. mouseID == "J0779" ~ "CoffFon-hM4Di",
  1128. mouseID == "J0784" ~ "CoffFon-hM4Di",
  1129. mouseID == "K0331" ~ "CoffFon-hM4Di",
  1130. mouseID == "K0994" ~ "CoffFon-hM4Di",
  1131. mouseID == "K0861" ~ "CoffFon-hM4Di",
  1132. mouseID == "K0029" ~ "ConFon-hM4Di",
  1133. mouseID == "K0863" ~ "ConFon-hM4Di",
  1134. mouseID == "K0865" ~ "ConFon-hM4Di",
  1135. mouseID == "K0990" ~ "ConFon-hM4Di"
  1136. )
  1137. )
  1138. dLightSDvsMeanVelocity_PerTime <- function(Group) {
  1139. Toplot <- Binned_velocity_dLightDFF[Binned_velocity_dLightDFF$Group == Group,]
  1140. Toplot <- Toplot[sample(nrow(Toplot)), ] #Randomize the rows appearance
  1141. #Remove the NAs
  1142. Toplot <- Toplot[!is.na(Toplot$Period),]
  1143. Toplot$Time <- Toplot$BinID*bin_time
  1144. ggplot(Toplot, mapping = aes(x = mean_velocity, y = SD_dLightDFF, color = Time)) +
  1145. theme_classic() +
  1146. xlim(0,300) +
  1147. ylim(0,6) +
  1148. labs(
  1149. title = Group, # Main title
  1150. x = "Velocity Average (mm/s per 5s)", # X-axis label
  1151. y = "dLight deltaF/F Standard Deviation (per 5s)", # Y-axis label
  1152. ) +
  1153. theme(plot.title = element_text(size = 12, hjust = 0.5)) + #Centre the title
  1154. geom_point(alpha = 0.9, size = 1) +
  1155. scale_color_viridis_c(option = "turbo", values = c(0, 0.2, 0.3, 0.7, 1), breaks = c(0, 300, 500, 1500, 2100))
  1156. }
  1157. setwd("C:/Users/cyril/OneDrive - McGill University (1)/Documents/PhD/Raw data/Fibrephotometry/dLight_DCZinj5min/Output/Peak to Bout Correlation")
  1158. dLightSDvsMeanVelocity_PerTime(Group = "fDIO-mCherry")
  1159. dLightSDvsMeanVelocity_PerTime(Group = "CoffFon-hM4Di")
  1160. dLightSDvsMeanVelocity_PerTime(Group = "ConFon-hM4Di")
  1161. dLightSDvsMeanVelocity_PerPeriod <- function(Group) {
  1162. Toplot <- Binned_velocity_dLightDFF[Binned_velocity_dLightDFF$Group == Group,]
  1163. Toplot <- Toplot[sample(nrow(Toplot)), ] #Randomize the rows appearance
  1164. #Remove the NAs
  1165. Toplot <- Toplot[!is.na(Toplot$Period),]
  1166. Toplot$Time <- Toplot$BinID*bin_time
  1167. #Transform the Period to factor so they appear in the temporal order
  1168. Toplot$Period <- factor(Toplot$Period, levels = c("PreDCZ", "Transition", "PostDCZ", "PostDCZ (Forced Locomotion)"))
  1169. color <- viridis(100, option = "turbo")
  1170. #Discard the transition period
  1171. Toplot <- Toplot %>%
  1172. dplyr::filter(Period %in% c("PreDCZ", "PostDCZ", "PostDCZ (Forced Locomotion)"))
  1173. p <- ggplot(Toplot, mapping = aes(x = mean_velocity, y = SD_dLightDFF, color = Period)) +
  1174. theme_classic() +
  1175. stat_ellipse(type = "norm", linetype = "dashed", linewidth = 1.5, level = 0.95) +
  1176. xlim(-100,250) +
  1177. ylim(-1,6) +
  1178. labs(
  1179. title = Group, # Main title
  1180. x = "Velocity Average (mm/s)", # X-axis label
  1181. y = "dLight deltaF/F Standard Deviation", # Y-axis label
  1182. ) +
  1183. theme(plot.title = element_text(size = 12, hjust = 0.5), #Centre the title
  1184. legend.position = "bottom", # Move legend to bottom
  1185. legend.direction = "vertical" # Make it lay out side-by-side
  1186. ) +
  1187. geom_point(alpha = 0.9, size = 0.5) +
  1188. #scale_color_viridis_d(option = "cividis")
  1189. scale_color_manual(values = c("PreDCZ" = color[5],
  1190. "PostDCZ" = color[64],
  1191. "PostDCZ (Forced Locomotion)" = color[98])) +
  1192. theme(legend.position = "none")
  1193. ggMarginal(p, type = "density", groupFill = TRUE, alpha = 0.99)
  1194. }
  1195. dLightSDvsMeanVelocity_PerPeriod(Group = "fDIO-mCherry")
  1196. dLightSDvsMeanVelocity_PerPeriod(Group = "CoffFon-hM4Di")
  1197. dLightSDvsMeanVelocity_PerPeriod(Group = "ConFon-hM4Di")
  1198. #------------------------------------------------------------------------
  1199. #Plot average velocity and dLightDFF across the phases
  1200. #First remove the rows with NA
  1201. for (mouseID in names(Body_motion)) {
  1202. Body_motion[[mouseID]][["Velocity/dLight"]] <- na.omit(Body_motion[[mouseID]][["Velocity/dLight"]])
  1203. }
  1204. #Then compute the average velocity per period
  1205. for (mouseID in names(Body_motion)) {
  1206. temp1 <- Body_motion[[mouseID]][["Velocity/dLight"]] %>%
  1207. group_by(Period) %>%
  1208. summarize(mean_velocity = mean(Velocity))
  1209. temp2 <- Body_motion[[mouseID]][["Velocity/dLight"]] %>%
  1210. group_by(Period) %>%
  1211. summarize(SD_dLightDFF = sd(dLightDFF))
  1212. Body_motion[[mouseID]][["Mean_Velocity/dLight"]] <- data.frame(Period = temp1$Period,
  1213. mean_velocity = temp1$mean_velocity,
  1214. SD_dLightDFF = temp2$SD_dLightDFF)
  1215. }
  1216. #Add the mouseID
  1217. for (mouseID in names(Body_motion)) {
  1218. Body_motion[[mouseID]][["Mean_Velocity/dLight"]]$mouseID <- rep(mouseID, times = nrow(Body_motion[[mouseID]][["Mean_Velocity/dLight"]]))
  1219. }
  1220. #Stack the dataframes together
  1221. Mean_velocity_dLightDFF <- Body_motion %>%
  1222. map(~ .x[["Mean_Velocity/dLight"]]) %>%
  1223. bind_rows()
  1224. #Add group column
  1225. Mean_velocity_dLightDFF <- Mean_velocity_dLightDFF %>%
  1226. mutate(
  1227. Group = case_when(
  1228. mouseID == "J0777" ~ "fDIO-mCherry",
  1229. mouseID == "J0782" ~ "fDIO-mCherry",
  1230. mouseID == "J0859" ~ "fDIO-mCherry",
  1231. mouseID == "K0871" ~ "fDIO-mCherry",
  1232. mouseID == "J0779" ~ "CoffFon-hM4Di",
  1233. mouseID == "J0784" ~ "CoffFon-hM4Di",
  1234. mouseID == "K0331" ~ "CoffFon-hM4Di",
  1235. mouseID == "K0994" ~ "CoffFon-hM4Di",
  1236. mouseID == "K0861" ~ "CoffFon-hM4Di",
  1237. mouseID == "K0029" ~ "ConFon-hM4Di",
  1238. mouseID == "K0863" ~ "ConFon-hM4Di",
  1239. mouseID == "K0865" ~ "ConFon-hM4Di",
  1240. mouseID == "K0990" ~ "ConFon-hM4Di"
  1241. )
  1242. )
  1243. #Plot
  1244. library(ggpubr)
  1245. Mean_velocity_dLightDFF$Period <- factor(Mean_velocity_dLightDFF$Period, levels = c("PreDCZ", "Transition", "PostDCZ", "PostDCZ (Forced Locomotion)"))
  1246. Mean_velocity_dLightDFF$Group <- factor(Mean_velocity_dLightDFF$Group, levels = c("fDIO-mCherry", "CoffFon-hM4Di", "ConFon-hM4Di"))
  1247. #Remove the transition time
  1248. Mean_velocity_dLightDFF <- Mean_velocity_dLightDFF %>%
  1249. dplyr::filter(!Period %in% "Transition")
  1250. #Specify the sex
  1251. Mean_velocity_dLightDFF <- Mean_velocity_dLightDFF %>%
  1252. mutate(Sex = case_when(
  1253. mouseID == "J0782" ~ "M",
  1254. mouseID == "J0859" ~ "M",
  1255. mouseID == "J0777" ~ "F",
  1256. mouseID == "J0784" ~ "M",
  1257. mouseID == "J0779" ~ "F",
  1258. mouseID == "J0782" ~ "M",
  1259. mouseID == "K0029" ~ "F",
  1260. mouseID == "K0992" ~ "M",
  1261. mouseID == "K0871" ~ "F",
  1262. mouseID == "K0331" ~ "M",
  1263. mouseID == "K0994" ~ "M",
  1264. mouseID == "K0863" ~ "M",
  1265. mouseID == "K0865" ~ "M",
  1266. mouseID == "J0868" ~ "F",
  1267. mouseID == "K0990" ~ "F",
  1268. mouseID == "K0861" ~ "F"
  1269. ))
  1270. Mean_velocity_dLightDFF |>
  1271. tidyplot(x = Period, y = mean_velocity, color = Group) |>
  1272. add_mean_bar(alpha = 0.3) |>
  1273. add_sem_errorbar() |>
  1274. add_data_points_beeswarm(data = filter_rows(Sex == "M"), shape = 16, color = "black") |>
  1275. add_data_points_beeswarm(data = filter_rows(Sex == "F"), shape = 1, color = "black") |>
  1276. add_test_asterisks(hide_info = TRUE) |>
  1277. adjust_y_axis(title = "Mean Velocity (mm/s)")
  1278. Mean_velocity_dLightDFF |>
  1279. tidyplot(x = Period, y = SD_dLightDFF, color = Group) |>
  1280. add_mean_bar(alpha = 0.3) |>
  1281. add_sem_errorbar() |>
  1282. add_data_points_beeswarm(data = filter_rows(Sex == "M"), shape = 16, color = "black") |>
  1283. add_data_points_beeswarm(data = filter_rows(Sex == "F"), shape = 1, color = "black") |>
  1284. add_test_asterisks(hide_info = TRUE) |>
  1285. adjust_y_axis(title = "dLight deltaF/F Standard Deviation")
  1286. #Run two-way ANOVA
  1287. #####Velocity##########
  1288. #Check assumption
  1289. #Normality
  1290. ggqqplot(Mean_velocity_dLightDFF, "mean_velocity", ggtheme = theme_bw()) +
  1291. facet_grid(Group ~ Period)
  1292. #Note: All the points fall approximately along the reference line, for each cell. So we can assume normality of the data.
  1293. #Homogeneity of variance assumption
  1294. Mean_velocity_dLightDFF %>% levene_test(mean_velocity ~ Group*Period)
  1295. #The Levene’s test not significant so we can assume homogeneity
  1296. #ANOVA
  1297. res.aov <- Mean_velocity_dLightDFF %>% anova_test(mean_velocity ~ Group*Period)
  1298. res.aov
  1299. #ANOVA has a significant interaction, so I will proceed to Tukey pairwise comparison
  1300. pwc <- Mean_velocity_dLightDFF %>%
  1301. group_by(Period) %>%
  1302. tukey_hsd(mean_velocity ~ Group)
  1303. write.csv(pwc, "MeanVelocity_PerPeriod_twowayANOVATukeyHSD.csv")
  1304. #####deltaF/F##########
  1305. #Check assumption
  1306. #Normality
  1307. ggqqplot(Mean_velocity_dLightDFF, "SD_dLightDFF", ggtheme = theme_bw()) +
  1308. facet_grid(Group ~ Period)
  1309. #Note: All the points fall approximately along the reference line, for each cell. So we can assume normality of the data.
  1310. #Homogeneity of variance assumption
  1311. Mean_velocity_dLightDFF %>% levene_test(SD_dLightDFF ~ Group*Period)
  1312. #The Levene’s test not significant so we can assume homogeneity
  1313. #ANOVA
  1314. res.aov <- Mean_velocity_dLightDFF %>% anova_test(SD_dLightDFF ~ Group*Period)
  1315. res.aov
  1316. #ANOVA has a significant interaction, so I will proceed to Tukey pairwise comparison
  1317. pwc <- Mean_velocity_dLightDFF %>%
  1318. group_by(Period) %>%
  1319. tukey_hsd(SD_dLightDFF ~ Group)
  1320. write.csv(pwc, "SDdeltaFF_PerPeriod_twowayANOVATukeyHSD.csv")

Fiberphotometry_DA peaks to locomotor bouts analysis.R at commit 3484e62, no license · at the source

Overview

  1. Department of Neurology and Neurosurgery, Montreal Neurological Institute, McGill University, Montreal H3A 2B4, Quebec
  2. Department of Neurology, Feinberg School of Medicine, Northwestern University, Chicago, IL 60611
Institutions: McGill University (Canada); Northwestern University (United States)
Dates: received 23 April 2026; accepted 21 July 2026; published online 24 August 2026; in print 1 September 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1073/pnas.2613593123 · PMID 42636380 · PMCID PMC13535173 · OpenAlex W4412182866
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: mouse (organism), Parkinson's (population)
Keywords: dopamine subtypes, bradykinesia, basal ganglia, fiberphotometry, exploration
MeSH: Calbindin 1*, Calbindins*, Dopaminergic Neurons*, Locomotion*, Mesencephalon*, Animals, Dopamine, Male, Mice (* major topic)
Journal subjects: Biological Sciences, Neuroscience
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 89 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 6 matches between paragraphs and lines of code.

poulin-lab/Bolduc-et-al-2026_Calb1-paper

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 3484e623569f44179457e7cd42c27665a4524815, 25 June 2026
Languages: R (37)
Size: 39 files, 37 scripts
Software Heritage: not archived
Found in: “Data, Materials, and Software Availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (37 files), data.table (36 files), ggplot2 (36 files), ggpubr (36 files), rstatix (11 files), emmeans (1 file), lme4 (1 file), patchwork (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
38 files

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:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 37 scripts, each with its path and the digest of its content;
  • 6 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.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1073/pnas.2613593123.

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, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 13 authors, 5 keywords, 9 MeSH terms, 3 funders, 88 references.

Cite

This paper

Bolduc, C., Oram, C., Donovan, S., Bach, H., Liu, M., Marier, R., Sharpe, M., Liu, S., Campeau, C., Spencer, C. D., Martin, S. A., Awatramani, R., & Poulin, J.-F. (2026). Calbindin stratifies midbrain dopaminergic neurons governing distinct aspects of locomotion. Proceedings of the National Academy of Sciences of the United States of America, 123(35), e2613593123. https://doi.org/10.1073/pnas.2613593123

BibTeX

@article{bolduc2026calbindin,
author = {Bolduc, Cyril and Oram, Cameron and Donovan, Skylar and Bach, Haleigh and Liu, Martha and Marier, Rafaëlle and Sharpe, Morgan and Liu, Siqi and Campeau, Cédric and Spencer, Carl Duncan and Martin, Sarah A. and Awatramani, Rajeshwar and Poulin, Jean-François},
title = {{Calbindin stratifies midbrain dopaminergic neurons governing distinct aspects of locomotion}},
journal = {Proceedings of the National Academy of Sciences of the United States of America},
year = {2026},
month = aug,
volume = {123},
number = {35},
pages = {e2613593123},
publisher = {National Academy of Sciences},
issn = {0027-8424},
doi = {10.1073/pnas.2613593123},
url = {https://doi.org/10.1073/pnas.2613593123},
pmid = {42636380},
pmcid = {PMC13535173}
}

RIS

TY - JOUR
AU - Bolduc, Cyril
AU - Oram, Cameron
AU - Donovan, Skylar
AU - Bach, Haleigh
AU - Liu, Martha
AU - Marier, Rafaëlle
AU - Sharpe, Morgan
AU - Liu, Siqi
AU - Campeau, Cédric
AU - Spencer, Carl Duncan
AU - Martin, Sarah A.
AU - Awatramani, Rajeshwar
AU - Poulin, Jean-François
TI - Calbindin stratifies midbrain dopaminergic neurons governing distinct aspects of locomotion
T2 - Proceedings of the National Academy of Sciences of the United States of America
J2 - Proc Natl Acad Sci U S A
PY - 2026
DA - 2026/08/24
VL - 123
IS - 35
SP - e2613593123
SN - 0027-8424
PB - National Academy of Sciences
DO - 10.1073/pnas.2613593123
UR - https://doi.org/10.1073/pnas.2613593123
LA - en
ER -

CSL-JSON

{
"id": "10.1073/pnas.2613593123",
"type": "article-journal",
"title": "Calbindin stratifies midbrain dopaminergic neurons governing distinct aspects of locomotion",
"container-title": "Proceedings of the National Academy of Sciences of the United States of America",
"author": [
{
"family": "Bolduc",
"given": "Cyril"
},
{
"family": "Oram",
"given": "Cameron"
},
{
"family": "Donovan",
"given": "Skylar"
},
{
"family": "Bach",
"given": "Haleigh"
},
{
"family": "Liu",
"given": "Martha"
},
{
"family": "Marier",
"given": "Rafaëlle"
},
{
"family": "Sharpe",
"given": "Morgan"
},
{
"family": "Liu",
"given": "Siqi"
},
{
"family": "Campeau",
"given": "Cédric"
},
{
"family": "Spencer",
"given": "Carl Duncan"
},
{
"family": "Martin",
"given": "Sarah A."
},
{
"family": "Awatramani",
"given": "Rajeshwar"
},
{
"family": "Poulin",
"given": "Jean-François"
}
],
"container-title-short": "Proc Natl Acad Sci U S A",
"volume": "123",
"issue": "35",
"page": "e2613593123",
"DOI": "10.1073/pnas.2613593123",
"PMID": "42636380",
"PMCID": "PMC13535173",
"ISSN": "0027-8424",
"publisher": "National Academy of Sciences",
"URL": "https://doi.org/10.1073/pnas.2613593123",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
24
]
]
}
}

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.1038/s41467-026-75194-3 [code]
Leucine-rich repeat kinase 2 impairs the release sites of Parkinson's disease vulnerable dopamine axons.
Journal: Nature communications
In common: ggplot2, tidyverse, Parkinson's, mouse, 17 references, author Rajeshwar Awatramani
[2] doi:10.1038/s41467-026-73994-1 [code]
Prediction error correlates in the striosome-dopamine circuit emerge from information gain.
Journal: Nature communications
In common: 16 references
[3] doi:10.1016/j.celrep.2026.117298 [code]
Midbrain endocannabinoids actuate dopamine-based action selection.
Journal: Cell reports
In common: emmeans, lme4, data.table, 3 other tools, mouse, 6 references
[4] doi:10.1016/j.isci.2026.117130 [code]
Region-specific weighting of sensory intensity and reward prediction error by dopamine signals.
Journal: iScience
In common: 8 references
[5] doi:10.1126/sciadv.adq8840 [code]
Astrocytes mediate the dopaminergic modulation of tonic GABAergic signaling in substantia nigra.
Journal: Science advances
In common: mouse, 4 references, author Rajeshwar Awatramani
[6] doi:10.3390/ijms27135713 [code]
Chronic Administration of Marinobufagenin in Mice Causes Hyperlocomotion and Decrease in Anxiety by Altering Monoamine Turnover Unaccompanied by Motor Deficits or Oxidative Stress.
Journal: International journal of molecular sciences
In common: rstatix, emmeans, lme4, 5 other tools, mouse
[7] doi:10.1126/sciadv.aec9291 [code]
Computational mechanisms of perception in autism revealed using games inspired by rodent operant tasks.
Journal: Science advances
In common: rstatix, emmeans, lme4, 5 other tools
[8] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: rstatix, emmeans, lme4, 5 other tools
[9] doi:10.1038/s41467-026-74753-y [code]
A human-specific microRNA controls the timing of excitatory synaptogenesis.
Journal: Nature communications
In common: rstatix, emmeans, lme4, 5 other tools
[10] doi:10.1038/s41398-026-04141-z [code]
Effects on hippocampal activity following novel 5-HT4 receptor agonism in unmedicated patients with depression: the RESTAND study.
Journal: Translational psychiatry
In common: rstatix, emmeans, lme4, 5 other tools

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.

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.