Newer
Older
---
title: "TPH2 KO statistics"
output: github_document
author: "Alex Meng, Joanes Grandjean"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval=FALSE,warning = FALSE,message=FALSE)
```
# Setup environement
Download DABEST
```{r setup env}
# you just need to run these once.
install.packages('devtools')
install.pacakges("reshape2")
install.pacakges("wesanderson")
devtools::install_github("ACCLAB/dabestr")
devtools::install_github("karthik/wesanderson")
```
# Load pacakges
```{r load env}
library(tidyverse)
library(glue)
library(dabestr)
library(wesanderson) # see https://github.com/karthik/wesanderson
pal <- wes_palette("Darjeeling1")
```
# behavioural tests including EPM and Social interaction
```{r EPM_open arms duration}
df <- read_csv('assets/tables/EPM_open_arms_duration.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1A<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "duration in open arms (%)")
ggsave('assets/figure/EPM open arms duration.svg', plot = Fig1A, device = 'svg',dpi = 300)
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
Fig1A
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r EPM_closed arms duration}
df <- read_csv('assets/tables/EPM_closed_arms_duration.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1B<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "duration in closed arms (%)")
ggsave('assets/figure/EPM closed arms duration.svg', plot = Fig1B, device = 'svg',dpi = 300)
Fig1B
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r EPM_entry closed arms}
df <- read_csv('assets/tables/EPM_entry_closed_arms.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1C<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "number of entry")
ggsave('assets/figure/EPM entry closed arms.svg', plot = Fig1C, device = 'svg',dpi = 300)
Fig1C
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r EPM_entry open arms}
df <- read_csv('assets/tables/EPM_entry_open_arms.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1D<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "number of entry")
ggsave('assets/figure/EPM entry open arms.svg', plot = Fig1D, device = 'svg',dpi = 300)
Fig1D
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r EPM_first entry latency}
df <- read_csv('assets/tables/EPM_first_time_entry.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1E<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "latency time (s)")
ggsave('assets/figure/EPM first time entry.svg', plot = Fig1E, device = 'svg',dpi = 300)
Fig1E
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r EPM_total distance}
df <- read_csv('assets/tables/EPM_total_distance.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1F<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "total distance moved (cm)")
ggsave('assets/figure/EPM total distance.svg', plot = Fig1F, device = 'svg',dpi = 300)
Fig1F
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r SI_total no contact}
df <- read_csv('assets/tables/SI_total_no_contact.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1G<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "total no contact (%)")
ggsave('assets/figure/SI total no contact.svg', plot = Fig1G, device = 'svg',dpi = 300)
Fig1G
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r SI_total mounting}
df <- read_csv('assets/tables/SI_total_mounting.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
Fig1H<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "total mounting (%)")
ggsave('assets/figure/SI total mounting.svg', plot = Fig1H, device = 'svg',dpi = 300)
Fig1H
dabest_hedges$result %>% mutate(p = p_tmp)
```
```{r SI_total aggressiveness}
df <- read_csv('assets/tables/SI_total_aggressiveness.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2+/-'],var.equal=TRUE)$p.value, t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-','Tph2-/-'), paired = FALSE) %>% hedges_g()
Fig1I<-plot(dabest_hedges, palette = pal, rawplot.ylabel = "total aggressiveness (%)")
ggsave('assets/figure/SI total aggressiveness.svg', plot = Fig1I, device = 'svg',dpi = 300)
dabest_hedges$result %>% mutate(p = p_tmp)
```
# PCR
```{r PCR_IF}
df <- read_csv('assets/tables/PCR_IF.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2A <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_IF.svg', plot = Fig2A, device = 'svg',dpi = 300)
```{r PCR_PRL}
df <- read_csv('assets/tables/PCR_PRL.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
Fig2B <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_PRL.svg', plot = Fig2B, device = 'svg',dpi = 300)
```
```{r PCR_PVN}
df <- read_csv('assets/tables/PCR_PVN.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2C <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_PVN.svg', plot = Fig2C, device = 'svg',dpi = 300)
```
```{r PCR_DR}
df <- read_csv('assets/tables/PCR_DR.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2D <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_DR.svg', plot = Fig2D, device = 'svg',dpi = 300)
```
```{r PCR_CA}
df <- read_csv('assets/tables/PCR_CA.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2E <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_CA.svg', plot = Fig2E, device = 'svg',dpi = 300)
```
```{r PCR_dCA1}
df <- read_csv('assets/tables/PCR_dCA1.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2F <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_dCA1.svg', plot = Fig2F, device = 'svg',dpi = 300)
```
```{r PCR_dCA3}
df <- read_csv('assets/tables/PCR_dCA3.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2G <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_dCA3.svg', plot = Fig2G, device = 'svg',dpi = 300)
```
```{r PCR_dGRDG}
df <- read_csv('assets/tables/PCR_dGRDG.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2H <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_dGRDG.svg', plot = Fig2H, device = 'svg',dpi = 300)
```
```{r PCR_vCA1}
df <- read_csv('assets/tables/PCR_vCA1.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2I <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_VCA1.svg', plot = Fig2I, device = 'svg',dpi = 300)
```
```{r PCR_vCA3}
df <- read_csv('assets/tables/PCR_vCA3.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2J <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_vCA3.svg', plot = Fig2J, device = 'svg',dpi = 300)
```
```{r PCR_vGRDG}
df <- read_csv('assets/tables/PCR_vGRDG.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig2K <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "mRNA level (% vs Tph2+/+)")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/PCR_vGRDG.svg', plot = Fig2K, device = 'svg',dpi = 300)
```
#Oxytocin protein
```{r OXY_MFC}
df <- read_csv('assets/tables/OXY_MFC.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig3A <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "pg oxytocin/µg tissue protein/ml")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/OXY_MFC.svg', plot = Fig3A, device = 'svg',dpi = 300)
```
```{r OXY_PVN}
df <- read_csv('assets/tables/OXY_PVN.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig3B <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "pg oxytocin/µg tissue protein/ml")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/OXY_PVN.svg', plot = Fig3B, device = 'svg',dpi = 300)
```
```{r OXY_DR}
df <- read_csv('assets/tables/OXY_DR.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig3C <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "pg oxytocin/µg tissue protein/ml")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/OXY_DR.svg', plot = Fig3C, device = 'svg',dpi = 300)
```
```{r OXY_CA}
df <- read_csv('assets/tables/OXY_CA.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig3D <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "pg oxytocin/µg tissue protein/ml")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/OXY_CA.svg', plot = Fig3D, device = 'svg',dpi = 300)
```
```{r OXY_HIP}
df <- read_csv('assets/tables/OXY_HIP.csv', col_types = cols()) %>% melt() %>% dplyr::rename(group = variable) %>% drop_na()
df %>% group_by(group) %>% summarise(mean=round(mean(value),2), sd=round(sd(value),2))
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
dabest_hedges
plot(dabest_hedges, palette = pal)
Fig3E <- plot(dabest_hedges, palette = pal, rawplot.ylabel = "pg oxytocin/µg tissue protein/ml")
p_tmp<- c(t.test(df$value[df$group == 'Tph2+/+'], df$value[df$group == 'Tph2-/-'],var.equal=TRUE)$p.value)
dabest_hedges$result %>% mutate(p = p_tmp)
ggsave('assets/figure/OXY_HIP.svg', plot = Fig3E, device = 'svg',dpi = 300)
```
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# what happens if dabest bugs?
```{r demo dabest debug}
#load the table. for other cases, it might help to keep naming consistent between tables, see example. Also, avoid spaces or weird characters in table names.
df <- read_csv('assets/tables/testname_measure.csv', col_types = cols()) %>% melt() %>% rename(group = variable) %>% drop_na()
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2+/-'), paired = FALSE) %>% hedges_g()
#figure will require post-pocessing to make do.
plot(dabest_hedges, palette = pal)
dabest_hedges <- dabest(df, group, value, idx = c('Tph2+/+','Tph2-/-'), paired = FALSE) %>% hedges_g()
#figure will require post-pocessing to make do.
plot(dabest_hedges, palette = pal)
```
Finally, you can consider https://rpkgs.datanovia.com/ggpubr/reference/ggarrange.html to make composite figures in R. Happy to help you get started.