Experimental treatment with edaravone in a mouse model of spinocerebellar ataxia 1

Data upload and defining functions

Author

Martina Sucha, Simona Benediktova, Filip Tichanek, Jan Jedlicka, Stepan Kapl, Dana Jelinkova, Zdenka Purkartova, Jan Tuma, Jitka Kuncova, Jan Cendelin

This page shows R code for the study Sucha et al. (2023, International Journal of Molecular Science).

Citation:

Sucha M, Benediktova S, Tichanek F, Jedlicka J, Kapl S, Jelinkova D, Purkartova Z, Tuma J, Kuncova J, Cendelin J. Experimental Treatment with Edaravone in a Mouse Model of Spinocerebellar Ataxia 1. International Journal of Molecular Sciences. 2023; 24(13):10689. https://doi.org/10.3390/ijms241310689

GitHub page: https://github.com/filip-tichanek/edaravonSCA1

1 Import of packages

Open code
rm(list = ls())

suppressWarnings(suppressMessages( {
library(brms)
library(beeswarm)
library(vioplot)
library(glmmTMB)
library(car)
library(cowplot)
library(ggplot2)
library(tidyverse)
  } ) )

2 Custom functions

2.1 run_model

Function to run and save, or load, Bayesian model. The function was written according to online proposal of Paul-Christian Bürkner

Open code
    run_model <- function(expr, path, reuse = TRUE) {
      path <- paste0(path, ".Rds")
      if (reuse) {
        fit <- suppressWarnings(try(readRDS(path), silent = TRUE))
        }
      if (is(fit, "try-error")) {
        fit <- eval(expr)
        saveRDS(fit, file = path)
        }
      fit
    }

2.2 prios

The function takes model (m) fitted with glmmTMB package and show prior with sca1 as reference group and the WT genotype as the 1st b regression parameter. The model m is based on previous data (Tichanek et al., 2020, Scientific Reports).

Open code
prios<- function(m){
  pr<-summary(m)$coefficients$cond[2,c(1,2,4)]
  if((pr[1]<0)&(pr[3]<0.05)){
    mu<-(pr[1]+(pr[2]*1.96))
    sigma<-max(abs(pr[1]-mu),abs(mu))*1.5}
  else if((pr[1]>0)&(pr[3]<0.05)){
    mu<-(pr[1]-pr[2]*1.96)
    sigma<-max(abs(pr[1]-mu),abs(mu))*1.5}
  else{
    mu=0
    sigma=0-abs(pr[1])*1.5}
  return(c(mu,sigma))}

2.3 mons_poste

The function takes data frame of posterior distributions of effect sizes (datf ) and value of zero effect (tres). There are two version: mons_poste6 is for visualizing posterior probabilities on limited space when there are 6 posterior distribution in a single column. mons_poste is used otherwise.

Open code
## mons_poste for visualisations of posterior distribution
mons_poste<-function(datf, tres){
  xx<-1;xax<-data.frame();yax<-data.frame();cisl<-data.frame()
  repeat{
    xax[1:512,xx] <-density(datf[,xx])$x
    yax[1:512,xx]<-density(datf[,xx])$y
    vec<-data.frame(datf[,xx])
    cisl[xx,1:7]<-sapply(vec,function(p) quantile(p,probs=c(0.25,0.75,0.025,0.975,0.001,0.999,0.5)))
    xx<-xx+1;if(xx>dim(datf)[2]){break}}
  
  axl<-data.frame(cbind(xax,yax))
  dim(axl)
  
  scaler<- max(xax) - min(xax)
  uniscal<-round(log10(160/scaler))
  
  xrange<- c(min(xax)-0.05*scaler,max(xax));xscaler=xrange[2]-xrange[1]
  zpos<-c(seq(0,1,by=1/dim(datf)[2]))
  ymax<-1/(max(yax)*1.8*dim(datf)[2])
  par(mgp=c(1.6,0.55,0))
  plot(NULL, xlim=c(xrange[1],xrange[2]),ylim=c(0,1),xlab="",ylab="",las=1, axes=FALSE)
  
  xxs<-1
  repeat{
   x<-ste[xxs]
   lines(c(x,x),c(0,1),col="grey70",lwd=0.7,lty=3)
    xxs<-xxs+1;if(xxs>length(ste)){break}}
  
  xx<-1
  linop=0.05
  repeat{
    polygon(xax[,xx],(ymax*yax[,xx])+(zpos[xx])+linop,col=rgb(1,0.9,0.7),border="grey50")
    polygon(xax[,xx],(ymax*yax[,xx])+(zpos[xx])+linop,col=rgb(0.82,0.82,0.82),border="NA")
    
    ax<- axl[,c(xx,xx+dim(datf)[2])] [axl[,xx]>cisl[xx,3]&axl[,xx]<cisl[xx,4],]
    polygon(c(ax[,1],rev(ax[,1])),
            c((ymax*ax[,2])+(zpos[xx])+linop,
              rep((zpos[xx])+linop,length(ax[,2]))
            ), col=rgb(1,0.88,0.46),border=NA)
    lines(c(cisl[xx,3],cisl[xx,4]),c((zpos[xx])+linop,(zpos[xx])+linop),lend=1,lwd=3,col="grey10")
    points(cisl[xx,7],zpos[xx]+linop,lend=2,pch=3,cex=2.2,lwd=1.5,col="grey10")
    
    
    xx<-xx+1
    if(xx>length(zpos)-1){break}}
  lines(c(tres,tres),c(0,1),lty=1,col="blue4")
  axis(side=1,las=1,cex.axis=1.1,
       at=c(ste),pos=range[1],tck=tckk)
  lines(c(min(xax)-scaler*0.05,max(xax)),c(range[1],range[1]))
  
  xx<-1
  repeat{
    lines(c(xrange[1]+0.2*xscaler,xrange[1]+1*xscaler),
          c(zpos[xx]+zpos[2]*0.88,zpos[xx]+zpos[2]*0.9),
          lwd=22,col="white",lend=2)
    text(xrange[1]+0.55*xscaler,zpos[xx]+zpos[2]*0.88,
         bquote(.(round(cisl[xx,7],uniscal)) *
                  " (" *.(round(cisl[xx,3],uniscal)) *
                  " to "* .(round(cisl[xx,4],uniscal)) * ")")
         ,xpd=TRUE,cex=1,col=rgb(0.4, 0.1, 0))
    pd<-p_dir(datf[,xx],tres)
    pd2<- -round(log10(1-pd))+1
    text(xrange[1]+0.9*xscaler,zpos[xx]+zpos[2]*0.6,
         bquote(.(round(pd,pd2)))
         ,xpd=TRUE,cex=1.1,col=rgb(0.6, 0.1, 0.8))
    xx=xx+1;if(xx>length(zpos)-1){break}}
  text(mean(c(xrange[1],max(xax))),range[1]-0.12,paste(yla),xpd=T,cex=1.1)
}


## mons_poste6 for visualisations of 6 posterior distributions in a single column of the figure 
mons_poste6<-function(datf, tres){
  xx<-1;xax<-data.frame();yax<-data.frame();cisl<-data.frame()
  repeat{
    xax[1:512,xx] <-density(datf[,xx])$x
    yax[1:512,xx]<-density(datf[,xx])$y
    vec<-data.frame(datf[,xx])
    cisl[xx,1:7]<-sapply(vec,function(p) quantile(p,probs=c(0.25,0.75,0.025,0.975,0.001,0.999,0.5)))
    xx<-xx+1;if(xx>dim(datf)[2]){break}}
  
  axl<-data.frame(cbind(xax,yax))
  dim(axl)
  
  scaler<- max(xax) - min(xax)
  uniscal<-round(log10(160/scaler))
  
  xrange<- c(min(xax)-0.05*scaler,max(xax));xscaler=xrange[2]-xrange[1]
  zpos<-c(seq(0,1,by=1/dim(datf)[2]))
  ymax<-1/(max(yax)*1.8*dim(datf)[2])
  par(mgp=c(1.6,0.55,0))
  plot(NULL, xlim=c(xrange[1],xrange[2]),ylim=c(0,1),xlab="",ylab="",las=1, axes=FALSE)
  
  xxs<-1
  repeat{
    x<-ste[xxs]
    lines(c(x,x),c(0,1),col="grey70",lwd=0.7,lty=3)
    xxs<-xxs+1;if(xxs>length(ste)){break}}
  
  xx<-1
  linop=0.01
  repeat{
    polygon(xax[,xx],(ymax*yax[,xx])+(zpos[xx])+linop,col=rgb(1,0.9,0.7),border="grey50")
    polygon(xax[,xx],(ymax*yax[,xx])+(zpos[xx])+linop,col=rgb(0.82,0.82,0.82),border="NA")
    
    ax<- axl[,c(xx,xx+dim(datf)[2])] [axl[,xx]>cisl[xx,3]&axl[,xx]<cisl[xx,4],]
    polygon(c(ax[,1],rev(ax[,1])),
            c((ymax*ax[,2])+(zpos[xx])+linop,
              rep((zpos[xx])+linop,length(ax[,2]))
            ), col=rgb(1,0.88,0.46),border=NA)
    lines(c(cisl[xx,3],cisl[xx,4]),c((zpos[xx])+linop,(zpos[xx])+linop),lend=1,lwd=3,col="grey10")
    points(cisl[xx,7],zpos[xx]+linop,lend=2,pch=3,cex=2.2,lwd=1.5,col="grey10")
    
    xx<-xx+1
    if(xx>length(zpos)-1){break}}
  lines(c(tres,tres),c(0,1),lty=1,col="blue4")
  axis(side=1,las=1,cex.axis=1.1,
       at=c(ste),pos=0,tck=tckk,xpd=TRUE)
  lines(c(min(xax)-scaler*0.05,max(xax)),c(range[1],range[1]))
  
  xx<-1
  repeat{
    lines(c(xrange[1]+0.2*xscaler,xrange[1]+1*xscaler),
          c(zpos[xx]+zpos[2]*0.88,zpos[xx]+zpos[2]*0.9),
          lwd=22,col="white",lend=2)
    text(xrange[1]+0.55*xscaler,zpos[xx]+zpos[2]*0.88,
         bquote(.(round(cisl[xx,7],uniscal)) *
                  " (" *.(round(cisl[xx,3],uniscal)) *
                  " to "* .(round(cisl[xx,4],uniscal)) * ")")
         ,xpd=TRUE,cex=1.2,col=rgb(0.4, 0.1, 0))
    pd<-p_dir(datf[,xx],tres)
    pd2<- -round(log10(1-pd))+1
    text(xrange[1]+0.9*xscaler,zpos[xx]+zpos[2]*0.6,
         bquote(.(round(pd,pd2)))
         ,xpd=TRUE,cex=1.2,col=rgb(0.6, 0.1, 0.8))
    xx=xx+1;if(xx>length(zpos)-1){break}}
  text(mean(c(xrange[1],max(xax))),0-0.12,paste(yla),xpd=T,cex=1.1)
}

