OSCR

Unperturbed dye-based imaging of spontaneous synchronized calcium activity in iPSC-derived neuronal cultures.

Code ↔ Paper

2 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 2 matches
  1. [1] § STAR★Methods › Method details › Analysis of Ca2+ traces ↔ NeuroConnectivity_Func_v01.R, lines 1–39 · score 0.84 · De Vos Lab, NeuroConnectivity, func, modified, intensity, peaks
  2. [2] § STAR★Methods › Method details › Analysis of Ca2+ traces ↔ NeuroConnectivity_Profiling_v01.R, lines 1–36 · score 0.80 · De Vos Lab, NeuroConnectivity, modified, func

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 · 592 lines · 27 KB · CC-BY-NC-SA-4.0 · 1 match

  1. # ------------------------------------------------------------------------------
  2. # NeuroConnectivity - Functional calcium analysis
  3. #
  4. # Author: Winnok H. De Vos
  5. # Modified by: Marlies Verschuuren
  6. # Creation date: 2019-12-13
  7. # Last Modified: 2023-12-20
  8. # ------------------------------------------------------------------------------
  9. #--1. User settings-------------------------------------------------------------
  10. #----1.1. Select directories----------------------------------------------------
  11. # Input: Folder with structure: Rep > Plate > Func > Output
  12. # Rep > Plate > PlateLayout.txt
  13. dir.input="/Users/marliesverschuuren/Documents/UA_DataSets/NeuroConnectivity/PLA/Data"
  14. dir.output="/Users/marliesverschuuren/Library/CloudStorage/OneDrive-UniversiteitAntwerpen/Projects/DeVosLab/NeuroConnectivity/Results_PLA"
  15. #----1.2. Settings analysis------------------------------------------------------
  16. interval = 0.5 # (500 ms)
  17. ctrl.condition="B27_NA_NA" #Condition_Treatment_Concentration
  18. peakheight=1.05 #Height normalised peak (1.05 = 5% increase from median intensity)
  19. peakdistance=5 #Number of frames peak
  20. activePeakNr=5 #Number of peaks to be considered active
  21. #--2. Packages and Settings-----------------------------------------------------
  22. #----2.1. Packages--------------------------------------------------------------
  23. if (!require("tidyverse")) {install.packages("tidyverse"); require("tidyverse")}
  24. if (!require("data.table")) {install.packages("data.table"); require("data.table")}
  25. if (!require("RColorBrewer")) {install.packages("RColorBrewer"); require("RColorBrewer")} #Function: brewer.pal
  26. if (!require("plyr")) {install.packages("plyr"); require("plyr")} #Function: ddply >> Not compatible with dplyr >> Specify dplyr functions
  27. if (!require("gridExtra")) {install.packages("gridExtra"); require("gridExtra")} #Function: marrangegrob
  28. if (!require("pracma")) {install.packages("pracma"); require("pracma")} #Find peaks
  29. if (!require("doParallel")) {install.packages("doParallel"); require("doParallel")} #Parallel computing on multiple cores
  30. #----2.2. Create result directories---------------------------------------------
  31. dir.plot=file.path(dir.output, "Neuro_Func_Plots")
  32. dir.create(dir.plot, showWarnings = FALSE)
  33. dir.mergedData=file.path(dir.output, "Neuro_Func_MergedData")
  34. dir.create(dir.mergedData, showWarnings = FALSE)
  35. #----2.3. Functions-------------------------------------------------------------
  36. # bleach correction (requires index x, intensity y)
  37. bleachcorrect = function(x, y){
  38. params = c()
  39. it = 0
  40. model = NULL
  41. while(TRUE & it<=1)
  42. {
  43. # try exp fit
  44. try(model<-nls(y ~ SSasymp(x, yf, y0, log_alpha)), silent = T)
  45. it = it + 1
  46. }
  47. if(is.null(model))
  48. {
  49. # if exp fit doesn't work, lin fit
  50. model = lm(y ~ x)
  51. p = summary(model)$coefficients[2,4]
  52. }else p=0
  53. if(p<0.05){ # fit needs to have a significant slope coeff
  54. y_bleach = predict(model)
  55. y_corr = y/y_bleach*mean(y,na.rm=T)
  56. }else y_corr=y # no correction applied
  57. }
  58. # normalization functions
  59. norm.fun = function(x) x/median(x, na.rm=T) # divide by the median of the time trace
  60. #--3. Read Func Data ----------------------------------------------------------------
  61. data.roi = data.frame()
  62. folders.rep=list.files(path=file.path(dir.input))
  63. data.list=list()
  64. i=1
  65. #Loop over all rep folders
  66. for (rep in folders.rep){
  67. folders.plate=list.files(path=file.path(dir.input,rep))
  68. #Loop over all Plate folders in Rep folder
  69. for (plate in folders.plate){
  70. data.plate = data.frame()
  71. files = list.files(path = file.path(dir.input,rep,plate,"Func","Output"), pattern = "results", full.names = TRUE)
  72. expr="_[A-Z][0-9]{2}_" #### ADAPT IF NEEDED
  73. #Check regexpr:
  74. #File=files[1]
  75. #str_extract(File,expr)
  76. #Read plate
  77. data.plate = tibble(File = files) %>%
  78. dplyr::mutate(data = lapply(File, fread)) %>%
  79. unnest(data)%>%
  80. dplyr::mutate(Rep=rep,
  81. Plate=plate,
  82. File=File,
  83. Image=substring(str_extract(File,"Output/.+"),8,nchar(str_extract(File,"Output/.+"))-12),
  84. Well=substring(str_extract(File,expr),2,4)) %>% #### ADAPT IF NEEDED
  85. gather(ROI_Image,Mean,-Rep,-Plate,-File,-Image,-Well,-V1)
  86. #Omit missing data
  87. data.plate = na.omit(data.plate)
  88. #Change variable names
  89. data.plate$ROI_Image=as.factor(substring( data.plate$ROI_Image,5,nchar(data.plate$ROI_Image)))
  90. names(data.plate)[which(names(data.plate)=="V1")]="Frame"
  91. #Add image index and roi index within well
  92. data.plate=data.plate%>%
  93. dplyr::group_by(Rep,Plate,Well)%>%
  94. dplyr::mutate(ImageNr = cumsum(!duplicated(Image)),
  95. ROI_Well = cumsum(!duplicated(ROI_Image)))
  96. #Add 0 if well is defined in format B2
  97. data.plate$Well=ifelse(nchar(data.plate$Well)==2,paste(substring(data.plate$Well,1,1),"0",substring(data.plate$Well,2,2),sep=""),data.plate$Well)
  98. #Merge with plate layout
  99. layout=read.table(file.path(dir.input,rep,plate,"PlateLayout.txt"),header=TRUE, sep='\t', fill=TRUE)
  100. data.plate=data.plate%>%
  101. dplyr::left_join(layout)
  102. data.list[[i]]=data.plate
  103. i=i+1
  104. }
  105. }
  106. #Bind all replicates and plates, and assign roi index for whole data set
  107. data.roi=rbindlist(data.list)%>%
  108. as.data.frame()%>%
  109. dplyr::group_by(Rep,Plate,Well,ImageNr,ROI_Image)%>%
  110. dplyr::mutate(ROI_Data = cur_group_id())%>%
  111. dplyr::ungroup()
  112. #Specify time in seconds
  113. data.roi$Time = data.roi$Frame*interval
  114. #Change type variables
  115. data.roi$Rep = as.factor(data.roi$Rep)
  116. data.roi$Plate = as.factor(data.roi$Plate)
  117. data.roi$Well = as.factor(data.roi$Well)
  118. data.roi$ROI_Image = as.factor(data.roi$ROI_Image)
  119. data.roi$ROI_Image=factor(data.roi$ROI_Image, levels = sort(unique(as.numeric(data.roi$ROI_Image))))
  120. data.roi$ROI_Well = as.factor(data.roi$ROI_Well)
  121. data.roi$ROI_Well=factor(data.roi$ROI_Well, levels = sort(unique(as.numeric(data.roi$ROI_Well))))
  122. data.roi$ROI_Data = as.factor(data.roi$ROI_Data)
  123. data.roi$ROI_Data=factor(data.roi$ROI_Data, levels = sort(unique(as.numeric(data.roi$ROI_Data))))
  124. #--4. Plot Raw Data -------------------------------------------------------------
  125. data.temp=data.roi
  126. i=1
  127. plot_list = list()
  128. for(rep in unique(data.temp$Rep)){
  129. data.plot.rep=data.temp[data.temp$Rep==rep,]
  130. for(plate in unique(data.plot.rep$Plate)){
  131. data.plot.plate=data.plot.rep[data.plot.rep$Plate==plate,]
  132. for(well in unique(data.plot.plate$Well)){
  133. data.plot.well=data.plot.plate[data.plot.plate$Well==well,]
  134. for(image in unique(data.plot.well$Image)){
  135. data.plot=data.plot.well[data.plot.well$Image==image,]
  136. p=ggplot(data.plot,aes(Time, Mean, group = as.numeric(ROI_Image), colour = as.numeric(ROI_Image))) +
  137. geom_path() +
  138. scale_colour_viridis_c()+
  139. facet_wrap(ROI_Image~.) +
  140. theme_minimal()+
  141. ggtitle(paste(rep,plate,well,image,sep="_"))+
  142. theme(legend.position = "bottom")
  143. p
  144. plot_list[[i]] = p
  145. i=i+1
  146. }
  147. }
  148. }
  149. }
  150. ggsave(file=file.path(dir.plot,"Func_ROI_Raw.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  151. data.temp=data.roi
  152. i=1
  153. plot_list = list()
  154. for(rep in unique(data.temp$Rep)){
  155. data.plot.rep=data.temp[data.temp$Rep==rep,]
  156. for(plate in unique(data.plot.rep$Plate)){
  157. data.plot.plate=data.plot.rep[data.plot.rep$Plate==plate,]
  158. for(well in unique(data.plot.plate$Well)){
  159. data.plot=data.plot.plate[data.plot.plate$Well==well,]
  160. p=ggplot(data.plot,aes(Time, Mean, group = as.numeric(ROI_Image), colour = as.numeric(ROI_Image))) +
  161. geom_path() +
  162. facet_wrap(Image~.) +
  163. scale_colour_viridis_c()+
  164. theme_minimal()+
  165. ggtitle(paste(rep,plate,well,sep="_"))+
  166. theme(legend.position = "bottom")
  167. p
  168. plot_list[[i]] = p
  169. i=i+1
  170. }
  171. }
  172. }
  173. ggsave(file=file.path(dir.plot,"Func_Image_Raw.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  174. #--5. Bleach correction, normalisation and smoothing per ROI--------------------
  175. data.roi = ddply(data.roi, "ROI_Data", transform, corr.mean = bleachcorrect(Frame, Mean))
  176. data.roi = ddply(data.roi, "ROI_Data", transform, norm.mean = norm.fun(corr.mean))
  177. data.roi = ddply(data.roi, "ROI_Data", transform, smooth.mean = loess(norm.mean ~ Frame, span = 0.02)$fitted) # Very fine smoothing to blunt noise (enhances peak detection) - currently uses 2% points for smoothing
  178. #--6. Plot Normalised data -----------------------------------------------------
  179. data.temp=data.roi
  180. i=1
  181. plot_list = list()
  182. col=c("MeanInt"="black","CorrInt"="dodgerblue","NormInt"="firebrick","SmoothInt"="goldenrod")
  183. for(rep in unique(data.temp$Rep)){
  184. data.plot.rep=data.temp[data.temp$Rep==rep,]
  185. for(plate in unique(data.plot.rep$Plate)){
  186. data.plot.plate=data.plot.rep[data.plot.rep$Plate==plate,]
  187. for(well in unique(data.plot.plate$Well)){
  188. data.plot.well=data.plot.plate[data.plot.plate$Well==well,]
  189. for(image in unique(data.plot.well$Image)){
  190. data.plot=data.plot.well[data.plot.well$Image==image,]
  191. factorAxis=mean(data.plot$Mean)
  192. p=ggplot(data.plot,aes(group = as.numeric(ROI_Image))) +
  193. geom_path(aes(Time, Mean, color = "MeanInt"), linewidth=0.2) +
  194. geom_path(aes(Time, corr.mean, color="CorrInt"),linewidth=0.2) +
  195. geom_path(aes(Time, norm.mean * factorAxis, color="NormInt"),linewidth=0.2) +
  196. geom_path(aes(Time, smooth.mean * factorAxis, color="SmoothInt"),linewidth=0.2) +
  197. scale_color_manual(values = col)+
  198. scale_y_continuous(name = "MeanInt or CorrInt", sec.axis = sec_axis(~./factorAxis, name="NormInt or SmoothInt"))+
  199. facet_wrap(ROI_Image~.) +
  200. labs(color="Legend")+
  201. theme_minimal()+
  202. ggtitle(paste(rep,plate,well,image,sep="_"))+
  203. theme(legend.position = "bottom")
  204. p
  205. plot_list[[i]] = p
  206. i=i+1
  207. }
  208. }
  209. }
  210. }
  211. ggsave(file=file.path(dir.plot,"Func_ROI_Norm.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  212. #--7. Peak detection -----------------------------------------------------------
  213. #----7.1. Peak Detection ROI----------------------------------------------------
  214. data.roi.peak = data.frame()
  215. total.roi.nr = length(unique(data.roi$ROI_Data))
  216. #Define cores for parallel computing
  217. cores=detectCores()
  218. cl = makeCluster(cores[1]-1) #not to overload your computer
  219. registerDoParallel(cl)
  220. #Peak detection
  221. data.roi.peak = foreach(i=1:total.roi.nr, .combine=rbind) %dopar% {
  222. temp = data.roi[which(data.roi$ROI_Data == levels(data.roi$ROI_Data)[i]),]
  223. temp$duration = NA
  224. temp$interval = NA
  225. #findpeaks returns a matrix where each row represents one peak found. The first column gives the height, the second the position/index where the maximum is reached, the third and forth the indices of where the peak begins and ends
  226. peaks = as.data.frame(pracma::findpeaks(temp$smooth.mean, nups = 2, ndowns = 2, minpeakheight = peakheight, minpeakdistance=peakdistance))
  227. if(dim(peaks)[1]!=0){
  228. peaks=peaks[order(peaks$V2),]
  229. }
  230. peaks$duration = (peaks$V4 - peaks$V3) * interval # exact duration of detected wave in sec
  231. temp$peak = ifelse(temp$Frame%in%(peaks$V2),temp$smooth.mean,NA) # labels peak with smooth mean value
  232. temp$peak.start = ifelse(temp$Frame%in%(peaks$V3),temp$smooth.mean,NA) # labels peak with smooth mean value
  233. temp$peak.stop = ifelse(temp$Frame%in%(peaks$V4),temp$smooth.mean,NA) # labels peak with smooth mean value
  234. for (f in 1: dim(peaks)[1])
  235. {
  236. temp$duration[peaks$V4[f]] = peaks$duration[f]
  237. temp$interval[peaks$V2[f]] = ifelse(f==1, peaks$V2[f]* interval, (peaks$V2[f]-peaks$V2[f-1]) * interval )
  238. }
  239. temp #Equivalent to data.roi.peak = rbind(data.roi.peak, temp)
  240. }
  241. #stop cluster
  242. stopCluster(cl)
  243. #----7.2. Peak Detection Average Trace Image------------------------------------
  244. data.image=data.roi%>%
  245. dplyr::group_by(File,Frame,Rep,Plate,Well,Image,ImageNr,Condition,Treatment, Concentration,Time)%>%
  246. dplyr::summarise(norm.mean=mean(norm.mean,na.rm = TRUE),
  247. smooth.mean=mean(smooth.mean,na.rm = TRUE),
  248. Mean=mean(Mean,na.rm = TRUE))%>%
  249. dplyr::ungroup()%>%
  250. dplyr::mutate(Image_ID=paste(Rep,Plate,Well,ImageNr,sep="_")
  251. )
  252. data.image$Image_ID=as.factor(data.image$Image_ID)
  253. data.image.peak = data.frame()
  254. total.roi.nr = length(unique(data.image$Image_ID))
  255. #Define cores for parallel computing
  256. cores=detectCores()
  257. cl = makeCluster(cores[1]-1) #not to overload your computer
  258. registerDoParallel(cl)
  259. #Peak detection
  260. data.image.peak = foreach(i=1:total.roi.nr, .combine=rbind) %dopar% {
  261. temp = data.image[which(data.image$Image_ID == levels(data.image$Image_ID)[i]),]
  262. temp$duration = NA
  263. temp$interval = NA
  264. #findpeaks returns a matrix where each row represents one peak found. The first column gives the height, the second the position/index where the maximum is reached, the third and forth the indices of where the peak begins and ends
  265. peaks = as.data.frame(pracma::findpeaks(temp$smooth.mean, nups = 2, ndowns = 2, minpeakheight = peakheight, minpeakdistance=peakdistance))
  266. if(dim(peaks)[1]!=0){
  267. peaks=peaks[order(peaks$V2),]
  268. }
  269. peaks$duration = (peaks$V4 - peaks$V3) * interval # exact duration of detected wave in sec
  270. temp$peak = ifelse(temp$Frame%in%(peaks$V2),temp$smooth.mean,NA) # labels peak with smooth mean value
  271. temp$peak.start = ifelse(temp$Frame%in%(peaks$V3),temp$smooth.mean,NA) # labels peak with smooth mean value
  272. temp$peak.stop = ifelse(temp$Frame%in%(peaks$V4),temp$smooth.mean,NA) # labels peak with smooth mean value
  273. for (f in 1: dim(peaks)[1])
  274. {
  275. temp$duration[peaks$V4[f]] = peaks$duration[f]
  276. temp$interval[peaks$V2[f]] = ifelse(f==1, peaks$V2[f]* interval, (peaks$V2[f]-peaks$V2[f-1]) * interval )
  277. }
  278. temp #Equivalent to data.roi.peak = rbind(data.roi.peak, temp)
  279. }
  280. #stop cluster
  281. stopCluster(cl)
  282. #----7.3. Plot peaks -----------------------------------------------------------
  283. #Plot peaks per trace
  284. data.temp=data.roi.peak
  285. col=colorRampPalette(c("black","violetred3"))(20)
  286. i=1
  287. for(rep in unique(data.temp$Rep)){
  288. data.plot.rep=data.temp[data.temp$Rep==rep,]
  289. for(plate in unique(data.plot.rep$Plate)){
  290. data.plot.plate=data.plot.rep[data.plot.rep$Plate==plate,]
  291. for(well in unique(data.plot.plate$Well)){
  292. data.plot.well=data.plot.plate[data.plot.plate$Well==well,]
  293. for(image in unique(data.plot.well$Image)){
  294. data.plot=data.plot.well[data.plot.well$Image==image,]
  295. p=ggplot(data.plot) +
  296. geom_path(aes(Time,smooth.mean),color = "black", linewidth=0.5) +
  297. geom_point(aes(Time,peak), color="red", size=0.5)+
  298. geom_point(aes(Time,peak.start), color="orange", size=0.5)+
  299. facet_wrap(~ROI_Image) +
  300. ggtitle(paste(rep,plate,well,image,sep="_"))+
  301. theme_minimal() +
  302. theme(legend.position = "none")
  303. p
  304. plot_list[[i]] = p
  305. i=i+1
  306. }
  307. }
  308. }
  309. }
  310. ggsave(file=file.path(dir.plot,"Func_ROI_Peak.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  311. #Plot peaks on average trace per image
  312. data.temp=data.image.peak
  313. col=colorRampPalette(c("black","violetred3"))(20)
  314. i=1
  315. for(rep in unique(data.temp$Rep)){
  316. data.plot.rep=data.temp[data.temp$Rep==rep,]
  317. for(plate in unique(data.plot.rep$Plate)){
  318. data.plot.plate=data.plot.rep[data.plot.rep$Plate==plate,]
  319. for(well in unique(data.plot.plate$Well)){
  320. data.plot=data.plot.plate[data.plot.plate$Well==well,]
  321. p=ggplot(data.plot) +
  322. geom_path(aes(Time,smooth.mean),color = "black", linewidth=0.5) +
  323. geom_point(aes(Time,peak), color="red", size=0.5)+
  324. geom_point(aes(Time,peak.start), color="orange", size=0.5)+
  325. facet_wrap(.~Image,scales = "free_y") +
  326. ggtitle(paste(rep,plate,well,sep="_"))+
  327. theme_minimal() +
  328. theme(legend.position = "none")
  329. p
  330. plot_list[[i]] = p
  331. i=i+1
  332. }
  333. }
  334. }
  335. ggsave(file=file.path(dir.plot,"Func_Image_AvTrace_Peak.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  336. # Plot peaks per well in a tile plot
  337. data.temp=data.roi.peak
  338. i=1
  339. plot_list = list()
  340. for(rep in unique(data.temp$Rep)){
  341. data.plot.rep=data.temp[data.temp$Rep==rep,]
  342. for(plate in unique(data.plot.rep$Plate)){
  343. data.plot=data.plot.rep[data.plot.rep$Plate==plate,]
  344. p=ggplot(data.plot, aes(Time, as.factor(ROI_Well))) +
  345. geom_tile(data = subset(data.plot, peak>0), fill="black") +
  346. facet_wrap(Well~Image,scales = "free_y") +
  347. ggtitle(paste(rep,plate,sep="_"))+
  348. theme_minimal(base_size = 10) +
  349. theme(panel.grid.major = element_blank(),
  350. panel.grid.minor = element_blank(),
  351. axis.text.y=element_blank(),
  352. legend.position="none")
  353. p
  354. plot_list[[i]] = p
  355. i=i+1
  356. }
  357. }
  358. ggsave(file=file.path(dir.plot,"Func_ROI_Peak_WellTile.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  359. #--8. Activity stats -----------------------------------------------------------
  360. #----8.1. Image Data: Synchronicity between ROIs within an image --------------
  361. cor.data = data.frame()
  362. data.roi.peak$Image_ID=paste(data.roi.peak$Rep,data.roi.peak$Plate,data.roi.peak$Well,data.roi.peak$ImageNr,sep="_")
  363. data.roi.peak$Image_ID=as.factor(data.roi.peak$Image_ID)
  364. image.nr = length(unique(data.roi.peak$Image_ID))
  365. for (i in 1:image.nr){
  366. temp = data.roi.peak[which(data.roi.peak$Image_ID == levels(data.roi.peak$Image_ID)[i]),]
  367. df = as.data.frame(cbind(temp$norm.mean,temp$Time,temp$ROI_Data))
  368. names(df) = c("norm.mean","Time","ROI_Data")
  369. df.d = reshape2::dcast(data = df,formula = Time~ROI_Data, value.var = "norm.mean") # convert dataframe to matrix of ROIs (only retain the norm values per ROI as a function of time)
  370. df.matrix = as.matrix(df.d[, -1]) # remove time
  371. correlations = cor(df.matrix, use="pairwise.complete.obs")
  372. correlations = correlations[upper.tri(correlations, diag=F)] # only retain unique correlations
  373. synchronous.fraction = sum(correlations>0.7)/length(correlations)*100 # consider correlated neurons the ones with more than 70% correlation
  374. av.correlation = mean(correlations,na.rm=T)
  375. cor.data = rbind(cor.data,c(levels(data.roi.peak$Image_ID)[i],synchronous.fraction,av.correlation))
  376. }
  377. names(cor.data) = c("Image_ID","synchronous.fraction","av.correlation")
  378. cor.data$synchronous.fraction=as.numeric(cor.data$synchronous.fraction)
  379. cor.data$av.correlation=as.numeric(cor.data$av.correlation)
  380. #----8.2. Image Data: Global parameters per ROI -------------------------------
  381. features.roi = ddply(data.roi.peak, c("Rep","Plate","Well","Image","ImageNr","Image_ID","Condition","Treatment","Concentration","ROI_Data"), summarise,
  382. baseline.intensity = median(Mean),
  383. peak.nr = length(peak[!is.na(peak)]),
  384. peak.frequency = peak.nr/max(Time),
  385. peak.duration = mean(duration, na.rm=T),
  386. peak.interval = mean(interval, na.rm=T),
  387. peak.duration.variability = sd(duration, na.rm=T)/mean(duration, na.rm=T),
  388. peak.interval.variability = sd(interval, na.rm=T)/mean(interval, na.rm=T),
  389. dynamic.range = max(Mean)- min(Mean),
  390. dynamic.range.norm = max(norm.mean) - min(norm.mean))
  391. features.image.a = ddply(features.roi, c("Rep","Plate","Well","Image","ImageNr","Image_ID","Condition","Treatment","Concentration"), summarise,
  392. baseline.intensity = mean(baseline.intensity),
  393. peak.frequency = mean(peak.frequency, na.rm=T),
  394. peak.duration = mean(peak.duration, na.rm=T),
  395. peak.interval = mean(peak.interval, na.rm=T),
  396. peak.duration.variability = mean(peak.duration.variability, na.rm=T),
  397. peak.interval.variability = mean(peak.interval.variability, na.rm=T),
  398. dynamic.range = mean(dynamic.range),
  399. dynamic.range.norm = mean(dynamic.range.norm))
  400. # summarize roi data per image - with a cutoff for inactive ROIs showing less than 10 peaks across the time window
  401. features.image.b = ddply(features.roi, c("Rep","Plate","Well","Image","ImageNr","Image_ID","Condition","Treatment","Concentration"), summarise,
  402. active.fraction = sum(peak.nr>activePeakNr)/length(peak.nr)*100)
  403. features.image.c = ddply(features.roi[features.roi$peak.nr>activePeakNr,], c("Rep","Plate","Well","Image","ImageNr","Image_ID","Condition","Treatment","Concentration"), summarise,
  404. act.baseline.intensity = mean(baseline.intensity),
  405. act.peak.frequency = mean(peak.frequency),
  406. act.peak.duration = mean(peak.duration),
  407. act.peak.interval = mean(peak.interval),
  408. act.peak.duration.variability = mean(peak.duration.variability),
  409. act.peak.interval.variability = mean(peak.interval.variability),
  410. act.dynamic.range = mean(dynamic.range),
  411. act.dynamic.range.norm = mean(dynamic.range.norm))
  412. features.image.bc=left_join(features.image.b,features.image.c)
  413. #----8.3. Image Data: Global parameters of average trace -------------------------------
  414. features.image.d=ddply(data.image.peak, c("Rep","Plate","Well","Image","ImageNr","Image_ID","Condition","Treatment","Concentration"), summarise,
  415. avTrace.baseline.intensity = median(Mean),
  416. avTrace.peak.nr = length(peak[!is.na(peak)]),
  417. avTrace.peak.frequency = avTrace.peak.nr/max(Time), # peaks per sec
  418. avTrace.dynamic.range = max(Mean) - min(Mean),
  419. avTrace.dynamic.range.norm = max(norm.mean) - min(norm.mean))
  420. features.image.d=subset(features.image.d, select=-c(avTrace.peak.nr))
  421. # combine all image data
  422. data.func.image = left_join(features.image.a,features.image.bc)%>%
  423. dplyr::left_join(features.image.d)%>%
  424. dplyr::left_join(.,cor.data)
  425. data.func.image$ID=paste(data.func.image$Condition,data.func.image$Treatment, data.func.image$Concentration, sep="_")
  426. #----8.4. Well Data: -----------------------------------------------------------
  427. var.features=names(data.func.image)[!names(data.func.image)%in% c("Rep","Plate","Well","Image","ImageNr","Image_ID","Condition","Treatment","Concentration","ID")]
  428. data.func.well=data.func.image%>%
  429. dplyr::group_by(Rep,Plate,Well,Condition,Treatment,Concentration,ID)%>%
  430. dplyr::summarise(across(var.features, mean, na.rm = TRUE))
  431. #----8.5. Normalise to control condition----------------------------------------
  432. unique(data.func.image$ID)
  433. data.func.image.norm = data.func.image%>%
  434. dplyr::group_by(Rep,Plate)%>%
  435. dplyr:: mutate_at(c(var.features),funs(ZScore = (. - mean(.[ID==ctrl.condition], na.rm=TRUE))/sd(.[ID==ctrl.condition],na.rm=TRUE)))%>%
  436. dplyr::select(Rep,Plate,Well,ImageNr,Image_ID,Condition,Treatment,Concentration,ID,contains("ZScore"))
  437. var.features.zscore=paste(var.features,"_ZScore",sep="")
  438. data.func.well.norm=data.func.image.norm%>%
  439. dplyr::group_by(Rep,Plate,Well,Condition,Treatment,Concentration,ID)%>%
  440. dplyr::summarise(across(var.features.zscore, mean, na.rm = TRUE))
  441. #--9. Result plot --------------------------------------------------------------
  442. #----9.1. Well Data ------------------------------------------------------------
  443. data.temp=data.func.well
  444. var.group=c("Rep","Plate","Well","Condition","Treatment","Concentration","ID")
  445. col=brewer.pal(length(unique(data.temp$ID)),"Set3")
  446. i=1
  447. plot_list = list()
  448. for(var in var.features){
  449. data.plot=data.temp[,c(var.group,var)]
  450. names(data.plot)[ncol(data.plot)]="variable"
  451. p=ggplot(data.plot,aes(x = Plate,y = variable, fill=ID, group=ID)) +
  452. stat_summary(fun.data = mean_sdl, geom="errorbar", fun.args = list(mult=1), position=position_dodge(width = 0.9, preserve = "single"), width=.5) +
  453. stat_summary(fun = mean, geom = "bar", position=position_dodge(width = 0.9, preserve = "single"), width=0.85) +
  454. geom_point(position = position_dodge(width = .9), shape=21, fill="grey50", color="white")+
  455. scale_fill_manual(values=col, guide=guide_legend(nrow=2))+
  456. facet_grid(Rep~.)+
  457. ylab(var)+
  458. theme_minimal(base_size = 10)+
  459. theme(legend.position = "bottom")
  460. p
  461. plot_list[[i]] = p
  462. i=i+1
  463. }
  464. ggsave(file=file.path(dir.plot,"Func_Well_Barplot_Rep_Plate.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  465. i=1
  466. plot_list = list()
  467. for(var in var.features){
  468. data.plot=data.temp[,c(var.group,var)]
  469. names(data.plot)[ncol(data.plot)]="variable"
  470. p=ggplot(data.plot,aes(x = NA,y = variable, fill=ID, group=ID)) +
  471. stat_summary(fun.data = mean_sdl, geom="errorbar", fun.args = list(mult=1), position=position_dodge(width = 0.9, preserve = "single"), width=.5) +
  472. stat_summary(fun = mean, geom = "bar", position=position_dodge(width = 0.9, preserve = "single"), width=0.85) +
  473. geom_point(position = position_dodge(width = .9), shape=21, fill="grey50", color="white")+
  474. scale_fill_manual(values=col, guide=guide_legend(nrow=2))+
  475. ylab(var)+
  476. theme_minimal(base_size = 10)+
  477. theme(legend.position = "bottom")
  478. p
  479. plot_list[[i]] = p
  480. i=i+1
  481. }
  482. ggsave(file=file.path(dir.plot,"Func_Well_Barplot.pdf"),marrangeGrob(plot_list, nrow=2, ncol=2),width = 30, height=21, units = "cm")
  483. #----9.2. Well Norm Data -------------------------------------------------------
  484. data.temp=data.func.well.norm
  485. var.group=c("Rep","Plate","Well","Condition","Treatment","Concentration","ID")
  486. col=brewer.pal(length(unique(data.temp$ID)),"Set3")
  487. i=1
  488. plot_list = list()
  489. for(var in var.features.zscore){
  490. data.plot=data.temp[,c(var.group,var)]
  491. names(data.plot)[ncol(data.plot)]="variable"
  492. p=ggplot(data.plot,aes(x = Plate,y = variable, fill=ID, group=ID)) +
  493. stat_summary(fun.data = mean_sdl, geom="errorbar", fun.args = list(mult=1), position=position_dodge(width = 0.9, preserve = "single"), width=.5) +
  494. stat_summary(fun = mean, geom = "bar", position=position_dodge(width = 0.9, preserve = "single"), width=0.85) +
  495. geom_point(position = position_dodge(width = .9), shape=21, fill="grey50", color="white")+
  496. scale_fill_manual(values=col, guide=guide_legend(nrow=2))+
  497. facet_grid(Rep~.)+
  498. ylab(var)+
  499. theme_minimal(base_size = 10)+
  500. theme(legend.position = "bottom")
  501. p
  502. plot_list[[i]] = p
  503. i=i+1
  504. }
  505. ggsave(file=file.path(dir.plot,"Func_Well_Norm_Barplot_Rep_Plate.pdf"),marrangeGrob(plot_list, nrow=1, ncol=1),width = 30, height=21, units = "cm")
  506. i=1
  507. plot_list = list()
  508. for(var in var.features.zscore){
  509. data.plot=data.temp[,c(var.group,var)]
  510. names(data.plot)[ncol(data.plot)]="variable"
  511. p=ggplot(data.plot,aes(x = NA,y = variable, fill=ID, group=ID)) +
  512. stat_summary(fun.data = mean_sdl, geom="errorbar", fun.args = list(mult=1), position=position_dodge(width = 0.9, preserve = "single"), width=.5) +
  513. stat_summary(fun = mean, geom = "bar", position=position_dodge(width = 0.9, preserve = "single"), width=0.85) +
  514. geom_point(position = position_dodge(width = .9), shape=21, fill="grey50", color="white")+
  515. scale_fill_manual(values=col, guide=guide_legend(nrow=2))+
  516. ylab(var)+
  517. theme_minimal(base_size = 10)+
  518. theme(legend.position = "bottom")
  519. p
  520. plot_list[[i]] = p
  521. i=i+1
  522. }
  523. ggsave(file=file.path(dir.plot,"Func_Well_Norm_Barplot.pdf"),marrangeGrob(plot_list, nrow=2, ncol=2),width = 30, height=21, units = "cm")
  524. #--10. Export Data Frames -------------------------------------------------------
  525. write.table(x=data.roi.peak,file=file.path(dir.mergedData,"Data_Func_ROI.txt"), sep='\t', dec=".", col.names = TRUE, row.names = FALSE)
  526. write.table(x=data.func.image,file=file.path(dir.mergedData,"Data_Func_Image.txt"), sep='\t', dec=".", col.names = TRUE, row.names = FALSE)
  527. write.table(x=data.func.well,file=file.path(dir.mergedData,"Data_Func_Well.txt"), sep='\t', dec=".",col.names = TRUE, row.names = FALSE)
  528. write.table(x=data.func.image.norm,file=file.path(dir.mergedData,"Data_Func_Image_Norm.txt"), sep='\t', dec=".", col.names = TRUE, row.names = FALSE)
  529. write.table(x=data.func.well.norm,file=file.path(dir.mergedData,"Data_Func_Well_Norm.txt"), sep='\t', dec=".",col.names = TRUE, row.names = FALSE)

NeuroConnectivity_Func_v01.R at commit 58d821c, under CC-BY-NC-SA-4.0 · at the source

Overview

Authors: Nina Dirkx1,2, Bob Asselbergh1,2, Peter Verstraelen3, Jonas Van Lent2,4, Els De Vriendt1,2, Vincent Timmerman4,5, Winnok H De Vos3,5,6, Sarah Weckhuysen1,5,7,8
  1. Translational Epilepsy Genomics Group, VIB Center for Molecular Neurology, VIB, 2610 Antwerp, Belgium
  2. Department of Biomedical Sciences, University of Antwerp, 2610 Antwerp, Belgium
  3. Laboratory of Cell Biology and Histology, University of Antwerp, 2610 Antwerp, Belgium
  4. Peripheral Neuropathy Research Group, Department of Biomedical Sciences, University of Antwerp, 2610 Antwerp, Belgium
  5. μNeuro Research Centre of Excellence, University of Antwerp, 2610 Antwerp, Belgium
  6. Antwerp Centre for Advanced Microscopy, University of Antwerp, 2610 Antwerp, Belgium
  7. Division of Neurology, University Hospital Antwerp, 2650 Antwerp, Belgium
  8. Translational Neurosciences, Faculty of Medicine and Health Science, University of Antwerp, 2610 Antwerp, Belgium
Journal: iScience, volume 29, issue 5, article 115689
Dates: received 15 September 2025; accepted 8 April 2026; published online 9 April 2026
Type: Research article · Language: English
License: CC BY-NC
Identifiers: DOI 10.1016/j.isci.2026.115689 · PMID 42080132 · PMCID PMC13133964 · OpenAlex W7152689310
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), cellular / molecular (subfield)
Methods: Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, Preprocessing, Evoked potentials, Connectivity, fMRI & imaging, Single-unit activity, calcium imaging
Keywords: imaging methods in chemistry, neuroscience
Topic: Ion channel regulation and function (Molecular Biology, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Funding: Fonds Wetenschappelijk Onderzoek (1861424N, G059325N, G041821N); Queen Elisabeth Medical Foundation for Neurosciences; University of Antwerp
Citations: not cited yet (Europe PMC); 61 references in the paper

Abstract

Synchronous calcium (Ca2+) bursting is a hallmark of neuronal network maturation. While microelectrode array (MEA) recordings are routinely used to generate population-averaged measurements on this functional network activity, live cell Ca2+-imaging offers single-cell resolved, contextual data. Unfortunately, most electrophysiologically active cells are hypersensitive to medium exchange, which is standard practice in most sensor dye-based Ca2+-imaging protocols. Here, we found that the use of conditioned imaging medium preserves spontaneous network activity of iPSC-derived glutamatergic and motor neuron cultures. The effect was consistent across different cell lines and seeding densities and allowed for the faithful detection of disease-specific phenotypes, as shown using a KCNQ2-related epilepsy model. Our findings thus provide a simple, robust strategy to measure spontaneous network activity in Ca2+-imaging experiments, broadening the utility of this technique for functional phenotyping, disease modeling, and drug screening with cellular resolution.

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

Repositories

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

stardist/stardist

License: BSD-3-Clause
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: e80c6de700693bc228ed3c9ba1dc19c3785667ee, 14 February 2026
Languages: Python (40), C/C++ (38), C++ (26), C (15), Jupyter (14)
Size: 201 files, 133 scripts
Software Heritage: archived
Found in: the resources table
Holds: README, license file, environment (pyproject.toml, setup.cfg, setup.py, docker/Dockerfile), tests, continuous integration, 14 notebooks
Not found: CITATION.cff, documentation
Tools: NumPy (19 files), Matplotlib (14 files), tifffile (14 files), scikit-image (7 files), imageio (2 files), Numba (1 file), SciPy (1 file), TensorFlow (1 file), xarray (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
59 files

DeVosLab/NeuroConnectivity

License: CC-BY-NC-SA-4.0
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 58d821ce9d9b82852e01644da475365390883a40, 15 October 2025
Languages: R (3)
Size: 10 files, 3 scripts
Software Heritage: not archived
Found in: the text, “Analysis of Ca 2+ traces”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: data.table (3 files), tidyverse (3 files), pheatmap (1 file), reshape2 (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
5 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:

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

Data: All data reported in this paper will be shared by the lead contact upon request.

Code: This paper does not report original code.

Additional information: Any additional information required to reanalyze the data reported in this paper is available from the lead contact upon request

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

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 29 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 2 keywords, 3 funders, 60 references, 4 RRIDs.

Cite

This paper

Dirkx, N., Asselbergh, B., Verstraelen, P., Van Lent, J., De Vriendt, E., Timmerman, V., De Vos, W. H., & Weckhuysen, S. (2026). Unperturbed dye-based imaging of spontaneous synchronized calcium activity in iPSC-derived neuronal cultures. iScience, 29(5), 115689. https://doi.org/10.1016/j.isci.2026.115689

BibTeX

@article{dirkx2026unperturbed,
author = {Dirkx, Nina and Asselbergh, Bob and Verstraelen, Peter and Van Lent, Jonas and De Vriendt, Els and Timmerman, Vincent and De Vos, Winnok H and Weckhuysen, Sarah},
title = {{Unperturbed dye-based imaging of spontaneous synchronized calcium activity in iPSC-derived neuronal cultures}},
journal = {iScience},
year = {2026},
month = apr,
volume = {29},
number = {5},
pages = {115689},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/j.isci.2026.115689},
url = {https://doi.org/10.1016/j.isci.2026.115689},
pmid = {42080132},
pmcid = {PMC13133964}
}

RIS

TY - JOUR
AU - Dirkx, Nina
AU - Asselbergh, Bob
AU - Verstraelen, Peter
AU - Van Lent, Jonas
AU - De Vriendt, Els
AU - Timmerman, Vincent
AU - De Vos, Winnok H
AU - Weckhuysen, Sarah
TI - Unperturbed dye-based imaging of spontaneous synchronized calcium activity in iPSC-derived neuronal cultures
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/04/09
VL - 29
IS - 5
SP - 115689
SN - 2589-0042
PB - Elsevier
DO - 10.1016/j.isci.2026.115689
UR - https://doi.org/10.1016/j.isci.2026.115689
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.isci.2026.115689",
"type": "article-journal",
"title": "Unperturbed dye-based imaging of spontaneous synchronized calcium activity in iPSC-derived neuronal cultures",
"container-title": "iScience",
"author": [
{
"family": "Dirkx",
"given": "Nina"
},
{
"family": "Asselbergh",
"given": "Bob"
},
{
"family": "Verstraelen",
"given": "Peter"
},
{
"family": "Van Lent",
"given": "Jonas"
},
{
"family": "De Vriendt",
"given": "Els"
},
{
"family": "Timmerman",
"given": "Vincent"
},
{
"family": "De Vos",
"given": "Winnok H"
},
{
"family": "Weckhuysen",
"given": "Sarah"
}
],
"container-title-short": "iScience",
"volume": "29",
"issue": "5",
"page": "115689",
"DOI": "10.1016/j.isci.2026.115689",
"PMID": "42080132",
"PMCID": "PMC13133964",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.isci.2026.115689",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
9
]
]
}
}

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.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: imageio, tifffile, Numba, 9 other tools, cellular / molecular
[2] doi:10.1093/neuonc/noag128 [code]
Spatially-resolved single-cell imaging of melanoma brain metastases identifies localized immune patterns predictive of immune checkpoint blockade response.
Journal: Neuro-oncology
In common: imageio, tifffile, TensorFlow, 7 other tools
[3] doi:10.1016/j.isci.2026.116213 [code]
Opioid receptor distribution in the claustrum-dorsal endopiriform complex.
Journal: iScience
In common: xarray, imageio, tifffile, 6 other tools, cellular / molecular
[4] doi:10.3389/fnbeh.2026.1895371 [code]
Discrete and differentiated encoding of distinct components of spatial experience occurs within the proximodistal subfields of the dorsoventral axis of the hippocampus.
Journal: Frontiers in behavioral neuroscience
In common: xarray, imageio, tifffile, 6 other tools
[5] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: Numba, TensorFlow, pheatmap, 7 other tools, cellular / molecular
[6] doi:10.1038/s41467-026-71458-0 [code]
Early differential impact of MeCP2 mutations on functional networks in Rett syndrome patient-derived human cortical organoids.
Journal: Nature communications
In common: tifffile, Numba, pheatmap, 6 other tools, cellular / molecular
[7] doi:10.1186/s11689-026-09713-0 [code]
DRP1 mutations associated with EMPF1 encephalopathy perturb the transcriptional profile and maturation of cortical neurons.
Journal: Journal of neurodevelopmental disorders
In common: tifffile, pheatmap, scikit-image, 5 other tools, 1 reference
[8] doi:10.1073/pnas.2609132123 [code]
A human lysosomal storage disorder toolkit for decoding proteome landscapes in cortical-like and dopaminergic-like induced neurons.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: tifffile, pheatmap, scikit-image, 6 other tools, cellular / molecular
[9] doi:10.1371/journal.pcbi.1014571 [code]
SynAPSeg: A novel dataset and image analysis framework for deep learning-based synapse detection and quantification.
Journal: PLoS computational biology
In common: imageio, tifffile, Numba, 5 other tools
[10] doi: [code]
Real-time closed-loop feedback system for mouse mesoscale cortical signal and movement control
Journal: eLife
In common: imageio, tifffile, Numba, 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.