Read in Data

histo_data <- read_excel("HIF_Higgins data.xlsx", sheet = 1, range = 'A1:D9') |> pivot_longer(cols = everything(), names_to = 'rx', values_to = 'histo_score') |> separate(col = rx, sep = '\\+',into = c('mouse', 'drug'))

col_length_data <- read_excel("HIF_Higgins data.xlsx", sheet = 2, range = 'A1:D9') |> pivot_longer(cols = everything(), names_to = 'rx', values_to = 'colon_length') |> separate(col = rx, sep = '\\+',into = c('mouse', 'drug'))

Let’s Start With Plots

You can also grid plots, for example:

Start with mouse effect

histo_data |> 
  ggplot(aes(y = histo_score, x = mouse, fill = drug)) +
  geom_boxplot() +
  ggbeeswarm::geom_quasirandom(dodge.width = 0.8) +
  geom_signif(comparisons = list(c('OE', 'WT')),
    y_position = 45,
    test = t.test) +
  scale_fill_manual(labels = c("Ruxolitinib", "Vehicle"),
      values = c("green", "gray80")) +
  theme(legend.position = "top") +
  scale_y_continuous(limits = c(0, 50)) +
  labs(fill = "Treatment",
       title ="Effect of mouse type on Histology Score in response to DSS x 7 Days",
subtitle = "Higher Score = More Severe Colitis\nOE = Overexpressor of HIF-1alpha, WT = Wild Type")

Clearly, there is a mouse effect. The HIF-1 alpha overexpressor (OE) mice have significantly lower histology scores than the wild type (WT) mice, consistent with less severe colitis.

col_length_data |> 
  ggplot(aes(y = colon_length, x = mouse, fill = drug)) +
  geom_boxplot() +
  ggbeeswarm::geom_quasirandom(dodge.width = 0.8) +
  geom_signif(comparisons = list(c('OE', 'WT')),
    y_position = 7.8,
    test = t.test) +
  scale_fill_manual(labels = c("Ruxolitinib", "Vehicle"),
      values = c("green", "gray80")) +
  theme(legend.position = "top") +
  scale_y_continuous(limits = c(0, 9)) +
  labs(fill = "Treatment",
       title ="Effect of mouse type on Colon Length in response to DSS x 7 Days",
       subtitle = "Shorter Colon = More Severe Colitis\nOE = Overexpressor of HIF-1alpha, WT = Wild Type")

Again, there is a mouse effect. The HIF-1 alpha overexpressor (OE) mice have significantly longer colon length than the wild type (WT) mice, consistent with less severe colitis.

Now test drug effect by mouse

histo_data |> 
  ggplot(aes(y = histo_score, x = drug, fill = drug)) +
  geom_boxplot() +
  ggbeeswarm::geom_quasirandom(dodge.width = 0.8) +
  facet_wrap(mouse ~ .) +
  geom_signif(comparisons = list(c('Jaki', 'VEH')),
    y_position = 45,
    test = t.test) +
  scale_fill_manual(labels = c("Ruxolitinib", "Vehicle"),
      values = c("green", "gray80")) +
  theme(legend.position = "top") +
  scale_y_continuous(limits = c(0, 50)) +
   labs(fill = "Treatment",
       title ="Effect of Treatment on Histology Score",
subtitle = "Higher Score = More Severe Colitis")

There is a clear drug effect. The Ruxolitinib treated mice have significantly lower histology scores than the wild type vehicle treated mice, whether OE or WT, consistent with less severe colitis.

col_length_data |> 
  ggplot(aes(y = colon_length, x = drug, fill = drug)) +
  geom_boxplot() +
  ggbeeswarm::geom_quasirandom(dodge.width = 0.8) +
  facet_wrap(mouse ~ .) +
  geom_signif(comparisons = list(c('Jaki', 'VEH')),
    y_position = 7.8,
    test = t.test) +
  scale_fill_manual(labels = c("Ruxolitinib", "Vehicle"),
      values = c("green", "gray80")) +
  theme(legend.position = "top") +
  scale_y_continuous(limits = c(0, 8.5)) +
  labs(fill = "Treatment",
       title ="Effect of Treatment on Colon Length",
       subtitle = "Shorter Colon = More Severe Colitis")

There is a clear drug effect, which interacts with mouse type. The Ruxolitinib treated mice have significantly longer colon length than the vehicle treated OE mice, consistent with less severe colitis. The WT mice have a similar trend, but the difference is not significant.

Modeling for interaction

  lm(histo_score ~ mouse + drug, data = histo_data) |> 
  broom::tidy()
## # A tibble: 3 × 5
##   term        estimate std.error statistic  p.value
##   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
## 1 (Intercept)    16.7       1.55     10.8  1.03e-11
## 2 mouseWT         9.25      1.78      5.18 1.53e- 5
## 3 drugVEH        11         1.78      6.16 1.02e- 6

Wild type and drug effect is significant, but not the interaction. Both independently add to the histology score (mouse WT + 9.25, Vehicle + 11)

now model colon length

  lm(colon_length ~ mouse + drug, data = col_length_data) |> 
  broom::tidy()
## # A tibble: 3 × 5
##   term        estimate std.error statistic  p.value
##   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
## 1 (Intercept)     6.26     0.160     39.1  1.22e-26
## 2 mouseWT        -1.19     0.185     -6.42 5.07e- 7
## 3 drugVEH        -0.65     0.185     -3.51 1.47e- 3

Wild type and drug effect is significant, while the interaction is again not quite significant. Both independently reduce the colon length (mouse WT -1.19, Vehicle - 0.65).