2.4 p_dir

Takes data frame of posterior distribution of effect size (data) and value of zero effect (tres) and calculates probability of direction

Open code
p_dir<-function(data,tres){
  1-((min(length(data[data>tres]),length(data[data<tres])))/(length(data)))
}

2.5 Functions for data transformations

Open code
logit<-function(x){
  log(x/(1-x))
}

inv.logit<-function(x){
  exp(x)/(exp(x)+1)
  }

asinTransform <- function(p) { asin(sqrt(p)) }

revAsin <- function(p){sin(p)^2}

3 Colors definitions

Open code
alp=1;cola<-c(
  rgb(0.7,  0.7, 0.25,alpha=alp),
  rgb(0.55,0.55, 0.55,alpha=alp),
  rgb(0.9,0,0,alpha=alp),
  rgb(0.1, 0.1, 1,alpha=alp))

alp=0.2;colb<-c(
  rgb(0.7,  0.7, 0.25,alpha=alp),
  rgb(0.55,0.55, 0.55,alpha=alp),
  rgb(0.9,0,0,alpha=alp),
  rgb(0.1, 0.1, 1,alpha=alp))

alp=0.5;colc<-c(
  rgb(0.7,  0.7, 0.25,alpha=alp),
  rgb(0.55,0.55, 0.55,alpha=alp),
  rgb(0.9,0,0,alpha=alp),
  rgb(0.1, 0.1, 1,alpha=alp))

alp=0.4;cold<-c(
  rgb(0.7,  0.7, 0.25,alpha=alp),
  rgb(0.55,0.55, 0.55,alpha=alp),
  rgb(0.9,0,0,alpha=alp),
  rgb(0.1, 0.1, 1,alpha=alp))

cole=cola

4 Data upload and wrangling

4.1 Behavioral data

Open code
## upload of data
behav<-read.csv("source_data/behav_dat.csv", stringsAsFactors = T)

## subject (id) as factor
behav$id <- as.factor(behav$id)

## defining factor 'group'
behav$group<-interaction(behav$treatment,behav$genotype)
behav$group<-factor(behav$group,levels=c('ctrl.wt','eda.wt','ctrl.sca','eda.sca'))

## defining numerical version of 'sex' variable
behav$sex_num<-ifelse(behav$sex=="f",-0.5,0.5)

## defining variable combining 'genotype', 'treatment' and 'sex' into single variable ('group_sex')
behav$group_sex<-interaction(behav$treatment,behav$genotype,behav$sex)
behav$group_sex<-factor(behav$group_sex, levels=c('ctrl.wt.f','ctrl.wt.m',
                                                 'eda.wt.f','eda.wt.m',
                                                 'ctrl.sca.f','ctrl.sca.m',
                                                 'eda.sca.f','eda.sca.m'))


## substetting data according to sex
behav_m<-subset(behav,behav$sex=="m")
behav_f<-subset(behav,behav$sex=="f")

