OSCR

Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial.

Code ↔ Paper

18 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 18 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Data analysis ↔ Data Processing/calcGaitMetrics.m, lines 191–261 · score 0.83 · heel strike, foot position, Temporal metrics, gait events, gait metrics, swing
  2. [2] § Methods › Statistical analysis ↔ Figure Generation/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_plots.R, lines 644–710 · score 0.77 · cardinal symptoms, motor diaries, patient reported, stiffness, worse, rigidity
  3. [3] § Methods › Adaptive DBS › Double-blind testing ↔ Analysis/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_analysis.R, lines 73–143 · score 0.70 · motor diary, double blind, cDBS, rigidity, day, tremor
  4. [4] § Methods › Adaptive DBS › Double-blind testing ↔ Figure Generation/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_plots.R, lines 601–642 · score 0.69 · motor diary, double blind, cDBS, rigidity, tremor, freezing
  5. [5] § Methods › Experimental paradigm ↔ Figure Generation/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_plots.R, lines 601–642 · score 0.66 · motor diaries, gait metrics, double blind, Rover, cDBS, post
  6. [6] § Methods › Experimental paradigm ↔ Analysis/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_analysis.R, lines 73–143 · score 0.66 · motor diaries, gait metrics, double blind, Rover, cDBS, post
  7. [7] § Results › Secondary clinical outcome: double-blinded crossover trial shows aDBS decreased falls compared to cDBS ↔ Figure Generation/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_plots.R, lines 644–710 · score 0.63 · patient reported, gait metrics, bar, Rover, stiffness, worse
  8. [8] § Results › Primary feasibility outcome: neural biomarkers of leg swing during overground walking ↔ Figure Generation/gait_biomarker_canonical_band_heatmap_plot.R, lines 161–235 · score 0.62 · canonical band, contralateral leg swing, Heatmap, Frequency bands, ipsilateral, M1
  9. [9] § Results › Secondary clinical outcome: double-blinded crossover trial shows aDBS decreased falls compared to cDBS ↔ Data Processing/calcGaitMetrics.m, lines 191–261 · score 0.61 · heel strike, stride length, gait metrics
  10. [10] § Results › Secondary clinical outcome: double-blinded crossover trial shows aDBS decreased falls compared to cDBS ↔ Figure Generation/double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_plots.R, lines 470–531 · score 0.60 · walking speed, stride length, gait metrics, Rover, cDBS, aDBS
  11. [11] § Methods › Data analysis ↔ Data Processing/aggregateRCSSimSpecData.m, lines 106–170 · score 0.60 · gait events, gait cycle, swing phase, Xsens, Filtered, FFT
  12. [12] § Results › Primary feasibility outcome: accuracy and stability of contralateral leg swing biomarkers in real-time aDBS control ↔ Analysis/biomarker_pre_post_aDBS_programming_stability_analysis.R, lines 14–60 · score 0.58 · patient biomarker, biomarker power, Cohen, overlap, interval, aDBS
  13. [13] § Results › Primary feasibility outcome: accuracy and stability of contralateral leg swing biomarkers in real-time aDBS control ↔ Analysis/biomarker_pre_post_aDBS_programming_stability_analysis.R, lines 14–60 · score 0.57 · pre optimized DBS, post optimized DBS, Cohen, biomarker, outliers, aDBS
  14. [14] § Results › Primary feasibility outcome: neural biomarkers of leg swing during overground walking ↔ Figure Generation/PSD_and_Insert_Plots.m, the whole file · a weak match · score 0.56 · power spectral density, right swing phase, GPi, M1, Min, PM
  15. [15] § Results › Primary feasibility outcome: accuracy and stability of contralateral leg swing biomarkers in real-time aDBS control ↔ Figure Generation/biomarker_pre_post_aDBS_programming_plots.R, lines 14–42 · score 0.54 · pre optimized DBS, post optimized DBS, density, biomarker, outliers, aDBS
  16. [16] § Results › Primary feasibility outcome: neural biomarkers of leg swing during overground walking ↔ Figure Generation/gait_biomarker_canonical_band_heatmap_plot.R, lines 1–30 · score 0.53 · canonical bands, frequency band, gait phase, pallidum, M1, PM
  17. [17] § Methods › Adaptive DBS › Gait phase biomarker search ↔ Figure Generation/gait_biomarker_heatmap_plot.R, the whole file · a weak match · score 0.52 · gait phase, frequency band, 15 %, biomarker, accuracy
  18. [18] § Methods › Data analysis ↔ rcssim/rcs_sim.py, lines 261–328 · score 0.50 · power spectra, rcssim, signals, raw, FFT, device

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 · 710 lines · 41 KB · no license · 5 matches

  1. library(tidyverse)
  2. library(cowplot)
  3. library(export)
  4. library(gghalves)
  5. library(ggsignif)
  6. ##### Helper functions #####
  7. outlier_threshold <- function(df,variableName,quantileVal)
  8. {
  9. iqr_val <- IQR(df[[variableName]], na.rm = TRUE)
  10. quantile_val <- quantile(df[[variableName]], probs = quantileVal, na.rm = TRUE)
  11. if (quantileVal > 0.5) {
  12. return(quantile_val + 1.5 * iqr_val)
  13. } else {
  14. return(quantile_val - 1.5 * iqr_val)
  15. }
  16. }
  17. ##### In-clinic gait metrics #####
  18. # Load data
  19. clinic_data <-read.csv('Figure5D_ED2.csv')
  20. clinic_data <- clinic_data %>%
  21. mutate(SubjectID = as.factor(SubjectID),
  22. SubjectID = fct_relevel(SubjectID,c("P2","P3","P4")),
  23. DBSCondition = factor(case_when(str_detect(DBSCondition,"Clinical") ~ "cDBS",str_detect(DBSCondition,"Ramp-Up") ~ "RU-aDBS",str_detect(DBSCondition,"Ramp-Down") ~ "RD-aDBS"),levels = c("cDBS","RU-aDBS","RD-aDBS")),
  24. GaitCycle = as.factor(GaitCycle),
  25. WalkType = as.factor(WalkType))
  26. clinic_data_filt <- clinic_data %>%
  27. group_by(SubjectID,DBSCondition) %>%
  28. filter({
  29. lower <- outlier_threshold(cur_data(), "StepLength_L", 0.25)
  30. upper <- outlier_threshold(cur_data(), "StepLength_L", 0.75)
  31. StepLength_L >= lower & StepLength_L <= upper
  32. },
  33. {
  34. lower <- outlier_threshold(cur_data(), "StepLength_R", 0.25)
  35. upper <- outlier_threshold(cur_data(), "StepLength_R", 0.75)
  36. StepLength_R >= lower & StepLength_R <= upper
  37. },
  38. {
  39. lower <- outlier_threshold(cur_data(), "StepTime_L", 0.25)
  40. upper <- outlier_threshold(cur_data(), "StepTime_L", 0.75)
  41. StepTime_L >= lower & StepTime_L <= upper
  42. },
  43. {
  44. lower <- outlier_threshold(cur_data(), "StepTime_R", 0.25)
  45. upper <- outlier_threshold(cur_data(), "StepTime_R", 0.75)
  46. StepTime_R >= lower & StepTime_R <= upper
  47. })
  48. gait_metrics <- clinic_data_filt %>%
  49. mutate(StepLengthSymm_L = StepLengthSymm, StepTimeSymm_L = StepTimeSymm) %>%
  50. select(-StepLengthSymm,-StepTimeSymm) %>%
  51. pivot_longer(cols = ends_with("_L") | ends_with("_R"),names_to = "Metric",values_to = "Value") %>%
  52. mutate(Side = case_when(grepl("_L$", Metric) ~ "Left",grepl("_R$", Metric) ~ "Right")) %>%
  53. mutate(Metric = sub("_[LR]$","",Metric)) %>%
  54. select(-WalkType)
  55. summary_clinic_data <- gait_metrics %>% group_by(SubjectID,DBSCondition,Metric,Side) %>%
  56. summarise(mean = mean(abs(Value/100),na.rm = TRUE),
  57. lower = mean(abs(Value/100),na.rm = TRUE)-(sd(abs(Value/100),na.rm = TRUE)/sqrt(n())),
  58. upper = mean(abs(Value/100),na.rm = TRUE)+(sd(abs(Value/100),na.rm = TRUE)/sqrt(n())),
  59. var = var(abs(Value/100),na.rm = TRUE),sd = sd(abs(Value/100),na.rm = TRUE),
  60. cv = sd(Value,na.rm = TRUE)/mean(Value,na.rm = TRUE)) %>%
  61. ungroup() %>%
  62. group_by(SubjectID,Metric,Side) %>%
  63. mutate(percentChange_C_to_RU = ((mean[2]-mean[1])/mean[1])*100,
  64. percentChange_C_to_RD = ((mean[3]-mean[1])/mean[1])*100,
  65. percentChange_RU_to_RD = ((mean[3]-mean[2])/mean[2])*100)
  66. # Plots
  67. clinic_sl_plot <- ggplot()+
  68. geom_half_violin(data = gait_metrics %>% filter(Metric == "StepLength"),
  69. aes(x = DBSCondition,y = Value, fill = Side, split = Side),
  70. linewidth = 0.1,position = "identity")+
  71. geom_signif(data = data.frame(SubjectID = c("P2","P2","P3","P4"),
  72. start = c("cDBS","RU-aDBS","RU-aDBS","cDBS"),
  73. end = c("RU-aDBS","RD-aDBS","RD-aDBS","RD-aDBS"),
  74. y = c(1.02,0.92,0.92,0.97),
  75. label = c("***","*","***","***")),
  76. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#fb8072", size = 0.25, textsize = 1.5, vjust = 0.5,tip_length = 0, manual = TRUE)+
  77. geom_signif(data = data.frame(SubjectID = c("P3"),
  78. start = c("cDBS"),
  79. end = c("RU-aDBS"),
  80. y = c(1.02),
  81. label = c("***")),
  82. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#80b1d3", size = 0.25, textsize = 1.5, vjust = 0.5,tip_length = 0, manual = TRUE)+
  83. geom_signif(data = data.frame(SubjectID = c("P3","P4","P4"),
  84. start = c("cDBS","cDBS","RU-aDBS"),
  85. end = c("RD-aDBS","RU-aDBS","RD-aDBS"),
  86. y = c(0.97,1.02,0.92),
  87. label = c("* / ***","*** / ***","*** / ***")),
  88. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#8dd3c7", size = 0.25, textsize = 1.5, vjust = 0.5,tip_length = 0, manual = TRUE)+
  89. scale_x_discrete()+
  90. scale_fill_manual(name = "Leg:",
  91. labels = c("Left","Right"),
  92. values = c("#fb8072","#80b1d3"))+
  93. facet_grid(~SubjectID,labeller = labeller(SubjectID = c("P2" = "Patient 2","P3" = "Patient 3","P4" = "Patient 4"))) +
  94. ylab("meters") +
  95. ggtitle("Step Length") +
  96. theme_bw(base_size = 5)+
  97. theme(plot.title = element_text(hjust = 0.5,size = 8),
  98. axis.title.x = element_blank(),
  99. axis.text.x = element_text(size = 5),
  100. legend.key.size = unit(0.5,"line"),
  101. legend.text = element_text(size = 5,margin = margin(0,0,0,2)),
  102. strip.background = element_blank(),
  103. strip.text = element_text(size = 5),
  104. panel.grid = element_blank(),
  105. panel.border = element_blank(),
  106. panel.spacing = unit(0.25, "lines"),
  107. axis.line.x = element_line(linetype = "solid", colour = "black"),
  108. axis.line.y = element_line(linetype = "solid", colour = "black"))
  109. clinic_st_plot <- ggplot()+
  110. geom_half_violin(data = gait_metrics %>% filter(Metric == "StepTime"),
  111. aes(x = DBSCondition,y = Value, fill = Side, split = Side),
  112. linewidth = 0.1, position = "identity")+
  113. geom_signif(data = data.frame(SubjectID = c("P4"),
  114. start = c("RU-aDBS"),
  115. end = c("RD-aDBS"),
  116. y = c(0.75),
  117. label = c("***")),
  118. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#fb8072", size = 0.25, textsize = 1.5, vjust = 0.5,tip_length = 0, manual = TRUE)+
  119. geom_signif(data = data.frame(SubjectID = c("P4"),
  120. start = c("cDBS"),
  121. end = c("RU-aDBS"),
  122. y = c(0.81),
  123. label = c("***")),
  124. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#80b1d3", size = 0.25, textsize = 1.5, vjust = 0.5,tip_length = 0, manual = TRUE)+
  125. geom_signif(data = data.frame(SubjectID = c("P2","P2","P2","P3","P3","P3","P4"),
  126. start = c("cDBS","cDBS","RU-aDBS","cDBS","cDBS","RU-aDBS","cDBS"),
  127. end = c("RU-aDBS","RD-aDBS","RD-aDBS","RU-aDBS","RD-aDBS","RD-aDBS","RD-aDBS"),
  128. y = c(0.81,0.78,0.75,0.81,0.78,0.75,0.78),
  129. label = c("** / *","* / *","*** / ***","* / ***","*** / ***","*** / ***","** / ***")),
  130. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#8dd3c7", size = 0.25, textsize = 1.5, vjust = 0.5,tip_length = 0, manual = TRUE)+
  131. scale_x_discrete()+
  132. scale_fill_manual(name = "Leg:",
  133. labels = c("Left","Right"),
  134. values = c("#fb8072","#80b1d3"))+
  135. facet_grid(~SubjectID,labeller = labeller(SubjectID = c("P2" = "Patient 2","P3" = "Patient 3","P4" = "Patient 4"))) +
  136. ylab("seconds") +
  137. ggtitle("Step Time") +
  138. theme_bw(base_size = 5)+
  139. theme(plot.title = element_text(hjust = 0.5,size = 8),
  140. axis.title.x = element_blank(),
  141. axis.text.x = element_text(size = 5),
  142. legend.key.size = unit(0.5,"line"),
  143. legend.text = element_text(size = 5,margin = margin(0,0,0,2)),
  144. strip.background = element_blank(),
  145. strip.text = element_text(size = 5),
  146. panel.grid = element_blank(),
  147. panel.border = element_blank(),
  148. panel.spacing = unit(0.25, "lines"),
  149. axis.line.x = element_line(linetype = "solid", colour = "black"),
  150. axis.line.y = element_line(linetype = "solid", colour = "black"))
  151. group_sl_CV_L_plot = ggplot(data = summary_clinic_data %>% filter(Metric == "StepLength", Side == "Left"), aes(x = DBSCondition, y = cv, group = SubjectID))+
  152. geom_point(data = summary_clinic_data %>% filter(Metric == "StepLength", Side == "Left"),aes(color = SubjectID, shape = SubjectID, fill = SubjectID), position = position_dodge2(width = 0.25), size = 1) +
  153. geom_line(aes(color = SubjectID),position = position_dodge2(width = 0.25), linewidth = 0.25, show.legend = FALSE)+
  154. scale_color_manual(name = "",
  155. labels = c("Patient 2", "Patient 3", "Patient 4"),
  156. values = c("#FAA41D","#ED2790","#6BBD46"))+
  157. scale_fill_manual(name = "",
  158. labels = c("Patient 2", "Patient 3", "Patient 4"),
  159. values = c("#FAA41D","#ED2790","#6BBD46"))+
  160. scale_shape_manual(name = "",
  161. labels = c("Patient 2", "Patient 3", "Patient 4"),
  162. values = c(22,23,24))+
  163. scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  164. ylab("Coefficient of Variation")+
  165. ggtitle("Left") +
  166. theme_bw(base_size = 5)+
  167. theme(plot.title = element_text(hjust = 0.5,size = 6),
  168. axis.title.x = element_blank(),
  169. axis.title.y = element_text(size = 6),
  170. axis.text.x = element_text(size = 6),
  171. legend.key.size = unit(0.5,"line"),
  172. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  173. panel.grid = element_blank(),
  174. panel.border = element_blank(),
  175. panel.spacing = unit(0.25, "lines"),
  176. axis.line.x = element_line(linetype = "solid", colour = "black"),
  177. axis.line.y = element_line(linetype = "solid", colour = "black"))
  178. group_sl_CV_R_plot = ggplot(data = summary_clinic_data %>% filter(Metric == "StepLength", Side == "Right"), aes(x = DBSCondition, y = cv, group = SubjectID))+
  179. geom_point(data = summary_clinic_data %>% filter(Metric == "StepLength", Side == "Right"),aes(color = SubjectID, shape = SubjectID, fill = SubjectID), position = position_dodge2(width = 0.25), size = 1) +
  180. geom_line(aes(color = SubjectID),position = position_dodge2(width = 0.25), linewidth = 0.25)+
  181. scale_color_manual(name = "",
  182. labels = c("Patient 2", "Patient 3", "Patient 4"),
  183. values = c("#FAA41D","#ED2790","#6BBD46"))+
  184. scale_fill_manual(name = "",
  185. labels = c("Patient 2", "Patient 3", "Patient 4"),
  186. values = c("#FAA41D","#ED2790","#6BBD46"))+
  187. scale_shape_manual(name = "",
  188. labels = c("Patient 2", "Patient 3", "Patient 4"),
  189. values = c(22,23,24))+
  190. scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  191. ylab("Coefficient of Variation")+
  192. ggtitle("Right") +
  193. theme_bw(base_size = 5)+
  194. theme(plot.title = element_text(hjust = 0.5,size = 6),
  195. axis.title.x = element_blank(),
  196. axis.title.y = element_text(size = 6),
  197. axis.text.x = element_text(size = 6),
  198. legend.key.size = unit(0.5,"line"),
  199. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  200. panel.grid = element_blank(),
  201. panel.border = element_blank(),
  202. panel.spacing = unit(0.25, "lines"),
  203. axis.line.x = element_line(linetype = "solid", colour = "black"),
  204. axis.line.y = element_line(linetype = "solid", colour = "black"))
  205. group_st_CV_L_plot = ggplot(data = summary_clinic_data %>% filter(Metric == "StepTime", Side == "Left"), aes(x = DBSCondition, y = cv, group = SubjectID))+
  206. geom_point(data = summary_clinic_data %>% filter(Metric == "StepTime", Side == "Left"),aes(color = SubjectID, shape = SubjectID, fill = SubjectID), position = position_dodge2(width = 0.25), size = 1) +
  207. geom_line(aes(color = SubjectID),position = position_dodge2(width = 0.25), linewidth = 0.25)+
  208. scale_color_manual(name = "",
  209. labels = c("Patient 2", "Patient 3", "Patient 4"),
  210. values = c("#FAA41D","#ED2790","#6BBD46"))+
  211. scale_fill_manual(name = "",
  212. labels = c("Patient 2", "Patient 3", "Patient 4"),
  213. values = c("#FAA41D","#ED2790","#6BBD46"))+
  214. scale_shape_manual(name = "",
  215. labels = c("Patient 2", "Patient 3", "Patient 4"),
  216. values = c(22,23,24))+
  217. scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  218. ylab("Coefficient of Variation")+
  219. ggtitle("Left") +
  220. theme_bw(base_size = 5)+
  221. theme(plot.title = element_text(hjust = 0.5,size = 6),
  222. axis.title.x = element_blank(),
  223. axis.title.y = element_text(size = 6),
  224. axis.text.x = element_text(size = 6),
  225. legend.key.size = unit(0.5,"line"),
  226. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  227. panel.grid = element_blank(),
  228. panel.border = element_blank(),
  229. panel.spacing = unit(0.25, "lines"),
  230. axis.line.x = element_line(linetype = "solid", colour = "black"),
  231. axis.line.y = element_line(linetype = "solid", colour = "black"))
  232. group_st_CV_R_plot = ggplot(data = summary_clinic_data %>% filter(Metric == "StepTime", Side == "Right"), aes(x = DBSCondition, y = cv, group = SubjectID))+
  233. geom_point(data = summary_clinic_data %>% filter(Metric == "StepTime", Side == "Right"),aes(color = SubjectID, shape = SubjectID, fill = SubjectID), position = position_dodge2(width = 0.25), size = 1) +
  234. geom_line(aes(color = SubjectID),position = position_dodge2(width = 0.25), linewidth = 0.25)+
  235. scale_color_manual(name = "",
  236. labels = c("Patient 2", "Patient 3", "Patient 4"),
  237. values = c("#FAA41D","#ED2790","#6BBD46"))+
  238. scale_fill_manual(name = "",
  239. labels = c("Patient 2", "Patient 3", "Patient 4"),
  240. values = c("#FAA41D","#ED2790","#6BBD46"))+
  241. scale_shape_manual(name = "",
  242. labels = c("Patient 2", "Patient 3", "Patient 4"),
  243. values = c(22,23,24))+
  244. scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  245. ylab("Coefficient of Variation")+
  246. ggtitle("Right") +
  247. theme_bw(base_size = 5)+
  248. theme(plot.title = element_text(hjust = 0.5,size = 6),
  249. axis.title.x = element_blank(),
  250. axis.title.y = element_text(size = 6),
  251. axis.text.x = element_text(size = 6),
  252. legend.key.size = unit(0.5,"line"),
  253. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  254. panel.grid = element_blank(),
  255. panel.border = element_blank(),
  256. panel.spacing = unit(0.25, "lines"),
  257. axis.line.x = element_line(linetype = "solid", colour = "black"),
  258. axis.line.y = element_line(linetype = "solid", colour = "black"))
  259. group_step_length_symmetry_plot = ggplot(data = summary_clinic_data %>% filter(Metric == "StepLengthSymm"), aes(x = DBSCondition, y = mean, group = SubjectID))+
  260. geom_point(data = summary_clinic_data %>% filter(Metric == "StepLengthSymm"),aes(color = SubjectID,shape = SubjectID, fill = SubjectID), position = position_dodge2(width = 0.25),size = 1) +
  261. geom_line(aes(color = SubjectID),position = position_dodge2(width = 0.25), linewidth = 0.25, show.legend = FALSE)+
  262. geom_errorbar(aes(ymin = lower,ymax = upper,color = SubjectID),width = 0.25,position = position_dodge2(width=0.25), linewidth = 0.25, show.legend = FALSE) +
  263. geom_signif(data = data.frame(SubjectID = c("P2","P2","P2"),
  264. start = c("cDBS","cDBS","RU-aDBS"),
  265. end = c("RD-aDBS","RU-aDBS","RD-aDBS"),
  266. y = c(0.18,0.17,0.16),
  267. label = c("")),
  268. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "black", size = 0.25, textsize = 2, vjust = 0.5,tip_length = 0, manual = TRUE)+
  269. scale_color_manual(name = "",
  270. labels = c("Patient 2", "Patient 3", "Patient 4"),
  271. values = c("#FAA41D","#ED2790","#6BBD46"))+
  272. scale_fill_manual(name = "",
  273. labels = c("Patient 2", "Patient 3", "Patient 4"),
  274. values = c("#FAA41D","#ED2790","#6BBD46"))+
  275. scale_shape_manual(name = "",
  276. labels = c("Patient 2", "Patient 3", "Patient 4"),
  277. values = c(22,23,24))+
  278. scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  279. ylab("Absolute Asymmetry")+
  280. ggtitle("Step Length Symmetry") +
  281. theme_bw(base_size = 5)+
  282. theme(plot.title = element_text(hjust = 0.5,size = 8),
  283. axis.title.x = element_blank(),
  284. axis.title.y = element_text(size = 6),
  285. axis.text.x = element_text(size = 6),
  286. legend.key.size = unit(0.5,"line"),
  287. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  288. panel.grid = element_blank(),
  289. panel.border = element_blank(),
  290. panel.spacing = unit(0.25, "lines"),
  291. axis.line.x = element_line(linetype = "solid", colour = "black"),
  292. axis.line.y = element_line(linetype = "solid", colour = "black"))
  293. group_step_time_symmetry_plot = ggplot(data = summary_clinic_data %>% filter(Metric == "StepTimeSymm"), aes(x = DBSCondition, y = mean, group = SubjectID))+
  294. geom_point(data = summary_clinic_data %>% filter(Metric == "StepTimeSymm"),aes(color = SubjectID, shape = SubjectID, fill = SubjectID), position = position_dodge2(width = 0.25),size = 1) +
  295. geom_line(aes(color = SubjectID),position = position_dodge2(width = 0.25), linewidth = 0.25, show.legend = FALSE)+
  296. geom_errorbar(aes(ymin = lower,ymax = upper,color = SubjectID),width = 0.25,position = position_dodge2(width=0.25), linewidth = 0.25, show.legend = FALSE) +
  297. geom_signif(data = data.frame(SubjectID = c("P2","P2","P2"),
  298. start = c("cDBS","cDBS","RU-aDBS"),
  299. end = c("RD-aDBS","RU-aDBS","RD-aDBS"),
  300. y = c(0.09,0.085,0.08),
  301. label = c("")),
  302. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "black", size = 0.25, textsize = 2, vjust = 0.5,tip_length = 0, manual = TRUE)+
  303. scale_color_manual(name = "",
  304. labels = c("Patient 2", "Patient 3", "Patient 4"),
  305. values = c("#FAA41D","#ED2790","#6BBD46"))+
  306. scale_fill_manual(name = "",
  307. labels = c("Patient 2", "Patient 3", "Patient 4"),
  308. values = c("#FAA41D","#ED2790","#6BBD46"))+
  309. scale_shape_manual(name = "",
  310. labels = c("Patient 2", "Patient 3", "Patient 4"),
  311. values = c(22,23,24))+
  312. scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  313. ylab("Absolute Asymmetry")+
  314. ggtitle("Step Time Symmetry") +
  315. theme_bw(base_size = 5)+
  316. theme(plot.title = element_text(hjust = 0.5,size = 8),
  317. axis.title.x = element_blank(),
  318. axis.title.y = element_text(size = 6),
  319. axis.text.x = element_text(size = 6),
  320. legend.key.size = unit(0.5,"line"),
  321. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  322. panel.grid = element_blank(),
  323. panel.border = element_blank(),
  324. panel.spacing = unit(0.25, "lines"),
  325. axis.line.x = element_line(linetype = "solid", colour = "black"),
  326. axis.line.y = element_line(linetype = "solid", colour = "black"))
  327. signif_color_plot <- ggplot(data = data.frame(x = factor(c("Lunch","Dinner","Lunch","Dinner","Lunch","Dinner"), levels=c("Lunch","Dinner")),
  328. y = c(1,1,2,2,3,3),
  329. signif = factor(c("Left Leg Only","Right Leg Only","Both Legs"), levels=c("Left Leg Only","Right Leg Only","Both Legs"))),
  330. aes(x = x,y = y,color = signif))+
  331. scale_color_manual(name = "Significance:",
  332. values = c("#fb8072","#80b1d3","#8dd3c7"))+
  333. geom_line()+
  334. theme_bw(base_size = 5) +
  335. theme(legend.key.size = unit(0.5,"line"),
  336. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),)
  337. ##### Combine plots #####
  338. common_clinic_fill_legend <- get_plot_component(clinic_sl_plot +
  339. guides(color = guide_legend(nrow = 1,ncol = 2)) +
  340. theme(legend.position = "bottom",
  341. legend.text = element_text(margin = margin(0,5,0,5))),
  342. 'guide-box-bottom',return_all = TRUE)
  343. common_clinic_color_legend <- get_plot_component(signif_color_plot +
  344. guides(color = guide_legend(nrow = 1,ncol = 3)) +
  345. theme(legend.position = "bottom",
  346. legend.text = element_text(margin = margin(0,5,0,5))),
  347. 'guide-box-bottom',return_all = TRUE)
  348. common_clinic_symm_legend <- get_plot_component(group_step_length_symmetry_plot +
  349. guides(color = guide_legend(nrow = 1,ncol = 3)) +
  350. theme(legend.position = "bottom",
  351. legend.text = element_text(margin = margin(0,5,0,5))),
  352. 'guide-box-bottom',return_all = TRUE)
  353. common_cv_legend <- get_plot_component(group_sl_CV_L_plot +
  354. guides(color = guide_legend(nrow = 1,ncol = 3)) +
  355. theme(legend.position = "bottom",
  356. legend.text = element_text(margin = margin(0,5,0,5))),
  357. 'guide-box-bottom',return_all = TRUE)
  358. combined_legends <- plot_grid(NULL,common_cv_legend,NULL,common_clinic_fill_legend,NULL,common_clinic_color_legend,NULL,
  359. ncol = 7,
  360. rel_widths = c(0.5,1,0.5,0.75,0.15,0.75,0.35))
  361. step_length_cv_plot <- plot_grid(group_sl_CV_L_plot + theme(legend.position = "none"),
  362. NULL,
  363. group_sl_CV_R_plot + theme(legend.position = "none"),
  364. ncol = 3,
  365. nrow = 1,
  366. rel_widths = c(1,0.05,1))
  367. step_length_cv_title <- ggplot() + ggtitle("Step Length Variability") + theme(plot.title = element_text(hjust = 0.5,size = 8))
  368. step_length_cv_w_title_plot <- plot_grid(step_length_cv_title,step_length_cv_plot,
  369. nrow = 2,
  370. rel_heights = c(0.1,1))
  371. step_time_cv_plot <- plot_grid(group_st_CV_L_plot + theme(legend.position = "none"),
  372. NULL,
  373. group_st_CV_R_plot + theme(legend.position = "none"),
  374. ncol = 3,
  375. nrow = 1,
  376. rel_widths = c(1,0.05,1))
  377. step_time_cv_title <- ggplot() + ggtitle("Step Time Variability") + theme(plot.title = element_text(hjust = 0.5,size = 8))
  378. step_time_cv_w_title_plot <- plot_grid(step_time_cv_title,step_time_cv_plot,
  379. nrow = 2,
  380. rel_heights = c(0.1,1))
  381. combined_clinic_metrics <- plot_grid(group_step_length_symmetry_plot + theme(legend.position = "none"),NULL,clinic_sl_plot + theme(legend.position = "none"),
  382. NULL,NULL,NULL,
  383. group_step_time_symmetry_plot + theme(legend.position = "none"),NULL,clinic_st_plot + theme(legend.position = "none"),
  384. ncol = 3,
  385. nrow = 3,
  386. rel_widths = c(0.5,0.05,1),
  387. rel_heights = c(1,0.05,1))
  388. combined_clinic_legend <- plot_grid(NULL,common_clinic_symm_legend,NULL,common_clinic_fill_legend,NULL,common_clinic_color_legend,NULL,
  389. ncol = 7,
  390. rel_widths = c(0.25,1,0.25,1,0.01,1,0.4))
  391. combined_clinic_metrics_w_legend <- plot_grid(combined_clinic_metrics,
  392. combined_clinic_legend,
  393. nrow = 2,
  394. rel_heights = c(1,0.05))
  395. combined_clinic_var_metrics <- plot_grid(NULL,NULL,NULL,NULL,NULL,
  396. step_length_cv_w_title_plot,NULL,group_step_length_symmetry_plot + theme(legend.position = "none"),NULL,clinic_sl_plot + theme(legend.position = "none"),
  397. NULL,NULL,NULL,NULL,NULL,
  398. step_time_cv_w_title_plot,NULL,group_step_time_symmetry_plot + theme(legend.position = "none"),NULL,clinic_st_plot + theme(legend.position = "none"),
  399. ncol = 5,
  400. nrow = 4,
  401. rel_widths = c(0.75,0.01,0.5,0.01,1.33),
  402. rel_heights = c(0.05,1,0.05,1))
  403. combined_clinic_var_metrics_w_legend <- plot_grid(combined_clinic_var_metrics,
  404. NULL,
  405. combined_legends,
  406. nrow = 3,
  407. rel_heights = c(1,0.01,0.05))
  408. combined_clinic_var_metrics <- plot_grid(NULL,
  409. step_length_cv_w_title_plot,
  410. NULL,
  411. step_time_cv_w_title_plot,
  412. nrow = 4,
  413. rel_heights = c(0.05,1,0.05,1))
  414. combined_clinic_var_title <- ggplot() + ggtitle("In-clinic Gait Metrics") + theme(plot.title = element_text(hjust = 0.5,size = 8))
  415. combined_clinic_var_metrics_with_title <- plot_grid(combined_clinic_var_title,combined_clinic_var_metrics,
  416. nrow = 2,
  417. rel_heights = c(0.05,1))
  418. ##### Long-term Rover #####
  419. # Load data
  420. rover_data <- read.csv('Figure5C.csv')
  421. data2 <- rover_data %>%
  422. mutate(SubjectID = as.factor(SubjectID),
  423. SubjectID = fct_relevel(SubjectID,c("P2","P3","P4")),
  424. Condition = as.factor(Condition),
  425. Condition = fct_relevel(Condition,c("clinical","ramp_up","ramp_down"))) %>%
  426. select(-Notes) %>%
  427. pivot_longer(!c(SubjectID,Condition,Day),names_to = "metric",values_to = "value")
  428. data3 <- data2 %>% group_by(SubjectID,Condition,metric) %>%
  429. summarise(mean = mean(abs(value), na.rm = TRUE), sd = sd(abs(value), na.rm = TRUE), se = sd/sqrt(n())) %>%
  430. ungroup() %>%
  431. mutate(Condition = fct_recode(Condition, "C" = "clinical", "RU" = "ramp_up", "RD" = "ramp_down"))
  432. # Plots
  433. rover_sl_plot <- ggplot(data = data3 %>% filter(metric == "Stride_Length"),aes(x = Condition, y = mean, color = SubjectID, shape = SubjectID, fill = SubjectID, group = SubjectID))+
  434. geom_point(position = position_dodge2(width = 0.25), size = 1) +
  435. geom_errorbar(aes(ymin = mean - se, ymax = mean + se),position = position_dodge2(width = 0.25),width = 0.25, linewidth = 0.25, show.legend = FALSE) +
  436. geom_path(position = position_dodge2(width = 0.25), show.legend = FALSE, linewidth = 0.25) +
  437. scale_color_manual(name = "",
  438. labels = c("Patient 2","Patient 3", "Patient 4"),
  439. values = c("#FAA41D","#ED2790","#6BBD46"))+
  440. scale_fill_manual(name = "",
  441. labels = c("Patient 2", "Patient 3", "Patient 4"),
  442. values = c("#FAA41D","#ED2790","#6BBD46"))+
  443. scale_shape_manual(name = "",
  444. labels = c("Patient 2", "Patient 3", "Patient 4"),
  445. values = c(22,23,24))+
  446. scale_x_discrete(labels = c("C" = "cDBS", "RU" = "RU-aDBS", "RD" = "RD-aDBS")) +
  447. theme_bw(base_size = 5) +
  448. xlab("") +
  449. ylab("meters") +
  450. ggtitle("Stride Length") +
  451. theme_bw(base_size = 5)+
  452. theme(plot.title = element_text(hjust = 0.5,size = 8),
  453. axis.title.x = element_blank(),
  454. axis.title.y = element_text(size = 6),
  455. axis.text.x = element_text(size = 6),
  456. legend.key.size = unit(0.5,"line"),
  457. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  458. panel.grid = element_blank(),
  459. panel.border = element_blank(),
  460. panel.spacing = unit(0.25, "lines"),
  461. axis.line.x = element_line(linetype = "solid", colour = "black"),
  462. axis.line.y = element_line(linetype = "solid", colour = "black"))
  463. rover_ws_plot <- ggplot(data = data3 %>% filter(metric == "Walking_Speed"),aes(x = Condition, y = mean, color = SubjectID, shape = SubjectID, fill = SubjectID, group = SubjectID))+
  464. geom_point(position = position_dodge2(width = 0.25), size = 1) +
  465. geom_errorbar(aes(ymin = mean - se, ymax = mean + se),position = position_dodge2(width = 0.25),width = 0.25, linewidth = 0.25, show.legend = FALSE) +
  466. geom_path(position = position_dodge2(width = 0.25), show.legend = FALSE, linewidth = 0.25) +
  467. scale_color_manual(name = "",
  468. labels = c("Patient 2","Patient 3", "Patient 4"),
  469. values = c("#FAA41D","#ED2790","#6BBD46"))+
  470. scale_fill_manual(name = "",
  471. labels = c("Patient 2", "Patient 3", "Patient 4"),
  472. values = c("#FAA41D","#ED2790","#6BBD46"))+
  473. scale_shape_manual(name = "",
  474. labels = c("Patient 2", "Patient 3", "Patient 4"),
  475. values = c(22,23,24))+
  476. scale_x_discrete(labels = c("C" = "cDBS", "RU" = "RU-aDBS", "RD" = "RD-aDBS")) +
  477. theme_bw(base_size = 5) +
  478. xlab("") +
  479. ylab("meters/second") +
  480. ggtitle("Walking Speed") +
  481. theme_bw(base_size = 5)+
  482. theme(plot.title = element_text(hjust = 0.5,size = 8),
  483. axis.title.x = element_blank(),
  484. axis.title.y = element_text(size = 6),
  485. axis.text.x = element_text(size = 6),
  486. legend.key.size = unit(0.5,"line"),
  487. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  488. panel.grid = element_blank(),
  489. panel.border = element_blank(),
  490. panel.spacing = unit(0.25, "lines"),
  491. axis.line.x = element_line(linetype = "solid", colour = "black"),
  492. axis.line.y = element_line(linetype = "solid", colour = "black"))
  493. rover_c_plot <- ggplot(data = data3 %>% filter(metric == "Cadence"),aes(x = Condition, y = mean, color = SubjectID, shape = SubjectID, fill = SubjectID, group = SubjectID))+
  494. geom_point(position = position_dodge2(width = 0.25), size = 1) +
  495. geom_errorbar(aes(ymin = mean - se, ymax = mean + se),position = position_dodge2(width = 0.25),width = 0.25, linewidth = 0.25, show.legend = FALSE) +
  496. geom_path(position = position_dodge2(width = 0.25), show.legend = FALSE, linewidth = 0.25) +
  497. geom_signif(data = data.frame(SubjectID = c("P2"),
  498. start = c("C"),
  499. end = c("RD"),
  500. y = c(118),
  501. label = c("")),
  502. aes(y_position = y,xmin = start,xmax = end,annotations = label), color = "#FAA41D", size = 0.25, textsize = 2, vjust = 0.5,tip_length = 0, manual = TRUE)+
  503. scale_color_manual(name = "",
  504. labels = c("Patient 2","Patient 3", "Patient 4"),
  505. values = c("#FAA41D","#ED2790","#6BBD46"))+
  506. scale_fill_manual(name = "",
  507. labels = c("Patient 2", "Patient 3", "Patient 4"),
  508. values = c("#FAA41D","#ED2790","#6BBD46"))+
  509. scale_shape_manual(name = "",
  510. labels = c("Patient 2", "Patient 3", "Patient 4"),
  511. values = c(22,23,24))+
  512. scale_x_discrete(labels = c("C" = "cDBS", "RU" = "RU-aDBS", "RD" = "RD-aDBS")) +
  513. theme_bw(base_size = 5) +
  514. xlab("") +
  515. ylab("steps/min") +
  516. ggtitle("Cadence") +
  517. theme_bw(base_size = 5)+
  518. theme(plot.title = element_text(hjust = 0.5,size = 8),
  519. axis.title.x = element_blank(),
  520. axis.title.y = element_text(size = 6),
  521. axis.text.x = element_text(size = 6),
  522. legend.key.size = unit(0.5,"line"),
  523. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  524. panel.grid = element_blank(),
  525. panel.border = element_blank(),
  526. panel.spacing = unit(0.25, "lines"),
  527. axis.line.x = element_line(linetype = "solid", colour = "black"),
  528. axis.line.y = element_line(linetype = "solid", colour = "black"))
  529. rover_symm_plot <- ggplot(data = data3 %>% filter(metric == "Symmetry"),aes(x = Condition, y = mean, color = SubjectID, shape = SubjectID, fill = SubjectID, group = SubjectID))+
  530. geom_point(position = position_dodge2(width = 0.25), size = 1) +
  531. geom_errorbar(aes(ymin = mean - se, ymax = mean + se),position = position_dodge2(width = 0.25),width = 0.25, linewidth = 0.25, show.legend = FALSE) +
  532. geom_path(position = position_dodge2(width = 0.25), show.legend = FALSE, linewidth = 0.25) +
  533. scale_color_manual(name = "",
  534. labels = c("Patient 2","Patient 3", "Patient 4"),
  535. values = c("#FAA41D","#ED2790","#6BBD46"))+
  536. scale_fill_manual(name = "",
  537. labels = c("Patient 2", "Patient 3", "Patient 4"),
  538. values = c("#FAA41D","#ED2790","#6BBD46"))+
  539. scale_shape_manual(name = "",
  540. labels = c("Patient 2", "Patient 3", "Patient 4"),
  541. values = c(22,23,24))+
  542. scale_x_discrete(labels = c("C" = "cDBS", "RU" = "RU-aDBS", "RD" = "RD-aDBS")) +
  543. theme_bw(base_size = 5) +
  544. xlab("") +
  545. ylab("Absolute Asymmetry") +
  546. ggtitle("Step Length Symmetry") +
  547. theme_bw(base_size = 5)+
  548. theme(plot.title = element_text(hjust = 0.5,size = 8),
  549. axis.title.x = element_blank(),
  550. axis.title.y = element_text(size = 6),
  551. axis.text.x = element_text(size = 6),
  552. legend.key.size = unit(0.5,"line"),
  553. legend.text = element_text(size = 5,margin = margin(0,0,0,0)),
  554. panel.grid = element_blank(),
  555. panel.border = element_blank(),
  556. panel.spacing = unit(0.25, "lines"),
  557. axis.line.x = element_line(linetype = "solid", colour = "black"),
  558. axis.line.y = element_line(linetype = "solid", colour = "black"))
  559. rover_plot_titles <- ggplot() + ggtitle("Home-monitoring Gait Metrics") + theme(plot.title = element_text(hjust = 0.5,size = 8))
  560. common_rover_legend <- get_plot_component(rover_sl_plot +
  561. guides(color = guide_legend(nrow = 1,ncol = 3)) +
  562. theme(legend.position = "bottom"),
  563. 'guide-box-bottom',return_all = TRUE)
  564. combined_rover_metrics <- plot_grid(rover_sl_plot + theme(legend.position = "none"),NULL,rover_symm_plot + theme(legend.position = "none"),
  565. NULL,NULL,NULL,
  566. rover_c_plot + theme(legend.position = "none"),NULL,rover_ws_plot + theme(legend.position = "none"),
  567. ncol = 3,
  568. nrow = 3,
  569. rel_heights = c(1,0.02,1),
  570. rel_widths = c(1,0.02,1))
  571. combined_rover_plots <- plot_grid(combined_rover_metrics,common_rover_legend,
  572. ncol = 1,
  573. nrow = 2,
  574. rel_heights = c(1,0.05))
  575. rover_plots_with_title <- plot_grid(rover_plot_titles,combined_rover_metrics,
  576. nrow = 2,
  577. rel_heights = c(0.05,1))
  578. ##### Post-motor Diary #####
  579. # Load data
  580. motor_diary_data <- read.csv('Figure5AB.csv') %>%
  581. mutate(Rigidity = as.factor(case_when(str_detect(Rigidity,"Better") ~ "Better",str_detect(Rigidity,"same") ~ "Same",str_detect(Rigidity,"Worse") ~ "Worse")),
  582. Tremor = as.factor(case_when(str_detect(Tremor,"Better") ~ "Better",str_detect(Tremor,"same") ~ "Same",str_detect(Tremor,"Worse") ~ "Worse")),
  583. Dyskinesia = as.factor(case_when(str_detect(Dyskinesia,"Better") ~ "Better",str_detect(Dyskinesia,"same") ~ "Same",str_detect(Dyskinesia,"Worse") ~ "Worse")),
  584. NumFall = factor(NumFall,levels = c("0","1","2-4","5+")),
  585. NumFreeze = factor(NumFreeze, levels = c("0","1","2-4","5+")))
  586. aggregate_md_data <- motor_diary_data %>% filter(Setting != "") %>%
  587. group_by(SubjectID,Setting) %>%
  588. pivot_longer(cols = c(3:7), names_to = "columns", values_to = "value") %>%
  589. count(columns, value) %>%
  590. mutate(columns = as.factor(columns),
  591. Setting = factor(case_when(str_detect(Setting,"Clinical") ~ "cDBS",str_detect(Setting,"ramp-up") ~ "RU-aDBS",str_detect(Setting,"ramp-down") ~ "RD-aDBS"),levels = c("cDBS","RU-aDBS","RD-aDBS")))
  592. filt_motor_diary_data <-motor_diary_data %>% filter(Setting != "") %>%
  593. mutate(Setting = factor(case_when(str_detect(Setting,"Clinical") ~ "cDBS",str_detect(Setting,"ramp-up") ~ "RU-aDBS",str_detect(Setting,"ramp-down") ~ "RD-aDBS"),levels = c("cDBS","RU-aDBS","RD-aDBS")))
  594. # Plots
  595. cardinal_symptom_plot <- ggplot(aggregate_md_data %>% filter(columns %in% c("Rigidity", "Tremor", "Dyskinesia")),
  596. aes(x = Setting, y = n, fill = value)) +
  597. geom_bar(position="stack", stat="identity",width = 0.75) +
  598. scale_fill_manual(name = "Rating:",
  599. # labels = c("Better","Same","Worse"),
  600. values = c("#1670B9","#4FA747","#BF2026")) +
  601. ylab("Count") +
  602. facet_grid(SubjectID ~ columns, switch = "y", labeller = labeller(SubjectID = c("P2" = "Patient 2","P3" = "Patient 3","P4" = "Patient 4"), columns = c("Dyskinesia" = "Dyskinesia","Rigidity" = "Patient-reported\nStiffness","Tremor" = "Tremor"))) +
  603. theme_bw(base_size = 5)+
  604. theme(plot.title = element_text(hjust = 0.5,size = 6),
  605. axis.title.x = element_blank(),
  606. axis.text.x = element_text(size = 5),
  607. axis.title.y = element_text(vjust = 0),
  608. legend.key.size = unit(0.5,"line"),
  609. legend.position = "bottom",
  610. strip.background = element_blank(),
  611. strip.text = element_text(size = 8),
  612. strip.text.y = element_blank(),
  613. panel.grid = element_blank(),
  614. panel.border = element_blank(),
  615. panel.spacing = unit(0.25, "lines"),
  616. axis.line.x = element_line(linetype = "solid", colour = "black"),
  617. axis.line.y = element_line(linetype = "solid", colour = "black"))
  618. fall_freeze_plot <- ggplot(aggregate_md_data %>% filter(columns %in% c("NumFall", "NumFreeze")) %>% mutate(value = factor(value,levels = c("5+","2-4","1","0"))),
  619. aes(x = Setting, y = n, fill = value)) +
  620. geom_bar(position="stack", stat="identity", width = 0.75) +
  621. scale_fill_manual(name = "Amount:",
  622. labels = c("5+","2-4", "1","0"),
  623. values = c("#BF2026","#F7921E","#4FA747","#1670B9")) +
  624. facet_grid(SubjectID~columns, switch = "y", labeller = labeller(columns = c("NumFall" = "Number of Falls","NumFreeze" = "Number of Freezes"),SubjectID = c("P2" = "Patient 2","P3" = "Patient 3","P4" = "Patient 4"))) +
  625. theme_bw(base_size = 5) +
  626. theme(plot.title = element_text(hjust = 0.5,size = 6),
  627. axis.title.x = element_blank(),
  628. axis.text.x = element_text(size = 5),
  629. axis.title.y = element_text(vjust = -8),
  630. legend.key.size = unit(0.5,"line"),
  631. legend.position = "bottom",
  632. strip.background = element_blank(),
  633. strip.text = element_text(size = 8),
  634. strip.placement = "outside",
  635. strip.text.y.left = element_text(size = 5,vjust=5),
  636. strip.clip = "off",
  637. panel.grid = element_blank(),
  638. panel.border = element_blank(),
  639. panel.spacing = unit(0.25, "lines"),
  640. axis.line.x = element_line(linetype = "solid", colour = "black"),
  641. axis.line.y = element_line(linetype = "solid", colour = "black"))
  642. combined_md_plots <- plot_grid(fall_freeze_plot,NULL,cardinal_symptom_plot,
  643. ncol = 3,
  644. rel_widths = c(1,0.01,1.25))
  645. ##### Combine all plots #####
  646. clinic_and_rover_gait_metrics <- plot_grid(rover_plots_with_title,NULL,combined_clinic_var_metrics_with_title,
  647. ncol = 3,
  648. rel_widths = c(1,0.05,1))
  649. clinic_and_rover_gait_metrics_w_legend <- plot_grid(clinic_and_rover_gait_metrics,
  650. common_cv_legend,
  651. nrow = 2,
  652. rel_heights = c(1,0.05))
  653. paper_figure <- plot_grid(combined_md_plots,NULL,clinic_and_rover_gait_metrics_w_legend,
  654. nrow = 3,
  655. rel_heights = c(0.75,0.05,1))

double_blind_aDBS_in-clinic_gait_metrics_rover_summary_motor_diary_plots.R at commit 278fdb5, no license · at the source

Overview

Authors: Kenneth H Louie1, Jannine P Balakid1, Jessica E Bath1,2, Seongmi Song1, Hamid Fekri Azgomi1, Jacob H Marks1, Julia T Choi3, Philip A Starr1,4,5, Doris D Wang1,4,5
  1. Department of Neurological Surgery, University California, San Francisco, San Francisco, CA USA
  2. Department of Physical Therapy and Rehabilitation Sciences, University of California, San Francisco, San Francisco, CA USA
  3. Department of Applied Physiology & Kinesiology, University of Florida, Gainesville, FL USA
  4. Graduate Program in Bioengineering, University of California, Berkeley and University of California, San Francisco, San Francisco, CA USA
  5. Weill Institute for Neurosciences, University of California, San Francisco, San Francisco, CA USA
Institutions: University of California, San Francisco (United States); University of Florida (United States); University of California, Berkeley (United States)
Journal: Nature medicine, volume 32, issue 8, pages 2803-2814
Dates: received 6 September 2025; accepted 29 April 2026; published online 15 June 2026; in print 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41591-026-04434-2 · PMID 42297980 · PMCID PMC13473014 · OpenAlex W7164815873
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), Parkinson's (population), clinical / translational (subfield)
Methods: Spectral & time-frequency, Statistics
Keywords: Translational research, Parkinson's disease, Biomarkers, Biomedical engineering
MeSH: Deep Brain Stimulation*, Gait*, Parkinson Disease*, Aged, Cross-Over Studies, Feasibility Studies, Female, Humans, Male, Middle Aged (* major topic)
Topic: Neurological disorders and treatments (Neurology, Medicine), according to OpenAlex
Funding: U.S. Department of Health & Human Services | NIH | National Institute of Neurological Disorders and Stroke (NINDS) (1R01NS130183, U24 NS113637); U.S. Department of Health &amp; Human Services | NIH | National Institute of Neurological Disorders and Stroke (1R01NS130183, U24 NS113637); NINDS NIH HHS (U24 NS113637, R01 NS130183); Michael J. Fox Foundation for Parkinson's Research (MNS135499A); UCSF Burroughs Wellcome Fund Career Award for Medical Scientist; UCSF Catalyst Grants
Citations: cited by 4 papers (Europe PMC); 94 references in the paper

Abstract

A randomized crossover study of five patients with Parkinson’s disease (PD) demonstrates that gait-synchronized adaptive deep brain stimulation is feasible and safe, and reduces falls compared with continuous stimulation. Gait dysfunction in PD is a major source of disability and is often insufficiently treated by continuous deep brain stimulation (cDBS). Although adaptive DBS (aDBS) has shown efficacy for other motor symptoms using β-based, state-driven neural signals, gait is a dynamic, cyclical behavior that may require temporally precise modulation. Here we evaluated a behavior-contingent aDBS approach that synchronizes stimulation to gait phase. We reported a single-center, blinded, randomized, crossover study evaluating the feasibility of identifying patient-specific biomarkers to drive aDBS. The primary outcome was feasibility of successful identification of gait-phase biomarkers to implement aDBS. Five participants with PD undergoing pallidal DBS and subdural electrode paddle implantation were enrolled. We successfully identified personalized gait-phase biomarkers from cortical or pallidal field potentials in all five patients and embedded them into a bidirectional neurostimulator. During acute in-clinic testing, aDBS improved step variability and step symmetry versus cDBS. Three participants subsequently completed a double-blinded, multi-day crossover phase. In this setting, aDBS maintained general motor symptom control, reduced falls and yielded patient-specific gait improvements. No adverse events occurred and aDBS was well tolerated. These findings establish the feasibility of biomarker-driven, movement-synchronized neuromodulation and support the development of a larger randomized trial to determine clinical efficacy. ClinicalTrial.gov registration: NCT04675398.

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 18 matches between paragraphs and lines of code.

openmind-consortium/Analysis-rcs-data

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: e04baae07f56f73d265daa1d0f1b887607930dd2, 22 January 2026
Languages: MATLAB (129), C (21), C/C++ (5), C++ (1)
Size: 265 files, 156 scripts
Software Heritage: not archived
Found in: the text, “Data acquisition”
Holds: README, tests, documentation
Not found: license file, CITATION.cff, environment file, continuous integration
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
157 files

Weill-Neurohub-OPTiMaL/rcs-simulation

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 0b73d44d0518976be3244db4ff3a0f6e91687476, 15 March 2025
Languages: MATLAB (4), Jupyter (3), Python (3)
Size: 14 files, 10 scripts
Software Heritage: not archived
Found in: the text, “Data analysis”
Holds: README, license file, environment (requirements.txt, setup.py), 3 notebooks
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (5 files), pandas (5 files), Matplotlib (4 files), SciPy (3 files), scikit-learn (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
12 files

UCSF-wang-lab/gp-FaDBS

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 278fdb51146e11339537a0d592f9d0e7269eecb3, 16 June 2026
Languages: MATLAB (11), R (10)
Size: 23 files, 21 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (10 files), cowplot (7 files), rstatix (4 files), lmerTest (3 files), emmeans (2 files), Signal Processing Toolbox (2 files), ggplot2 (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
22 files

openmind-consortium.github.io

License: none: the authors keep all their rights
State: the link is dead, verified on 27 September 2026
Evidence: found in the paper
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link is dead (HTTP 404)
  • 27 September 2026: the link is dead (HTTP 404)

Code availability

Except for the biomarker identification code, all MATLAB, Python and R analysis code used to analyze and generate the main findings of this study will be made available at https://github.com/UCSF-wang-lab/gp-FaDBS within 1 month of publication. The biomarker identification code will be made available after subsequent manuscripts that use this code have been published. Code written to interface with and process raw data from the Medtronic Summit RC + S is available in the OpenMind public GitHub repository (https://openmind-consortium.github.io).

Reproduced under the paper's license (CC BY), from the paper cited above.

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:

  • 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 187 scripts, each with its path and the digest of its content;
  • 18 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

Due to the inclusion of identifiable clinical and neurophysiological data from human participants, the data were subject to controlled access to protect participant privacy and comply with institutional and regulatory requirements. Requests for access should be directed to the corresponding author and will be reviewed within a reasonable timeframe (typically within 2–4 weeks), contingent on institutional approvals and data use agreements that restrict re-identification and redistribution. Requests will be reviewed based on scientific merit, ethical review and available resources. Following approved requests, de-identified individual patient data will be made available for reuse. The data used to generate the figures in this paper are available at https://dabi.loni.usc.edu/projects/F3RE38A785JW.

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 2, 28 September 2026

  • Publisher: n/a → Nature Portfolio

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 9 authors, 4 keywords, 10 MeSH terms, 5 funders, 91 references.

Cite

This paper

Louie, K. H., Balakid, J. P., Bath, J. E., Song, S., Fekri Azgomi, H., Marks, J. H., Choi, J. T., Starr, P. A., & Wang, D. D. (2026). Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial. Nature medicine, 32(8), 2803-2814. https://doi.org/10.1038/s41591-026-04434-2

BibTeX

@article{louie2026adaptive,
author = {Louie, Kenneth H and Balakid, Jannine P and Bath, Jessica E and Song, Seongmi and Fekri Azgomi, Hamid and Marks, Jacob H and Choi, Julia T and Starr, Philip A and Wang, Doris D},
title = {{Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial}},
journal = {Nature medicine},
year = {2026},
month = jun,
volume = {32},
number = {8},
pages = {2803--2814},
publisher = {Nature Portfolio},
issn = {1078-8956},
doi = {10.1038/s41591-026-04434-2},
url = {https://doi.org/10.1038/s41591-026-04434-2},
pmid = {42297980},
pmcid = {PMC13473014}
}

RIS

TY - JOUR
AU - Louie, Kenneth H
AU - Balakid, Jannine P
AU - Bath, Jessica E
AU - Song, Seongmi
AU - Fekri Azgomi, Hamid
AU - Marks, Jacob H
AU - Choi, Julia T
AU - Starr, Philip A
AU - Wang, Doris D
TI - Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial
T2 - Nature medicine
J2 - Nat Med
PY - 2026
DA - 2026/06/15
VL - 32
IS - 8
SP - 2803
EP - 2814
SN - 1078-8956
PB - Nature Portfolio
DO - 10.1038/s41591-026-04434-2
UR - https://doi.org/10.1038/s41591-026-04434-2
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41591-026-04434-2",
"type": "article-journal",
"title": "Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial",
"container-title": "Nature medicine",
"author": [
{
"family": "Louie",
"given": "Kenneth H"
},
{
"family": "Balakid",
"given": "Jannine P"
},
{
"family": "Bath",
"given": "Jessica E"
},
{
"family": "Song",
"given": "Seongmi"
},
{
"family": "Fekri Azgomi",
"given": "Hamid"
},
{
"family": "Marks",
"given": "Jacob H"
},
{
"family": "Choi",
"given": "Julia T"
},
{
"family": "Starr",
"given": "Philip A"
},
{
"family": "Wang",
"given": "Doris D"
}
],
"container-title-short": "Nat Med",
"volume": "32",
"issue": "8",
"page": "2803-2814",
"DOI": "10.1038/s41591-026-04434-2",
"PMID": "42297980",
"PMCID": "PMC13473014",
"ISSN": "1078-8956",
"publisher": "Nature Portfolio",
"URL": "https://doi.org/10.1038/s41591-026-04434-2",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
15
]
]
}
}

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/s41591-026-04432-4 [code]
Activity-dependent adaptive deep brain stimulation improves gait in Parkinson's disease.
Journal: Nature medicine
In common: scikit-learn, SciPy, Matplotlib, 1 other tool, Parkinson's, clinical / translational, 10 references
[2] doi:10.1093/brain/awaf466 [code]
Cortico-basal oscillations index naturalistic movements during deep brain stimulation.
Journal: Brain : a journal of neurology
In common: Parkinson's, 12 references
[3] doi:10.1016/j.ebiom.2026.106293 [code]
Dynamic neural states underpin motor symptom severity in Parkinson's disease: a longitudinal analysis of chronic cortico-subthalamic nucleus recordings.
Journal: EBioMedicine
In common: pandas, SciPy, Matplotlib, 1 other tool, Parkinson's, 10 references
[4] doi:10.1038/s44172-026-00688-3
N2G calibrator: a cross-subject adversarial learning framework for neural signal-driven gait tracking in Parkinson's disease.
Journal: Communications engineering
In common: Parkinson's, 10 references
[5] doi:10.1038/s41593-026-02228-w [code]
Circuit response to neuromodulation characterized with simultaneous deep brain stimulation and precision neuroimaging in humans.
Journal: Nature neuroscience
In common: rstatix, emmeans, lmerTest, 7 other tools, Parkinson's, 2 references
[6] doi:10.1093/braincomms/fcag245 [code]
Reduced pre-movement subthalamic beta desynchronization marks motor deficit in Parkinson's disease.
Journal: Brain communications
In common: Signal Processing Toolbox, Statistics and Machine Learning Toolbox, Parkinson's, 7 references
[7] doi:10.1038/s41531-026-01421-9 [code]
Cortico-pallidal beta dynamics underlie impaired turning in Parkinson's disease.
Journal: NPJ Parkinson's disease
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, Parkinson's, 6 references
[8] doi:10.1038/s41531-026-01439-z [code]
DBSsync: combining intracranial and multimodal data to investigate new biomarkers in Parkinson's disease.
Journal: NPJ Parkinson's disease
In common: Signal Processing Toolbox, Statistics and Machine Learning Toolbox, pandas, 3 other tools, Parkinson's, clinical / translational, 4 references
[9] doi:10.1016/j.nicl.2026.104012 [code]
Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.
Journal: NeuroImage. Clinical
In common: rstatix, lmerTest, Image Processing Toolbox, 9 other tools
[10] 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 reports
In common: rstatix, emmeans, lmerTest, 8 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.