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 = 6)
data3 <- NB_data
# Display the first few rows of the imported data
head(data3)# A tibble: 6 × 4
Sample Gene Treatment NLRP3_Protein
<dbl> <chr> <chr> <dbl>
1 1 C57 Control 1.3
2 2 C57 LPS 4.6
3 3 C57 Control 0.8
4 4 C57 LPS 2.9
5 5 C57 Control 1.4
6 6 C57 LPS 2.8
# 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_Protein
<dbl> <fct> <fct> <dbl>
1 1 C57 Control 1.3
2 2 C57 LPS 4.6
3 3 C57 Control 0.8
4 4 C57 LPS 2.9
5 5 C57 Control 1.4
6 6 C57 LPS 2.8
# Perform a two-way ANOVA (Assuming 'NLRP3_Protein' is the dependent variable)
anova_result <- aov(NLRP3_Protein ~ Treatment * Gene, data = data3)
# Display the summary of ANOVA results
summary(anova_result) Df Sum Sq Mean Sq F value Pr(>F)
Treatment 1 128.34 128.34 55.883 1.32e-06 ***
Gene 3 224.14 74.71 32.531 4.84e-07 ***
Treatment:Gene 3 48.24 16.08 7.001 0.0032 **
Residuals 16 36.75 2.30
---
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_Protein ~ Treatment * Gene, data = data3)
$Treatment
diff lwr upr p adj
LPS-Control 4.625 3.313435 5.936565 1.3e-06
$Gene
diff lwr upr p adj
APOE4-APOE3 3.15000000 0.6467212 5.653279 0.0115497
C57-APOE3 -4.10000000 -6.6032788 -1.596721 0.0012759
LPS-APOE3 -4.13333333 -6.6366121 -1.630055 0.0011820
C57-APOE4 -7.25000000 -9.7532788 -4.746721 0.0000019
LPS-APOE4 -7.28333333 -9.7866121 -4.780055 0.0000018
LPS-C57 -0.03333333 -2.5366121 2.469945 0.9999792
$`Treatment:Gene`
diff lwr upr p adj
LPS:APOE3-Control:APOE3 5.3333333 1.0493347 9.6173319 0.0097791
Control:APOE4-Control:APOE3 1.3333333 -2.9506653 5.6173319 0.9527649
LPS:APOE4-Control:APOE3 10.3000000 6.0160014 14.5839986 0.0000074
Control:C57-Control:APOE3 -2.5666667 -6.8506653 1.7173319 0.4683577
LPS:C57-Control:APOE3 -0.3000000 -4.5839986 3.9839986 0.9999961
Control:LPS-Control:APOE3 -2.4333333 -6.7173319 1.8506653 0.5301749
LPS:LPS-Control:APOE3 -0.5000000 -4.7839986 3.7839986 0.9998753
Control:APOE4-LPS:APOE3 -4.0000000 -8.2839986 0.2839986 0.0763979
LPS:APOE4-LPS:APOE3 4.9666667 0.6826681 9.2506653 0.0174103
Control:C57-LPS:APOE3 -7.9000000 -12.1839986 -3.6160014 0.0001922
LPS:C57-LPS:APOE3 -5.6333333 -9.9173319 -1.3493347 0.0060939
Control:LPS-LPS:APOE3 -7.7666667 -12.0506653 -3.4826681 0.0002334
LPS:LPS-LPS:APOE3 -5.8333333 -10.1173319 -1.5493347 0.0044483
LPS:APOE4-Control:APOE4 8.9666667 4.6826681 13.2506653 0.0000427
Control:C57-Control:APOE4 -3.9000000 -8.1839986 0.3839986 0.0884163
LPS:C57-Control:APOE4 -1.6333333 -5.9173319 2.6506653 0.8783953
Control:LPS-Control:APOE4 -3.7666667 -8.0506653 0.5173319 0.1071019
LPS:LPS-Control:APOE4 -1.8333333 -6.1173319 2.4506653 0.8061722
Control:C57-LPS:APOE4 -12.8666667 -17.1506653 -8.5826681 0.0000004
LPS:C57-LPS:APOE4 -10.6000000 -14.8839986 -6.3160014 0.0000051
Control:LPS-LPS:APOE4 -12.7333333 -17.0173319 -8.4493347 0.0000004
LPS:LPS-LPS:APOE4 -10.8000000 -15.0839986 -6.5160014 0.0000040
LPS:C57-Control:C57 2.2666667 -2.0173319 6.5506653 0.6098519
Control:LPS-Control:C57 0.1333333 -4.1506653 4.4173319 1.0000000
LPS:LPS-Control:C57 2.0666667 -2.2173319 6.3506653 0.7046888
Control:LPS-LPS:C57 -2.1333333 -6.4173319 2.1506653 0.6735184
LPS:LPS-LPS:C57 -0.2000000 -4.4839986 4.0839986 0.9999998
LPS:LPS-Control:LPS 1.9333333 -2.3506653 6.2173319 0.7644856