## data summary
summary(behav)
       id     treatment genotype sex    sugar_water_ratio  immobile_min  
 7      : 1   ctrl:40   sca:40   f:39   Min.   :0.2292    Min.   :0.000  
 9      : 1   eda :40   wt :40   m:41   1st Qu.:1.5702    1st Qu.:1.087  
 11     : 1                             Median :2.7527    Median :2.243  
 12     : 1                             Mean   :2.8797    Mean   :2.328  
 13     : 1                             3rd Qu.:3.8438    3rd Qu.:3.270  
 14     : 1                             Max.   :7.8010    Max.   :6.468  
 (Other):74                                                              
   speed_95th     distance_01      distance_02      distance_03     
 Min.   :20.20   Min.   : 163.4   Min.   : 41.67   Min.   :  77.03  
 1st Qu.:24.31   1st Qu.: 442.7   1st Qu.:271.55   1st Qu.: 280.81  
 Median :26.09   Median : 607.2   Median :437.44   Median : 443.64  
 Mean   :26.45   Mean   : 597.3   Mean   :458.50   Mean   : 457.20  
 3rd Qu.:28.34   3rd Qu.: 757.6   3rd Qu.:609.06   3rd Qu.: 583.79  
 Max.   :34.47   Max.   :1138.8   Max.   :976.52   Max.   :1023.29  
                                                                    
  distance_04      distance_05      distance_06      distance_07    
 Min.   : 126.6   Min.   : 71.11   Min.   : 91.59   Min.   : 93.38  
 1st Qu.: 343.7   1st Qu.:324.05   1st Qu.:302.85   1st Qu.:289.14  
 Median : 481.7   Median :445.53   Median :439.43   Median :406.29  
 Mean   : 484.3   Mean   :455.20   Mean   :436.15   Mean   :425.09  
 3rd Qu.: 585.9   3rd Qu.:591.39   3rd Qu.:551.27   3rd Qu.:567.86  
 Max.   :1033.2   Max.   :977.28   Max.   :936.08   Max.   :897.90  
                                                                    
  distance_08      distance_09      distance_10     inactivity_01    
 Min.   : 42.79   Min.   : 45.14   Min.   : 49.13   Min.   :0.00000  
 1st Qu.:262.38   1st Qu.:277.29   1st Qu.:284.32   1st Qu.:0.02981  
 Median :409.20   Median :405.23   Median :371.12   Median :0.07595  
 Mean   :414.99   Mean   :410.87   Mean   :378.68   Mean   :0.16112  
 3rd Qu.:554.42   3rd Qu.:535.16   3rd Qu.:469.50   3rd Qu.:0.25678  
 Max.   :833.58   Max.   :864.83   Max.   :844.87   Max.   :0.67222  
                                                                     
 inactivity_02      inactivity_03    inactivity_04    inactivity_05   
 Min.   :0.006667   Min.   :0.0120   Min.   :0.0000   Min.   :0.0000  
 1st Qu.:0.085667   1st Qu.:0.1591   1st Qu.:0.1560   1st Qu.:0.1518  
 Median :0.286667   Median :0.3150   Median :0.2627   Median :0.2913  
 Mean   :0.340906   Mean   :0.3586   Mean   :0.3066   Mean   :0.3444  
 3rd Qu.:0.546833   3rd Qu.:0.5478   3rd Qu.:0.4293   3rd Qu.:0.4732  
 Max.   :0.998667   Max.   :0.8967   Max.   :0.8547   Max.   :0.9380  
                                                                      
 inactivity_06     inactivity_07     inactivity_08    inactivity_09    
 Min.   :0.03627   Min.   :0.02333   Min.   :0.0360   Min.   :0.01533  
 1st Qu.:0.17717   1st Qu.:0.19265   1st Qu.:0.1871   1st Qu.:0.19083  
 Median :0.34167   Median :0.32833   Median :0.3410   Median :0.29600  
 Mean   :0.35780   Mean   :0.37851   Mean   :0.3793   Mean   :0.37241  
 3rd Qu.:0.50133   3rd Qu.:0.54083   3rd Qu.:0.5477   3rd Qu.:0.52167  
 Max.   :0.89733   Max.   :0.95733   Max.   :0.9980   Max.   :0.98467  
                                                                       
 inactivity_10     thigmo_propdist  center_propdist   center_avedist 
 Min.   :0.04745   Min.   :0.4038   Min.   :0.01850   Min.   :19.56  
 1st Qu.:0.21929   1st Qu.:0.6248   1st Qu.:0.04187   1st Qu.:21.63  
 Median :0.33402   Median :0.6651   Median :0.05092   Median :22.20  
 Mean   :0.38372   Mean   :0.6722   Mean   :0.05508   Mean   :22.35  
 3rd Qu.:0.50036   3rd Qu.:0.7246   3rd Qu.:0.06769   3rd Qu.:22.91  
 Max.   :0.97170   Max.   :0.8462   Max.   :0.12689   Max.   :25.38  
                                                                     
 thigmo_proptime  center_proptime   center_avetime   kurva_index    
 Min.   :0.4626   Min.   :0.00460   Min.   :20.92   Min.   :0.5181  
 1st Qu.:0.7107   1st Qu.:0.01755   1st Qu.:23.39   1st Qu.:0.8010  
 Median :0.7603   Median :0.02962   Median :24.25   Median :0.8348  
 Mean   :0.7567   Mean   :0.03372   Mean   :24.17   Mean   :0.8050  
 3rd Qu.:0.8259   3rd Qu.:0.04277   3rd Qu.:25.07   3rd Qu.:0.8471  
 Max.   :0.9324   Max.   :0.11440   Max.   :26.92   Max.   :0.8761  
                                                                    
   t_session1    t_session2      t_session3       t_session4    
 Min.   :  0   Min.   :  0.0   Min.   :  0.00   Min.   :  0.00  
 1st Qu.: 25   1st Qu.: 25.0   1st Qu.: 50.00   1st Qu.: 50.00  
 Median : 50   Median : 75.0   Median : 75.00   Median : 75.00  
 Mean   : 45   Mean   : 57.5   Mean   : 65.31   Mean   : 73.12  
 3rd Qu.: 50   3rd Qu.: 75.0   3rd Qu.:100.00   3rd Qu.:100.00  
 Max.   :100   Max.   :100.0   Max.   :100.00   Max.   :100.00  
                                                                
   t_session5       t_session6       t_session7       t_session8    
 Min.   :  0.00   Min.   :  0.00   Min.   :  0.00   Min.   :  0.00  
 1st Qu.: 50.00   1st Qu.: 75.00   1st Qu.:  0.00   1st Qu.:  0.00  
 Median : 75.00   Median :100.00   Median :  0.00   Median : 25.00  
 Mean   : 72.81   Mean   : 79.38   Mean   : 21.56   Mean   : 29.38  
 3rd Qu.:100.00   3rd Qu.:100.00   3rd Qu.: 25.00   3rd Qu.: 50.00  
 Max.   :100.00   Max.   :100.00   Max.   :100.00   Max.   :100.00  
                                                                    
   t_session9      t_session10      t_session11      t_session12   
 Min.   :  0.00   Min.   :  0.00   Min.   :  0.00   Min.   :  0.0  
 1st Qu.:  0.00   1st Qu.:  0.00   1st Qu.: 25.00   1st Qu.: 25.0  
 Median : 25.00   Median : 37.50   Median : 62.50   Median : 75.0  
 Mean   : 36.25   Mean   : 44.06   Mean   : 54.69   Mean   : 62.5  
 3rd Qu.: 56.25   3rd Qu.: 75.00   3rd Qu.:100.00   3rd Qu.:100.0  
 Max.   :100.00   Max.   :100.00   Max.   :100.00   Max.   :100.0  
                                                                   
 grip_strength1   grip_strength2   grip_strength3  grip_strength4  
 Min.   :0.3000   Min.   :0.4000   Min.   :0.200   Min.   :0.4000  
 1st Qu.:0.6000   1st Qu.:0.6000   1st Qu.:0.700   1st Qu.:0.7000  
 Median :0.8000   Median :0.8000   Median :0.800   Median :0.8000  
 Mean   :0.8588   Mean   :0.8912   Mean   :0.890   Mean   :0.8838  
 3rd Qu.:1.0000   3rd Qu.:1.0250   3rd Qu.:1.025   3rd Qu.:1.0000  
 Max.   :2.3000   Max.   :2.2000   Max.   :1.800   Max.   :2.0000  
                                                                   
 Run_Average_Speed_.cm.s._Mean Run_Average_Speed_.cm.s._SD RF_Stand_.s._Mean
 Min.   :14.68                 Min.   : 0.8289             Min.   :0.07915  
 1st Qu.:22.18                 1st Qu.: 3.8027             1st Qu.:0.13077  
 Median :25.87                 Median : 6.3027             Median :0.14708  
 Mean   :26.62                 Mean   : 6.9885             Mean   :0.15151  
 3rd Qu.:30.30                 3rd Qu.: 9.3582             3rd Qu.:0.16915  
 Max.   :52.91                 Max.   :23.0817             Max.   :0.23170  
                                                                            
 RF_Stand_.s._SD   RF_Swing_.s._Mean RF_Swing_.s._SD  
 Min.   :0.01581   Min.   :0.07114   Min.   :0.01008  
 1st Qu.:0.02915   1st Qu.:0.09591   1st Qu.:0.02074  
 Median :0.03888   Median :0.11475   Median :0.02617  
 Mean   :0.04830   Mean   :0.11564   Mean   :0.02895  
 3rd Qu.:0.05049   3rd Qu.:0.13479   3rd Qu.:0.03419  
 Max.   :0.22972   Max.   :0.15467   Max.   :0.11919  
                                                      
 RF_SwingSpeed_.cm.s._Mean RF_SwingSpeed_.cm.s._SD RF_StrideLength_.cm._Mean
 Min.   : 40.51            Min.   : 4.181          Min.   :4.577            
 1st Qu.: 51.79            1st Qu.:12.798          1st Qu.:6.213            
 Median : 60.95            Median :19.938          Median :6.536            
 Mean   : 63.92            Mean   :20.830          Mean   :6.586            
 3rd Qu.: 72.73            3rd Qu.:25.916          3rd Qu.:6.992            
 Max.   :126.61            Max.   :89.343          Max.   :9.333            
                                                                            
 RF_StrideLength_.cm._SD RH_Stand_.s._Mean RH_Stand_.s._SD   RH_Swing_.s._Mean
 Min.   :0.4189          Min.   :0.06362   Min.   :0.01950   Min.   :0.09611  
 1st Qu.:0.6540          1st Qu.:0.10399   1st Qu.:0.02973   1st Qu.:0.13120  
 Median :0.8560          Median :0.11413   Median :0.03791   Median :0.15074  
 Mean   :0.9353          Mean   :0.11803   Mean   :0.04896   Mean   :0.15420  
 3rd Qu.:1.1820          3rd Qu.:0.13147   3rd Qu.:0.04936   3rd Qu.:0.17659  
 Max.   :1.8803          Max.   :0.20219   Max.   :0.22393   Max.   :0.23340  
                                                                              
 RH_Swing_.s._SD   RH_SwingSpeed_.cm.s._Mean RH_SwingSpeed_.cm.s._SD
 Min.   :0.01389   Min.   : 30.14            Min.   : 3.870         
 1st Qu.:0.02491   1st Qu.: 39.70            1st Qu.: 9.748         
 Median :0.03708   Median : 46.43            Median :14.481         
 Mean   :0.04255   Mean   : 48.55            Mean   :15.392         
 3rd Qu.:0.04938   3rd Qu.: 56.18            3rd Qu.:19.320         
 Max.   :0.14919   Max.   :102.56            Max.   :82.964         
                                                                    
 RH_StrideLength_.cm._Mean RH_StrideLength_.cm._SD LF_Stand_.s._Mean
 Min.   :4.410             Min.   :0.3320          Min.   :0.07398  
 1st Qu.:6.136             1st Qu.:0.7018          1st Qu.:0.12925  
 Median :6.546             Median :0.9599          Median :0.14788  
 Mean   :6.569             Mean   :0.9924          Mean   :0.15079  
 3rd Qu.:6.972             3rd Qu.:1.2440          3rd Qu.:0.16979  
 Max.   :9.251             Max.   :2.1190          Max.   :0.24486  
                                                                    
 LF_Stand_.s._SD   LF_Swing_.s._Mean LF_Swing_.s._SD  
 Min.   :0.01193   Min.   :0.07300   Min.   :0.01121  
 1st Qu.:0.02843   1st Qu.:0.09842   1st Qu.:0.02051  
 Median :0.03947   Median :0.11568   Median :0.02687  
 Mean   :0.04970   Mean   :0.11573   Mean   :0.02894  
 3rd Qu.:0.05618   3rd Qu.:0.13348   3rd Qu.:0.03468  
 Max.   :0.23414   Max.   :0.16516   Max.   :0.09481  
                                                      
 LF_SwingSpeed_.cm.s._Mean LF_SwingSpeed_.cm.s._SD LF_StrideLength_.cm._Mean
 Min.   : 40.91            Min.   : 5.618          Min.   :4.560            
 1st Qu.: 51.38            1st Qu.:12.835          1st Qu.:6.193            
 Median : 61.62            Median :21.106          Median :6.494            
 Mean   : 63.36            Mean   :19.924          Mean   :6.579            
 3rd Qu.: 71.38            3rd Qu.:25.694          3rd Qu.:6.946            
 Max.   :107.80            Max.   :38.058          Max.   :9.203            
                                                                            
 LF_StrideLength_.cm._SD LH_Stand_.s._Mean LH_Stand_.s._SD   LH_Swing_.s._Mean
 Min.   :0.3907          Min.   :0.04624   Min.   :0.01361   Min.   :0.09158  
 1st Qu.:0.6612          1st Qu.:0.09862   1st Qu.:0.02881   1st Qu.:0.13054  
 Median :0.8545          Median :0.11433   Median :0.03749   Median :0.15070  
 Mean   :0.9522          Mean   :0.11812   Mean   :0.04887   Mean   :0.15390  
 3rd Qu.:1.2388          3rd Qu.:0.13393   3rd Qu.:0.04974   3rd Qu.:0.17443  
 Max.   :2.0050          Max.   :0.20996   Max.   :0.24937   Max.   :0.23713  
                                                                              
 LH_Swing_.s._SD   LH_SwingSpeed_.cm.s._Mean LH_SwingSpeed_.cm.s._SD
 Min.   :0.01654   Min.   :27.88             Min.   : 3.482         
 1st Qu.:0.02617   1st Qu.:39.56             1st Qu.: 9.196         
 Median :0.03271   Median :46.77             Median :14.154         
 Mean   :0.04046   Mean   :48.16             Mean   :14.798         
 3rd Qu.:0.04863   3rd Qu.:56.68             3rd Qu.:18.462         
 Max.   :0.16717   Max.   :83.66             Max.   :50.335         
                                                                    
 LH_StrideLength_.cm._Mean LH_StrideLength_.cm._SD StepSequence_CA_...
 Min.   :4.147             Min.   :0.4121          Min.   : 0.000     
 1st Qu.:6.143             1st Qu.:0.6944          1st Qu.: 8.761     
 Median :6.511             Median :0.9291          Median :17.192     
 Mean   :6.579             Mean   :1.0366          Mean   :20.322     
 3rd Qu.:6.974             3rd Qu.:1.2609          3rd Qu.:30.076     
 Max.   :9.582             Max.   :3.6256          Max.   :76.471     
                                                                      
 StepSequence_CB_... StepSequence_AA_... StepSequence_AB_...
 Min.   : 0.000      Min.   : 0.000      Min.   : 2.703     
 1st Qu.: 9.531      1st Qu.: 0.000      1st Qu.:33.333     
 Median :20.256      Median : 5.644      Median :53.590     
 Mean   :20.621      Mean   : 8.108      Mean   :50.658     
 3rd Qu.:28.145      3rd Qu.:12.708      3rd Qu.:68.460     
 Max.   :58.333      Max.   :44.118      Max.   :97.500     
                                                            
 StepSequence_RA_... StepSequence_RB_... StepSequence_RegularityIndex_...
 Min.   :0.0000      Min.   :0.0000      Min.   : 84.79                  
 1st Qu.:0.0000      1st Qu.:0.0000      1st Qu.: 97.03                  
 Median :0.0000      Median :0.0000      Median : 98.53                  
 Mean   :0.1567      Mean   :0.1219      Mean   : 97.72                  
 3rd Qu.:0.0000      3rd Qu.:0.0000      3rd Qu.: 99.22                  
 Max.   :3.0303      Max.   :4.5455      Max.   :100.00                  
                                                                         
 BOS_FrontPaws_Mean_.cm. BOS_HindPaws_Mean_.cm.
 Min.   :0.8644          Min.   :1.440         
 1st Qu.:1.0828          1st Qu.:2.057         
 Median :1.1568          Median :2.195         
 Mean   :1.1650          Mean   :2.208         
 3rd Qu.:1.2679          3rd Qu.:2.296         
 Max.   :1.5753          Max.   :2.794         
                                               
 OtherStatistics_Average_Speed_Mean OtherStatistics_Average_Speed_SD
 Min.   :14.65                      Min.   : 0.9671                 
 1st Qu.:21.75                      1st Qu.: 3.6794                 
 Median :25.57                      Median : 6.1019                 
 Mean   :26.37                      Mean   : 6.8192                 
 3rd Qu.:29.95                      3rd Qu.: 8.7676                 
 Max.   :53.44                      Max.   :22.9035                 
                                                                    
 PrintPositions_RightPaws_Mean_.cm. PrintPositions_LeftPaws_Mean_.cm.
 Min.   :-0.3018                    Min.   :-0.0500                  
 1st Qu.: 0.3222                    1st Qu.: 0.3398                  
 Median : 0.5345                    Median : 0.5257                  
 Mean   : 0.5662                    Mean   : 0.5822                  
 3rd Qu.: 0.7295                    3rd Qu.: 0.7493                  
 Max.   : 1.7968                    Max.   : 1.9000                  
                                                                     
 Support_Zero_...  Support_Single_... Support_Diagonal_... Support_Girdle_...
 Min.   :0.00000   Min.   : 1.923     Min.   :44.21        Min.   : 1.010    
 1st Qu.:0.00000   1st Qu.: 6.516     1st Qu.:64.69        1st Qu.: 3.150    
 Median :0.09702   Median :10.448     Median :71.77        Median : 4.720    
 Mean   :0.31129   Mean   :12.583     Mean   :69.30        Mean   : 5.128    
 3rd Qu.:0.33881   3rd Qu.:17.385     3rd Qu.:75.03        3rd Qu.: 6.896    
 Max.   :5.58659   Max.   :34.358     Max.   :82.80        Max.   :14.171    
                                                                             
 Support_Lateral_... Support_Three_... Support_Four_...       group   
 Min.   :0.2107      Min.   : 0.2793   Min.   : 0.0000   ctrl.wt :20  
 1st Qu.:1.1572      1st Qu.: 4.6113   1st Qu.: 0.0000   eda.wt  :20  
 Median :1.8449      Median : 7.3846   Median : 0.2879   ctrl.sca:20  
 Mean   :2.0836      Mean   : 9.1610   Mean   : 1.4289   eda.sca :20  
 3rd Qu.:2.7938      3rd Qu.:12.4493   3rd Qu.: 1.0040                
 Max.   :7.1279      Max.   :25.6497   Max.   :20.3458                
                                                                      
    sex_num             group_sex 
 Min.   :-0.5000   ctrl.wt.m :11  
 1st Qu.:-0.5000   eda.wt.f  :10  
 Median : 0.5000   eda.wt.m  :10  
 Mean   : 0.0125   ctrl.sca.f:10  
 3rd Qu.: 0.5000   ctrl.sca.m:10  
 Max.   : 0.5000   eda.sca.f :10  
                   (Other)   :19  

