Code
library(readxl)
library(car)
library(multcomp)
library(ggplot2)
library(writexl)library(readxl)
library(car)
library(multcomp)
library(ggplot2)
library(writexl)# Load the data
NB_data <- read_excel("Fold Change Calculations for Final Data_tidy.xlsx", sheet = 5)
data3 <- NB_data
# Display the first few rows of the imported data
head(data3)# A tibble: 6 × 4
Sample Gene Treatment NLRP3_mRNA
<dbl> <chr> <chr> <dbl>
1 1 C57 Control 6.45
2 2 C57 LPS 0.03
3 3 C57 Control 5.24
4 4 C57 LPS 0.07
5 5 C57 Control 6.41
6 6 C57 LPS 0.28
# Convert relevant columns to factors (Assuming 'Treatment' and 'Gene' are columns)
data3$Treatment <- factor(data3$Treatment, levels = c(
"Control", "ATP", "LPS", "LPS+ATP", "LPS+NIG", "NIG"))
data3$Gene <- as.factor(data3$Gene)
head(data3)# A tibble: 6 × 4
Sample Gene Treatment NLRP3_mRNA
<dbl> <fct> <fct> <dbl>
1 1 C57 Control 6.45
2 2 C57 LPS 0.03
3 3 C57 Control 5.24
4 4 C57 LPS 0.07
5 5 C57 Control 6.41
6 6 C57 LPS 0.28
# Perform a two-way ANOVA (Assuming 'NLRP3_mRNA' is the dependent variable)
anova_result <- aov(NLRP3_mRNA ~ Treatment * Gene, data = data3)
# Display the summary of ANOVA results
summary(anova_result) Df Sum Sq Mean Sq F value Pr(>F)
Treatment 1 169.09 169.09 1670.992 2.97e-14 ***
Gene 2 0.05 0.02 0.235 0.794
Treatment:Gene 2 0.15 0.08 0.752 0.493
Residuals 12 1.21 0.10
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Perform Tukey's HSD post-hoc test for multiple comparisons
tukey_result <- TukeyHSD(anova_result)
print(tukey_result) Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = NLRP3_mRNA ~ Treatment * Gene, data = data3)
$Treatment
diff lwr upr p adj
LPS-Control -6.129889 -6.456616 -5.803162 0
$Gene
diff lwr upr p adj
APOE4-APOE3 -0.12316667 -0.6131425 0.3668092 0.7844928
C57-APOE3 -0.03933333 -0.5293092 0.4506425 0.9750839
C57-APOE4 0.08383333 -0.4061425 0.5738092 0.8924974
$`Treatment:Gene`
diff lwr upr p adj
LPS:APOE3-Control:APOE3 -6.126000000 -6.9984204 -5.2535796 0.0000000
Control:APOE4-Control:APOE3 -0.007666667 -0.8800870 0.8647537 1.0000000
LPS:APOE4-Control:APOE3 -6.364666667 -7.2370870 -5.4922463 0.0000000
Control:C57-Control:APOE3 -0.149000000 -1.0214204 0.7234204 0.9910206
LPS:C57-Control:APOE3 -6.055666667 -6.9280870 -5.1832463 0.0000000
Control:APOE4-LPS:APOE3 6.118333333 5.2459130 6.9907537 0.0000000
LPS:APOE4-LPS:APOE3 -0.238666667 -1.1110870 0.6337537 0.9341054
Control:C57-LPS:APOE3 5.977000000 5.1045796 6.8494204 0.0000000
LPS:C57-LPS:APOE3 0.070333333 -0.8020870 0.9427537 0.9997447
LPS:APOE4-Control:APOE4 -6.357000000 -7.2294204 -5.4845796 0.0000000
Control:C57-Control:APOE4 -0.141333333 -1.0137537 0.7310870 0.9929345
LPS:C57-Control:APOE4 -6.048000000 -6.9204204 -5.1755796 0.0000000
Control:C57-LPS:APOE4 6.215666667 5.3432463 7.0880870 0.0000000
LPS:C57-LPS:APOE4 0.309000000 -0.5634204 1.1814204 0.8336034
LPS:C57-Control:C57 -5.906666667 -6.7790870 -5.0342463 0.0000000