Data organization and create plots
# Create a plot for Total Essential Amino Acids (EAA)
Fig.EAA <- PP.untargeted.serum %>% inner_join(PigInfo, by = "PigID") %>%
mutate(EAA = histidine + isoleucine + leucine + lysine + methionine + phenylalanine + threonine + tryptophan + valine) %>%
mutate(TimePoint = factor(TimePoint, levels = c("baseline", "30 min", "60 min", "120 min"))) %>%
mutate(Diet = factor(Diet, levels = c("ALAC", "WPI"))) %>%
ggerrorplot(x = "TimePoint", y = "EAA", color = "Diet", ylab = "Total EAA (normalized intensity)", xlab = "", add = "mean", error.plot = "errorbar", size = 0.8, position = position_dodge(0.3), palette = c("turquoise3","purple")) + yscale("scientific")
# Create a plot for Tryptophan to other Large Neutral Amino Acid ratio (Trp:LNAA)
# LNAA calculated at the sum of valine, isoleucine, leucine, phenylalanine, and tyrosine.
Fig.Trp_to_LNAA <- PP.untargeted.serum %>% inner_join(PigInfo, by = "PigID") %>%
mutate(Trp_to_LNAA = tryptophan / (valine + isoleucine + leucine + phenylalanine + tyrosine)) %>%
mutate(TimePoint = factor(TimePoint, levels = c("baseline", "30 min", "60 min", "120 min"))) %>%
mutate(Diet = factor(Diet, levels = c("ALAC", "WPI"))) %>%
ggerrorplot(x = "TimePoint", y = "Trp_to_LNAA", color = "Diet", ylab = "Tryptophan:LNAA", xlab = "", add = "mean", error.plot = "errorbar", size = 0.8, position = position_dodge(0.3), palette = c("turquoise3","purple"))
# Create a plot for Tryptophan concentration
Fig.Trp <- PP.targeted.serum %>% inner_join(PigInfo, by = "PigID") %>%
mutate(TimePoint = factor(TimePoint, levels = c("baseline", "30 min", "60 min", "120 min"))) %>%
mutate(Diet = factor(Diet, levels = c("ALAC", "WPI"))) %>%
ggerrorplot(x = "TimePoint", y = "Tryptophan", color = "Diet", ylab = "Tryptophan (uM)", xlab = "", add = "mean", error.plot = "errorbar", size = 0.8, position = position_dodge(0.3), palette = c("turquoise3","purple"))
# Create a plot for Kynurenine concentration
Fig.Kyn <- PP.targeted.serum %>% inner_join(PigInfo, by = "PigID") %>%
mutate(TimePoint = factor(TimePoint, levels = c("baseline", "30 min", "60 min", "120 min"))) %>%
mutate(Diet = factor(Diet, levels = c("ALAC", "WPI"))) %>%
ggerrorplot(x = "TimePoint", y = "Kynurenine", color = "Diet", ylab = "Kynurenine (uM)", xlab = "", add = "mean", error.plot = "errorbar", size = 0.8, position = position_dodge(0.3), palette = c("turquoise3","purple"))
# Create a plot for Serotonin concentration
Fig.Sere <- PP.targeted.serum %>% inner_join(PigInfo, by = "PigID") %>%
mutate(TimePoint = factor(TimePoint, levels = c("baseline", "30 min", "60 min", "120 min"))) %>%
mutate(Diet = factor(Diet, levels = c("ALAC", "WPI"))) %>%
ggerrorplot(x = "TimePoint", y = "Serotonin", color = "Diet", ylab = "Serotonin (uM)", xlab = "", add = "mean", error.plot = "errorbar", size = 0.8, position = position_dodge(0.3), palette = c("turquoise3","purple"))
# Arrange all the individual plots into a single figure
Fig.all <- ggarrange(Fig.EAA,Fig.Trp_to_LNAA, Fig.Trp, Fig.Kyn, Fig.Sere, nrow = 2, ncol = 3, common.legend = TRUE)
# save the figure to a pdf file:
ggsave(plot=Fig.all, height=7.5, width=11, dpi=300, filename="Figure 2/Fig2A-E.pdf", useDingbats=FALSE)
Fig.all

Group difference evaluation
#This function transforms the input values by the generalized #log function.
glog <- function(y) {
#Using lambda = 1
yt <- log(y+sqrt(y^2+1))
return(yt)
}
Total EAA
# Perform ANOVA for Total EAA
PP.untargeted.serum %>%
inner_join(PigInfo, by = "PigID") %>%
mutate(EAA = histidine + isoleucine + leucine + lysine + methionine + phenylalanine + threonine + tryptophan + valine) %>% # Calculate total EAA
mutate(glog.EAA = glog(EAA)) %>% # apply glog transformation
select(SowID, glog.EAA, Diet, TimePoint) %>%
group_by(TimePoint) %>%
anova_test(glog.EAA ~ Diet + SowID, type = 1) %>%
as_tibble() %>%
filter(Effect == "Diet") %>% # Select relevant columns for reporting
kable() %>% # Print the tibble in a nice table format
kable_styling(bootstrap_options = c("striped", "hover")) # Enhance table formatting
TimePoint
|
Effect
|
DFn
|
DFd
|
F
|
p
|
p<.05
|
ges
|
120 min
|
Diet
|
1
|
11
|
0.033
|
0.860
|
|
3.0e-03
|
30 min
|
Diet
|
1
|
13
|
0.188
|
0.672
|
|
1.4e-02
|
60 min
|
Diet
|
1
|
16
|
0.001
|
0.974
|
|
6.7e-05
|
baseline
|
Diet
|
1
|
16
|
1.504
|
0.238
|
|
8.6e-02
|
Tryptophan:LNAA
# Perform ANOVA for Tryptophan:LNAA ratio
PP.untargeted.serum %>%
inner_join(PigInfo, by = "PigID") %>%
mutate(Trp_to_LNAA = tryptophan / (valine + isoleucine + leucine + phenylalanine + tyrosine)) %>% # Calculate Trp to LNAA ratio
mutate(glog.Trp_to_LNAA = glog(Trp_to_LNAA * 100)) %>% # Scale values by 100 and apply glog transformation
select(SowID, glog.Trp_to_LNAA, Diet, TimePoint) %>%
group_by(TimePoint) %>%
anova_test(glog.Trp_to_LNAA ~ Diet + SowID, type = 1) %>%
as_tibble() %>%
filter(Effect == "Diet") %>% # Select relevant columns for reporting
kable() %>% # Print the tibble in a nice table format
kable_styling(bootstrap_options = c("striped", "hover")) # Enhance table formatting
TimePoint
|
Effect
|
DFn
|
DFd
|
F
|
p
|
p<.05
|
ges
|
120 min
|
Diet
|
1
|
11
|
9.278
|
1.10e-02
|
|
0.458
|
30 min
|
Diet
|
1
|
13
|
10.147
|
7.00e-03
|
|
0.438
|
60 min
|
Diet
|
1
|
16
|
28.115
|
7.15e-05
|
|
0.637
|
baseline
|
Diet
|
1
|
16
|
24.586
|
1.42e-04
|
|
0.606
|