4.2 Rotarod data

Open code
## upload
rotarod<-read.csv("source_data/rotarod_data.csv",stringsAsFactors = T)

## data summary
summary(rotarod)
       id         treatment  genotype  sex          day       session    
 Min.   :  7.00   ctrl:960   sca:960   f:936   Min.   :1   Min.   :1.00  
 1st Qu.: 31.75   eda :960   wt :960   m:984   1st Qu.:1   1st Qu.:1.75  
 Median : 73.00                                Median :2   Median :2.50  
 Mean   : 72.70                                Mean   :2   Mean   :2.50  
 3rd Qu.:107.50                                3rd Qu.:3   3rd Qu.:3.25  
 Max.   :149.00                                Max.   :3   Max.   :4.00  
  rot_latency     pre_post  
 Min.   :  2.30   post:960  
 1st Qu.: 94.97   pre :960  
 Median :126.90             
 Mean   :127.79             
 3rd Qu.:157.60             
 Max.   :299.20             

4.3 Data from Tichanek et al., 2020, SciRep

Open code
date_scirep<- read.csv("source_data/scirep_2020_data.csv",sep=";",stringsAsFactors = T)
young_scirep <- subset(date_scirep,date_scirep$age_cohort=="sca1_w06"|date_scirep$age_cohort=="sca1_w10")
young_scirep$genotype<-relevel(young_scirep$genotype,ref="tg+")

