Diff of /6-Figure scripts/Fig S2.R [000000] .. [16eabd]

Switch to unified view

a b/6-Figure scripts/Fig S2.R
1
list.files()
2
3
library(readxl)
4
5
sheets <- excel_sheets("Fig S2 Source Data.xlsx")
6
7
for(s in sheets){
8
  dat <-
9
    read_excel("Fig S2 Source Data.xlsx", sheet = s) %>%
10
    mutate(Color = cut(P, breaks=c(0,0.05,1), labels=c("red3","gray")))
11
  colnames(dat)[1] <- "Var"
12
  
13
  library(ggplot2)
14
  
15
  dat$Var <- factor(dat$Var, levels = rev(dat$Var))
16
  dat$Color <- as.character(dat$Color)
17
  p <- ggplot(dat) +
18
    geom_col(aes(x=R2, y=Var, fill=Color), width = 0.6) +
19
    scale_fill_manual(values = unique(dat$Color)[order(unique(dat$Color))]) +
20
    theme_classic() +  scale_x_continuous(position = "top") +
21
    xlab(s) + ylab("") + 
22
    theme(legend.position = "none")
23
  
24
  assign(paste("P_", s,sep = ""),p, envir = .GlobalEnv)
25
  
26
}
27
28
library(ggpubr)
29
30
ggarrange(ggarrange(P_Taxonomy, P_Function, P_Metabolome, ncol = 3),
31
          ggarrange(P_Transcriptome,`P_Sputum Proteome`, `P_Serum Proteome`,ncol = 3),
32
          nrow = 2)