-
Notifications
You must be signed in to change notification settings - Fork 1
/
01_qRT-PCR.Rmd
88 lines (72 loc) · 1.99 KB
/
01_qRT-PCR.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
---
title: "qRT-PCR analysis. Caffeteria diet"
author: "Sviatoslav Kharuk"
date: "`r Sys.Date()`"
output:
pdf_document:
latex_engine: xelatex
editor_options:
chunk_output_type: inline
---
```{r setup}
knitr::opts_knit$set(root.dir = '../01_qRT-PCR-2023-10-30-1set/')
setwd('../01_qRT-PCR-2023-10-30-1set/')
```
```{r}
#download libraries
library(readxl)
library(DescTools)
library(ggplot2)
```
```{r}
# download the data
# set working directory
data = read_xlsx("../01_qRT-PCR-2023-10-30-1set/")
unique(data$Target)
```
```{r}
# data wrangling
# group by Target
new_df <- data[order(data$Target), ]
# sample the dataframe and create new column Group
sample_group_ <- data.frame(
sample_name = c("414", "415", "417", "418"),
group_name = "Control"
)
# new column with NA
new_df$Group <- NA
# loop through Sample and write corresponding Group to Sample
for (i in 1:nrow(sample_group)) {
new_df$Group[new_df$Sample %in% sample_group$sample_name[i]] <- sample_group$group_name[i]
}
```
```{r}
# data reorder
data$Group <- factor(data$Group, levels = c("Control", "CD", "AKG", "CD + AKG"))
```
```{r}
ggplot(data, aes(Target, Ct)) +
geom_violin(position = position_dodge(width = .7), width = 2, aes(fill = Group), outlier.colour = NA, draw_quantiles = c(0.25, 0.5, 0.75)) +
#geom_jitter(position = position_jitter(width = 1), alpha = 0.5) +
labs(y = "Relative expression", x = " ") +
ggtitle("qRT-PCR set 2. 2023-10-31") +
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
```
```{r}
# barplot
ggplot(data, aes(Target, Ct, fill = Group)) +
geom_bar(stat = "identity", position = "dodge") +
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
```
```{r}
# duncan test for all genes
genes <- unique(data$Target)
for (gene in genes) {
gene_df <- subset(data, Target == gene)
cM.aov <- aov(Ct ~ Group, data = gene_df)
print(gene)
print(PostHocTest(cM.aov, method = "duncan"))
}
```