## data summary
summary(young_scirep)
       id     genotype    age_cohort         born      experiment_start
 355    : 1   tg+:30   sca1_w06:29   23.03.2018: 6   02.07.2018: 9     
 356    : 1   w  :25   sca1_w10:26   20.05.2018: 5   05.03.2018: 8     
 363    : 1            sca1_w17: 0   07.09.2018: 4   17.09.2018: 8     
 364    : 1            sca1_w26: 0   08.11.2017: 4   22.01.2018: 7     
 365    : 1                          19.01.2018: 4   22.10.2018: 7     
 366    : 1                          22.01.2018: 4   04.06.2018: 6     
 (Other):49                          (Other)   :28   (Other)   :10     
 age_in_start_.weeks. first_weight_.mg. pre_death_weight_.mg.   epm_falls
 Min.   : 5.400       Min.   :14.84     Min.   :17.54         Min.   :0  
 1st Qu.: 6.100       1st Qu.:20.00     1st Qu.:21.21         1st Qu.:0  
 Median : 6.400       Median :21.20     Median :22.54         Median :0  
 Mean   : 8.145       Mean   :21.94     Mean   :22.98         Mean   :0  
 3rd Qu.:10.400       3rd Qu.:24.10     3rd Qu.:24.82         3rd Qu.:0  
 Max.   :10.900       Max.   :29.00     Max.   :30.46         Max.   :0  
                                                                         
  epm_distance    epm_close1_dur   epm_close1_fre   epm_close1_to1  
 Min.   : 718.7   Min.   : 19.60   Min.   : 3.000   Min.   :  0.00  
 1st Qu.:1314.8   1st Qu.: 67.36   1st Qu.: 7.000   1st Qu.:  0.92  
 Median :1604.6   Median : 84.72   Median : 9.000   Median :  9.52  
 Mean   :1680.2   Mean   : 94.79   Mean   : 8.745   Mean   : 18.88  
 3rd Qu.:1922.7   3rd Qu.:117.88   3rd Qu.:10.000   3rd Qu.: 19.96  
 Max.   :3371.4   Max.   :219.68   Max.   :16.000   Max.   :112.40  
                                                                    
 epm_close2_dur   epm_close2_fre   epm_close2_to1   epm_open1_dur  
 Min.   : 19.52   Min.   : 2.000   Min.   :  0.00   Min.   : 0.00  
 1st Qu.: 53.44   1st Qu.: 5.000   1st Qu.:  7.36   1st Qu.: 0.00  
 Median : 77.68   Median : 7.000   Median : 16.48   Median : 2.56  
 Mean   : 81.71   Mean   : 8.036   Mean   : 39.19   Mean   :10.16  
 3rd Qu.:105.48   3rd Qu.:11.000   3rd Qu.: 28.28   3rd Qu.:18.52  
 Max.   :158.64   Max.   :21.000   Max.   :268.72   Max.   :48.32  
                                                                   
 epm_open1_fre   epm_open1_to1    epm_open2_dur   epm_open2_fre  
 Min.   :0.000   Min.   :  0.00   Min.   : 0.00   Min.   :0.000  
 1st Qu.:0.000   1st Qu.:  0.00   1st Qu.: 0.00   1st Qu.:0.000  
 Median :1.000   Median :  0.00   Median : 7.04   Median :1.000  
 Mean   :1.382   Mean   : 57.91   Mean   :10.64   Mean   :1.345  
 3rd Qu.:2.000   3rd Qu.:102.28   3rd Qu.:18.80   3rd Qu.:2.000  
 Max.   :7.000   Max.   :312.08   Max.   :54.48   Max.   :7.000  
                                                                 
 epm_open2_to1     of.distance     of.corner      of.center.dist 
 Min.   :  0.00   Min.   :1637   Min.   :0.4050   Min.   :22.44  
 1st Qu.:  0.00   1st Qu.:3156   1st Qu.:0.5382   1st Qu.:26.19  
 Median : 41.44   Median :4247   Median :0.5906   Median :27.33  
 Mean   : 75.10   Mean   :4359   Mean   :0.5993   Mean   :27.35  
 3rd Qu.:128.12   3rd Qu.:5382   3rd Qu.:0.6497   3rd Qu.:28.53  
 Max.   :343.68   Max.   :9380   Max.   :0.8418   Max.   :31.25  
                                                                 
 of.on.edges_narrow of.distance_on_edges_narrow  olm_testing1    olm_stable1  
 Min.   :0.6445     Min.   :0.5743              Min.   : 0.00   Min.   : 0.0  
 1st Qu.:0.8035     1st Qu.:0.7122              1st Qu.:19.50   1st Qu.:19.5  
 Median :0.8738     Median :0.7731              Median :31.00   Median :30.0  
 Mean   :0.8563     Mean   :0.7683              Mean   :30.64   Mean   :30.6  
 3rd Qu.:0.9160     3rd Qu.:0.8329              3rd Qu.:40.00   3rd Qu.:41.0  
 Max.   :0.9758     Max.   :0.9425              Max.   :64.00   Max.   :62.0  
                                                                              
  olm_testing2    olm_stable2     olm_testing3    olm_stable3     olm_testing4 
 Min.   : 0.00   Min.   : 0.00   Min.   : 2.00   Min.   : 1.00   Min.   : 0.0  
 1st Qu.: 6.00   1st Qu.: 6.00   1st Qu.:11.50   1st Qu.:11.50   1st Qu.: 6.0  
 Median :13.00   Median :17.00   Median :18.00   Median :19.00   Median :11.0  
 Mean   :19.42   Mean   :17.45   Mean   :21.58   Mean   :20.45   Mean   :15.8  
 3rd Qu.:33.50   3rd Qu.:26.00   3rd Qu.:28.50   3rd Qu.:27.50   3rd Qu.:25.0  
 Max.   :64.00   Max.   :58.00   Max.   :60.00   Max.   :62.00   Max.   :46.0  
                                                                               
  olm_stable4     startle_max    startle_lat_max     pre_max      
 Min.   : 0.00   Min.   : 6.06   Min.   : 54.21   Min.   : 3.170  
 1st Qu.: 4.00   1st Qu.:14.79   1st Qu.: 73.49   1st Qu.: 7.277  
 Median :11.00   Median :18.18   Median : 80.43   Median : 9.760  
 Mean   :14.53   Mean   :18.56   Mean   : 82.68   Mean   :10.265  
 3rd Qu.:23.50   3rd Qu.:21.52   3rd Qu.: 89.20   3rd Qu.:12.070  
 Max.   :51.00   Max.   :36.98   Max.   :118.31   Max.   :24.550  
                 NA's   :3       NA's   :3        NA's   :3       
  pre_lat_max     digi_12_hind_Stance_Stride digi_12_hind_Stride_Length
 Min.   : 62.17   Min.   :72.72              Min.   :3.350             
 1st Qu.: 81.56   1st Qu.:75.45              1st Qu.:3.917             
 Median : 91.11   Median :77.75              Median :4.150             
 Mean   : 97.19   Mean   :77.91              Mean   :4.213             
 3rd Qu.:108.23   3rd Qu.:79.70              3rd Qu.:4.450             
 Max.   :177.92   Max.   :88.20              Max.   :5.975             
 NA's   :3        NA's   :6                  NA's   :6                 
 digi_12_hind_abs.Paw_Angle. digi_12_hind_Stance_Width
 Min.   :10.00               Min.   :1.500            
 1st Qu.:16.93               1st Qu.:2.000            
 Median :19.82               Median :2.200            
 Mean   :19.33               Mean   :2.162            
 3rd Qu.:21.65               3rd Qu.:2.300            
 Max.   :27.80               Max.   :2.600            
 NA's   :6                   NA's   :6                
 digi_12_hind_Stride_length_CV digi_12_hind_Stance_Width_CV
 Min.   : 4.735                Min.   : 2.88               
 1st Qu.:12.080                1st Qu.: 8.65               
 Median :15.130                Median :16.44               
 Mean   :15.864                Mean   :19.55               
 3rd Qu.:18.733                3rd Qu.:27.26               
 Max.   :35.560                Max.   :64.68               
 NA's   :6                     NA's   :6                   
 digi_12_fore_Stance_Stride digi_12_fore_Stride_Length
 Min.   :60.80              Min.   :3.000             
 1st Qu.:67.60              1st Qu.:3.717             
 Median :70.05              Median :4.050             
 Mean   :69.61              Mean   :4.021             
 3rd Qu.:71.75              3rd Qu.:4.250             
 Max.   :74.83              Max.   :5.675             
 NA's   :6                  NA's   :6                 
 digi_12_fore_Stride_Length_CV digi_18_hind_Stance_Stride
 Min.   : 8.08                 Min.   :65.83             
 1st Qu.:20.84                 1st Qu.:70.80             
 Median :25.36                 Median :72.98             
 Mean   :26.48                 Mean   :73.95             
 3rd Qu.:32.53                 3rd Qu.:76.55             
 Max.   :48.99                 Max.   :83.90             
 NA's   :6                     NA's   :4                 
 digi_18_hind_Stride_Length digi_18_hind_abs.Paw_Angle.
 Min.   :4.117              Min.   :11.10              
 1st Qu.:4.875              1st Qu.:16.40              
 Median :5.225              Median :18.62              
 Mean   :5.192              Mean   :18.10              
 3rd Qu.:5.458              3rd Qu.:20.07              
 Max.   :6.200              Max.   :21.45              
 NA's   :4                  NA's   :4                  
 digi_18_hind_Stance_Width digi_18_hind_Stride_length_CV
 Min.   :1.400             Min.   : 5.712               
 1st Qu.:2.000             1st Qu.: 8.743               
 Median :2.100             Median :10.715               
 Mean   :2.088             Mean   :11.687               
 3rd Qu.:2.233             3rd Qu.:13.119               
 Max.   :2.533             Max.   :26.785               
 NA's   :4                 NA's   :4                    
 digi_18_hind_Stance_Width_CV digi_18_fore_Stance_Stride
 Min.   : 4.330               Min.   :59.30             
 1st Qu.: 8.518               1st Qu.:64.11             
 Median :13.480               Median :65.75             
 Mean   :17.364               Mean   :66.10             
 3rd Qu.:23.138               3rd Qu.:68.17             
 Max.   :41.740               Max.   :74.35             
 NA's   :4                    NA's   :4                 
 digi_18_fore_Stride_Length digi_18_fore_Stride_Length_CV   rotarod1_1    
 Min.   :4.133              Min.   :11.99                 Min.   :  5.00  
 1st Qu.:4.721              1st Qu.:16.95                 1st Qu.: 55.00  
 Median :5.175              Median :21.22                 Median : 87.00  
 Mean   :5.087              Mean   :22.43                 Mean   : 91.57  
 3rd Qu.:5.383              3rd Qu.:27.35                 3rd Qu.:129.50  
 Max.   :6.050              Max.   :52.23                 Max.   :200.00  
 NA's   :4                  NA's   :4                                     
   rotarod1_2      rotarod1_3      rotarod1_4      rotarod1_5   
 Min.   : 18.0   Min.   : 14.0   Min.   : 48.0   Min.   : 58.0  
 1st Qu.: 69.5   1st Qu.: 88.5   1st Qu.: 90.0   1st Qu.: 88.0  
 Median :102.0   Median :114.0   Median :120.0   Median :130.0  
 Mean   :107.3   Mean   :129.6   Mean   :125.9   Mean   :132.9  
 3rd Qu.:143.0   3rd Qu.:162.0   3rd Qu.:146.0   3rd Qu.:166.5  
 Max.   :272.0   Max.   :328.0   Max.   :300.0   Max.   :283.0  
                                                                
   rotarod2_1      rotarod2_2      rotarod2_3      rotarod2_4   
 Min.   : 59.0   Min.   : 33.0   Min.   : 66.0   Min.   : 71.0  
 1st Qu.: 97.0   1st Qu.:115.5   1st Qu.:108.5   1st Qu.:109.0  
 Median :138.0   Median :139.0   Median :136.0   Median :143.0  
 Mean   :147.8   Mean   :150.5   Mean   :155.0   Mean   :159.8  
 3rd Qu.:185.5   3rd Qu.:178.5   3rd Qu.:191.5   3rd Qu.:203.5  
 Max.   :288.0   Max.   :354.0   Max.   :358.0   Max.   :322.0  
                                                                
   rotarod2_5      rotarod3_1      rotarod3_2      rotarod3_3   
 Min.   : 44.0   Min.   : 41.0   Min.   : 25.0   Min.   : 55.0  
 1st Qu.:119.0   1st Qu.:104.0   1st Qu.:119.0   1st Qu.:123.0  
 Median :144.0   Median :148.0   Median :164.0   Median :153.0  
 Mean   :154.7   Mean   :156.1   Mean   :167.7   Mean   :170.3  
 3rd Qu.:192.5   3rd Qu.:189.5   3rd Qu.:213.5   3rd Qu.:202.0  
 Max.   :264.0   Max.   :322.0   Max.   :325.0   Max.   :365.0  
                                                                
   rotarod3_4      rotarod3_5      rotarod4_1      rotarod4_2   
 Min.   : 51.0   Min.   : 51.0   Min.   : 46.0   Min.   : 43.0  
 1st Qu.:122.5   1st Qu.:112.5   1st Qu.:114.0   1st Qu.:102.5  
 Median :151.0   Median :160.0   Median :161.0   Median :171.0  
 Mean   :155.3   Mean   :163.9   Mean   :167.0   Mean   :162.7  
 3rd Qu.:178.5   3rd Qu.:199.5   3rd Qu.:201.5   3rd Qu.:207.0  
 Max.   :317.0   Max.   :387.0   Max.   :312.0   Max.   :319.0  
                                                                
   rotarod4_3      rotarod4_4      rotarod4_5      rotarod5_1   
 Min.   : 48.0   Min.   : 61.0   Min.   : 45.0   Min.   : 22.0  
 1st Qu.:112.5   1st Qu.:116.5   1st Qu.:110.5   1st Qu.:118.5  
 Median :166.0   Median :169.0   Median :157.0   Median :154.0  
 Mean   :171.0   Mean   :171.9   Mean   :159.7   Mean   :160.9  
 3rd Qu.:217.5   3rd Qu.:208.0   3rd Qu.:192.5   3rd Qu.:208.5  
 Max.   :360.0   Max.   :376.0   Max.   :355.0   Max.   :325.0  
                                                                
   rotarod5_2      rotarod5_3      rotarod5_4      rotarod5_5   
 Min.   : 27.0   Min.   : 44.0   Min.   : 66.0   Min.   : 47.0  
 1st Qu.:100.0   1st Qu.:105.0   1st Qu.:108.0   1st Qu.:127.5  
 Median :139.0   Median :161.0   Median :150.0   Median :168.0  
 Mean   :149.9   Mean   :154.9   Mean   :156.4   Mean   :168.0  
 3rd Qu.:185.5   3rd Qu.:203.0   3rd Qu.:191.5   3rd Qu.:207.5  
 Max.   :382.0   Max.   :296.0   Max.   :369.0   Max.   :367.0  
                                                                
 mwm_probe_trial   mwm_lat_2_7     mwm_lat_8_9     mwm_non_mowing_1_7
 Min.   :0.0000   Min.   :29.61   Min.   : 8.355   Min.   : 2.158    
 1st Qu.:0.0929   1st Qu.:42.07   1st Qu.:20.310   1st Qu.:24.243    
 Median :0.1657   Median :49.59   Median :34.980   Median :51.793    
 Mean   :0.1636   Mean   :48.40   Mean   :35.180   Mean   :45.454    
 3rd Qu.:0.2162   3rd Qu.:55.80   3rd Qu.:50.062   3rd Qu.:62.864    
 Max.   :0.5720   Max.   :60.10   Max.   :60.120   Max.   :86.477    
                                                                     
    t_maze1       t_maze2          t_maze3          t_maze4      
 Min.   :  0   Min.   :  0.00   Min.   :  0.00   Min.   :  0.00  
 1st Qu.: 50   1st Qu.: 10.00   1st Qu.:  0.00   1st Qu.:  0.00  
 Median : 70   Median : 30.00   Median : 10.00   Median :  0.00  
 Mean   : 62   Mean   : 34.73   Mean   : 23.27   Mean   : 13.27  
 3rd Qu.: 80   3rd Qu.: 55.00   3rd Qu.: 30.00   3rd Qu.: 15.00  
 Max.   :100   Max.   :100.00   Max.   :100.00   Max.   :100.00  
                                                                 
    t_maze5         t_maze6          t_maze7          t_maze8      
 Min.   : 0.00   Min.   : 0.000   Min.   : 0.000   Min.   : 10.00  
 1st Qu.: 0.00   1st Qu.: 0.000   1st Qu.: 0.000   1st Qu.: 70.00  
 Median : 0.00   Median : 0.000   Median : 0.000   Median : 90.00  
 Mean   :10.36   Mean   : 9.818   Mean   : 6.727   Mean   : 80.55  
 3rd Qu.:10.00   3rd Qu.:10.000   3rd Qu.:10.000   3rd Qu.:100.00  
 Max.   :60.00   Max.   :90.000   Max.   :90.000   Max.   :100.00  
                                                                   
    t_maze9       t_maze10         t_maze11      fst5_freqency_immobile
 Min.   :  0   Min.   :  0.00   Min.   :  0.00   Min.   : 0.0          
 1st Qu.: 40   1st Qu.: 10.00   1st Qu.:  0.00   1st Qu.: 7.5          
 Median : 80   Median : 40.00   Median : 20.00   Median :12.0          
 Mean   : 66   Mean   : 45.09   Mean   : 36.55   Mean   :11.2          
 3rd Qu.: 95   3rd Qu.: 80.00   3rd Qu.: 70.00   3rd Qu.:14.0          
 Max.   :100   Max.   :100.00   Max.   :100.00   Max.   :32.0          
                                                                       
   fst5_first     fst_immobility1 fst_immobility2 fst_immobility3
 Min.   :  0.00   Min.   : 0.00   Min.   : 0.00   Min.   : 0.00  
 1st Qu.:  2.44   1st Qu.: 3.00   1st Qu.: 0.56   1st Qu.: 7.76  
 Median : 10.08   Median :10.72   Median :15.04   Median :27.76  
 Mean   : 36.04   Mean   :14.94   Mean   :19.65   Mean   :25.97  
 3rd Qu.: 26.44   3rd Qu.:25.48   3rd Qu.:36.24   3rd Qu.:37.20  
 Max.   :360.00   Max.   :48.80   Max.   :60.00   Max.   :60.00  
                                                                 
 fst_immobility4 fst_immobility5 fst_immobility6  brain_weight  
 Min.   : 0.00   Min.   : 0.00   Min.   : 0.00   Min.   :316.0  
 1st Qu.: 5.96   1st Qu.: 7.84   1st Qu.: 9.64   1st Qu.:360.5  
 Median :22.96   Median :29.20   Median :25.92   Median :376.0  
 Mean   :26.90   Mean   :27.03   Mean   :27.33   Mean   :380.3  
 3rd Qu.:47.56   3rd Qu.:42.36   3rd Qu.:41.16   3rd Qu.:395.5  
 Max.   :60.00   Max.   :60.00   Max.   :60.00   Max.   :443.0  
                                                                
     cb_mol       cb_granular     DG_ML_volume      ca_srlm     
 Min.   :2.000   Min.   :1.775   Min.   :2.291   Min.   :3.782  
 1st Qu.:2.674   1st Qu.:2.406   1st Qu.:2.644   1st Qu.:4.678  
 Median :2.822   Median :2.501   Median :2.843   Median :4.950  
 Mean   :2.824   Mean   :2.509   Mean   :2.901   Mean   :5.022  
 3rd Qu.:3.015   3rd Qu.:2.632   3rd Qu.:3.164   3rd Qu.:5.480  
 Max.   :4.170   Max.   :3.860   Max.   :3.616   Max.   :5.905  
 NA's   :19      NA's   :19      NA's   :19      NA's   :19     
 hypoglossal_nuclues_volume.mm3. parietal_cortex_thickness.mm.
 Min.   : NA                     Min.   : NA                  
 1st Qu.: NA                     1st Qu.: NA                  
 Median : NA                     Median : NA                  
 Mean   :NaN                     Mean   :NaN                  
 3rd Qu.: NA                     3rd Qu.: NA                  
 Max.   : NA                     Max.   : NA                  
 NA's   :55                      NA's   :55                   
 ca_oriens_pyramidale.mm3. dg_hilus.mm3. dg_granular.mm3.
 Min.   : NA               Min.   : NA   Min.   : NA     
 1st Qu.: NA               1st Qu.: NA   1st Qu.: NA     
 Median : NA               Median : NA   Median : NA     
 Mean   :NaN               Mean   :NaN   Mean   :NaN     
 3rd Qu.: NA               3rd Qu.: NA   3rd Qu.: NA     
 Max.   : NA               Max.   : NA   Max.   : NA     
 NA's   :55                NA's   :55    NA's   :55      

4.4 Mitochondrial respiration data

Open code
## data upload 
mitochondria <- read.csv("source_data/mitochondria.csv", stringsAsFactors = T)

## data summary
summary(mitochondria)
    id.mito          id        sex     genotype  treatment  normalisation
 EM1    :  2   Min.   :  1.0   f:160   sca:156   ctrl:160   cs:168       
 EM10   :  2   1st Qu.: 42.0   m:176   wt :180   eda :176   mg:168       
 EM100  :  2   Median : 62.5                                             
 EM101  :  2   Mean   : 59.9                                             
 EM102  :  2   3rd Qu.: 83.0                                             
 EM103  :  2   Max.   :122.0                                             
 (Other):324                                                             
         region        Sample           M_plus_G              D           
 cerebellum :168   Min.   :  0.000   Min.   :   2.189   Min.   :   6.016  
 hippocampus:168   1st Qu.:  1.098   1st Qu.:   5.487   1st Qu.:  17.671  
                   Median :  3.463   Median :  10.116   Median :  36.264  
                   Mean   : 97.432   Mean   : 314.904   Mean   :1035.382  
                   3rd Qu.:173.009   3rd Qu.: 604.561   3rd Qu.:1970.509  
                   Max.   :748.771   Max.   :1250.561   Max.   :5641.065  
                   NA's   :15        NA's   :15         NA's   :15        
       c                  P                  S                 Fccp         
 Min.   :   7.535   Min.   :   8.744   Min.   :   23.76   Min.   :   38.28  
 1st Qu.:  19.584   1st Qu.:  27.571   1st Qu.:   61.34   1st Qu.:   85.44  
 Median :  36.438   Median :  53.599   Median :  101.43   Median :  133.04  
 Mean   :1114.776   Mean   :1597.370   Mean   : 3502.48   Mean   : 4832.88  
 3rd Qu.:2144.681   3rd Qu.:3066.020   3rd Qu.: 6774.85   3rd Qu.: 9543.67  
 Max.   :5750.210   Max.   :9222.498   Max.   :14690.52   Max.   :18087.47  
 NA's   :15         NA's   :15         NA's   :15         NA's   :15        
      Rot               Ama               As.Tm              Azd          
 Min.   :  12.99   Min.   : -0.0816   Min.   :   87.4   Min.   :   22.71  
 1st Qu.:  33.28   1st Qu.:  0.0000   1st Qu.:  216.0   1st Qu.:   39.97  
 Median :  50.32   Median :  0.0000   Median :  450.1   Median :  106.01  
 Mean   :1875.01   Mean   :  5.6830   Mean   :13458.6   Mean   : 2697.27  
 3rd Qu.:3680.76   3rd Qu.:  0.0000   3rd Qu.:24566.5   3rd Qu.: 4519.46  
 Max.   :6385.13   Max.   :356.3343   Max.   :65239.8   Max.   :18978.24  
 NA's   :15        NA's   :15         NA's   :15        NA's   :15        
      C_iv             b                out      out_susp      
 Min.   :   58.08   Mode:logical   Min.   :1     Mode:logical  
 1st Qu.:  177.66   NA's:336       1st Qu.:1     NA's:336      
 Median :  348.20                  Median :1                   
 Mean   :10761.30                  Mean   :1                   
 3rd Qu.:20475.88                  3rd Qu.:1                   
 Max.   :49012.00                  Max.   :1                   
 NA's   :15                        NA's   :325                 

4.5 Calbindin immunofluorescence intensity

Open code
## upload data of intensity in molecular layer
calb <- read.csv("source_data/calbindin.csv", sep = ';', header = TRUE, stringsAsFactors = T)

## subject as factor
calb$id <- as.factor(calb$id)

## slice as factor, nested in subject
calb$slice_id <- interaction(calb$id, calb$slice)

## defining groups
calb$group<-interaction(calb$treatment,calb$genotype)
calb$group<-factor(calb$group,levels=c('ctrl.wt','ctrl.sca','eda.sca'))

## sex as numerical variable, scale to -0.5 and 0.5 values
calb$sex_num<-ifelse(calb$sex=="f",-0.5,0.5)

## defining factor combining 'group' and 'sex'
calb$group_sex<-interaction(calb$treatment,calb$genotype,calb$sex)
calb$group_sex<-factor(calb$group_sex, levels=c('ctrl.wt.f','ctrl.wt.m',
                                                  'ctrl.sca.f','ctrl.sca.m',
                                                  'eda.sca.f','eda.sca.m'))

## upload of calbindin intensities in granular layer (GL)
calbgran <- read.csv("source_data/calbgran.csv", sep = ';', header = TRUE, stringsAsFactors = T)
calbgran$id <- as.factor(calbgran$id)
calbgran$slice_id <- interaction(calbgran$id, calbgran$slice)

## there are two GL measurements neighouring one molecular layer measurement. 
## Lets delete one to simplify combining of both datasets
calbgran <- calbgran %>% filter(slice_id != '13.9' | order != 'F')
calb <- calb %>% mutate(
  mean_gran = calbgran$mean)

calb$group <- factor(calb$group)

## data summary
summary(calb)
       id      treatment  genotype  sex         slice        order  
 15     : 80   ctrl:596   sca:580   f:443   Min.   : 1.000   A:140  
 29     : 78   eda :282   wt :298   m:435   1st Qu.: 4.000   B:129  
 9      : 77                                Median : 8.000   C:162  
 36     : 77                                Mean   : 7.548   D:161  
 20     : 76                                3rd Qu.:11.000   E:150  
 11     : 73                                Max.   :15.000   F:136  
 (Other):417                                                        
 CbRegion.vermis_hemispheres.      mean            area           slice_id  
 hemispheres:610              Min.   :13.97   Min.   : 46036   29.1   :  6  
 vermis     :268              1st Qu.:30.03   1st Qu.:192086   15.2   :  6  
                              Median :35.36   Median :297077   19.2   :  6  
                              Mean   :36.53   Mean   :312565   29.2   :  6  
                              3rd Qu.:41.88   3rd Qu.:419212   13.3   :  6  
                              Max.   :62.38   Max.   :868452   15.3   :  6  
                                                               (Other):842  
      group        sex_num               group_sex     mean_gran     
 ctrl.wt :298   Min.   :-0.500000   ctrl.wt.f :151   Min.   : 5.286  
 ctrl.sca:298   1st Qu.:-0.500000   ctrl.wt.m :147   1st Qu.:12.983  
 eda.sca :282   Median :-0.500000   ctrl.sca.f:156   Median :16.065  
                Mean   :-0.004556   ctrl.sca.m:142   Mean   :16.313  
                3rd Qu.: 0.500000   eda.sca.f :136   3rd Qu.:19.148  
                Max.   : 0.500000   eda.sca.m :146   Max.   :33.583  
                                                     NA's   :10      

4.6 PSA-NCAM data

Open code
## upload data
psa <- read.csv('source_data/psa_ncam.csv', stringsAsFactors = T)

## upload data for connecting psa table with metadata
histid <- read.csv('source_data/hist_id.csv', stringsAsFactors = T)

## connecting both tables
psa <- left_join(psa, histid, by = 'hist_id')

## removing missing data
psa <- subset(psa, psa$psa_ncam != 'X' & psa$psa_ncam != '')
psa$psa_ncam <- as.numeric(as.character(psa$psa_ncam))

## defining psa_ncam and numerical variable
psa_nc <- subset(psa, grepl('control', as.character(psa$slice)) == FALSE)

## defning factor of slice order
psa_nc$slice <- factor(psa_nc$slice)

## slice order as numerical variable
psa_nc$slice_n <- as.numeric(as.character(psa_nc$slice))

## data summary
summary(psa_nc)
    hist_id         slice     side       part.ID          structure  
 Min.   :6367   3      : 96   l:459          :640   CA1 SLM    :225  
 1st Qu.:6370   6      : 96   p:459   1      :206   CA4 pyr    :212  
 Median :6377   7      : 96           2      : 60   DG-ML      :245  
 Mean   :6385   8      : 96           3      :  4   DG PL hilus:236  
 3rd Qu.:6401   9      : 93           control:  8                    
 Max.   :6417   4      : 92                                          
                (Other):349                                          
      area        psa_ncam            id         treat     genotype  sex    
 13459  :  2   Min.   : 5.536   Min.   : 9.00   ctrl:611   sca:592   f:450  
 14699  :  2   1st Qu.: 9.943   1st Qu.:13.00   eda :307   wt :326   m:468  
 15859  :  2   Median :12.116   Median :19.00                               
 16851  :  2   Mean   :12.739   Mean   :21.23                               
 17199  :  2   3rd Qu.:14.751   3rd Qu.:29.00                               
 20008  :  2   Max.   :34.074   Max.   :37.00                               
 (Other):906                                                                
    slice_n      
 Min.   : 1.000  
 1st Qu.: 4.000  
 Median : 6.000  
 Mean   : 6.158  
 3rd Qu.: 9.000  
 Max.   :14.000  
                 

4.7 Hippocampal volume data

Open code
## upload data
hp_vol <- read.csv('source_data/hip_vol.csv', stringsAsFactors = T)

## defining 'group'
hp_vol$group<-interaction(hp_vol$treatment,hp_vol$genotype)
hp_vol$group<-factor(hp_vol$group,levels=c('ctrl.wt','ctrl.sca','eda.sca'))

## rescaling 'sex'
hp_vol$sex_num<-ifelse(hp_vol$sex=="f",-0.5,0.5)


## defining factor combining 'group' and 'sex'
hp_vol$group_sex<-interaction(hp_vol$treatment,hp_vol$genotype,hp_vol$sex)
hp_vol$group_sex<-factor(hp_vol$group_sex, levels=c('ctrl.wt.f','ctrl.wt.m',
                                                  'ctrl.sca.f','ctrl.sca.m',
                                                  'eda.sca.f','eda.sca.m'))

## data summary
summary(hp_vol)
       id        treatment genotype sex    side       volume           group  
 Min.   : 9.00   ctrl:16   sca:16   f:12   l:12   Min.   :1.184   ctrl.wt :8  
 1st Qu.:14.50   eda : 8   wt : 8   m:12   p:12   1st Qu.:1.688   ctrl.sca:8  
 Median :19.50                                    Median :1.899   eda.sca :8  
 Mean   :21.75                                    Mean   :1.827               
 3rd Qu.:29.50                                    3rd Qu.:2.011               
 Max.   :37.00                                    Max.   :2.303               
    sex_num          group_sex
 Min.   :-0.5   ctrl.wt.f :4  
 1st Qu.:-0.5   ctrl.wt.m :4  
 Median : 0.0   ctrl.sca.f:4  
 Mean   : 0.0   ctrl.sca.m:4  
 3rd Qu.: 0.5   eda.sca.f :4  
 Max.   : 0.5   eda.sca.m :4  

4.8 Cerebellar molecular layer volume data

Open code
## data upload
cbml <- read.csv('source_data/cbml.csv', stringsAsFactors = T) 

## defining 'group'
cbml$group<-interaction(cbml$treatment,cbml$genotype)
cbml$group<-factor(cbml$group,levels=c('ctrl.wt','ctrl.sca','eda.sca'))

## rescaling 'sex' factor
cbml$sex_num<-ifelse(cbml$sex=="f",-0.5,0.5)

## defining 'group_sex'
cbml$group_sex<-interaction(cbml$treatment,cbml$genotype,cbml$sex)
cbml$group_sex<-factor(cbml$group_sex, levels=c('ctrl.wt.f','ctrl.wt.m',
                                                    'ctrl.sca.f','ctrl.sca.m',
                                                    'eda.sca.f','eda.sca.m'))
## subject as factor
cbml$id <- factor(cbml$id)

## rename the outcome variable
cbml$volume <- cbml$cb_ml

## data summary
summary(cbml)
       id    treatment genotype sex       cb_ml            group  
 9      :1   ctrl:8    sca:8    f:6   Min.   :16.56   ctrl.wt :4  
 11     :1   eda :4    wt :4    m:6   1st Qu.:18.22   ctrl.sca:4  
 13     :1                            Median :18.56   eda.sca :4  
 15     :1                            Mean   :18.89               
 18     :1                            3rd Qu.:19.47               
 19     :1                            Max.   :21.64               
 (Other):6                                                        
    sex_num          group_sex     volume     
 Min.   :-0.5   ctrl.wt.f :2   Min.   :16.56  
 1st Qu.:-0.5   ctrl.wt.m :2   1st Qu.:18.22  
 Median : 0.0   ctrl.sca.f:2   Median :18.56  
 Mean   : 0.0   ctrl.sca.m:2   Mean   :18.89  
 3rd Qu.: 0.5   eda.sca.f :2   3rd Qu.:19.47  
 Max.   : 0.5   eda.sca.m :2   Max.   :21.64  
                                              

4.9 Citrate synthase activity data

Open code
## data upload
csyn <- read.csv('source_data/citrate_synt.csv', stringsAsFactors = T)

## defining 'group'
csyn$group<-interaction(csyn$treatment,csyn$genotype)
csyn$group<-factor(csyn$group,levels=c('ctrl.wt','eda.wt','ctrl.sca','eda.sca'))

## subject as factor
csyn$id <- factor(csyn$id)

## data summary
summary(csyn)
       id      sex    genotype treatment         tissue         cs          
 1      :  2   F:71   sca:79   ctrl:80   cerebellum :77   Min.   :0.006127  
 2      :  2   M:83   wt :75   eda :74   hippocampus:77   1st Qu.:0.009835  
 3      :  2                                              Median :0.011520  
 4      :  2                                              Mean   :0.012113  
 5      :  2                                              3rd Qu.:0.014216  
 6      :  2                                              Max.   :0.023529  
 (Other):142                                                                
 mereni      group   
 a:77   ctrl.wt :40  
 b:77   eda.wt  :35  
        ctrl.sca:40  
        eda.sca :39  
                     
                     
                     

5 Saving the environment

Save the R environment to load data in other scripts

Open code
if(T){save.image(file='source_data/myEnvironment.RData')} else {print('Env NOT SAVED NOW!')}

6 Session info

Open code
sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.2 forcats_1.0.0   stringr_1.5.0   dplyr_1.1.0    
 [5] purrr_1.0.1     readr_2.1.4     tidyr_1.3.0     tibble_3.1.8   
 [9] tidyverse_2.0.0 ggplot2_3.4.1   cowplot_1.1.1   car_3.1-1      
[13] carData_3.0-5   glmmTMB_1.1.5   vioplot_0.4.0   zoo_1.8-11     
[17] sm_2.2-5.7.1    beeswarm_0.4.0  brms_2.18.0     Rcpp_1.0.10    

loaded via a namespace (and not attached):
  [1] TH.data_1.1-2        minqa_1.2.5          colorspace_2.1-0    
  [4] ellipsis_0.3.2       estimability_1.4.1   markdown_1.5        
  [7] base64enc_0.1-3      rstudioapi_0.14      farver_2.1.1        
 [10] rstan_2.26.16        DT_0.27              fansi_1.0.4         
 [13] mvtnorm_1.1-3        bridgesampling_1.1-2 codetools_0.2-19    
 [16] splines_4.2.2        knitr_1.42           shinythemes_1.2.0   
 [19] bayesplot_1.10.0     projpred_2.6.0       jsonlite_1.8.4      
 [22] nloptr_2.0.3         shiny_1.7.4          compiler_4.2.2      
 [25] emmeans_1.8.6        backports_1.4.1      Matrix_1.5-3        
 [28] fastmap_1.1.1        cli_3.6.0            later_1.3.0         
 [31] htmltools_0.5.4      prettyunits_1.1.1    tools_4.2.2         
 [34] igraph_1.4.1         coda_0.19-4          gtable_0.3.1        
 [37] glue_1.6.2           reshape2_1.4.4       posterior_1.4.0     
 [40] V8_4.2.2             vctrs_0.5.2          nlme_3.1-162        
 [43] crosstalk_1.2.0      tensorA_0.36.2       xfun_0.37           
 [46] ps_1.7.2             lme4_1.1-31          timechange_0.2.0    
 [49] mime_0.12            miniUI_0.1.1.1       lifecycle_1.0.3     
 [52] gtools_3.9.4         MASS_7.3-58.2        scales_1.2.1        
 [55] colourpicker_1.2.0   hms_1.1.2            promises_1.2.0.1    
 [58] Brobdingnag_1.2-9    parallel_4.2.2       sandwich_3.0-2      
 [61] inline_0.3.19        TMB_1.9.2            shinystan_2.6.0     
 [64] gamm4_0.2-6          yaml_2.3.7           curl_5.0.0          
 [67] gridExtra_2.3        loo_2.5.1            StanHeaders_2.26.16 
 [70] stringi_1.7.12       dygraphs_1.1.1.6     checkmate_2.1.0     
 [73] boot_1.3-28.1        pkgbuild_1.4.0       rlang_1.1.1         
 [76] pkgconfig_2.0.3      matrixStats_0.63.0   distributional_0.3.1
 [79] evaluate_0.20        lattice_0.20-45      rstantools_2.2.0    
 [82] htmlwidgets_1.6.1    processx_3.8.0       tidyselect_1.2.0    
 [85] plyr_1.8.8           magrittr_2.0.3       R6_2.5.1            
 [88] generics_0.1.3       multcomp_1.4-25      withr_2.5.0         
 [91] pillar_1.8.1         mgcv_1.8-41          xts_0.13.0          
 [94] survival_3.5-3       abind_1.4-5          crayon_1.5.2        
 [97] utf8_1.2.3           tzdb_0.3.0           rmarkdown_2.23      
[100] grid_4.2.2           callr_3.7.3          threejs_0.3.3       
[103] digest_0.6.31        xtable_1.8-4         numDeriv_2016.8-1.1 
[106] httpuv_1.6.9         RcppParallel_5.1.7   stats4_4.2.2        
[109] munsell_0.5.0        shinyjs_2.1.0