-
Notifications
You must be signed in to change notification settings - Fork 0
/
Weight and Bloodwork plots.R
147 lines (117 loc) · 4.65 KB
/
Weight and Bloodwork plots.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
library(ggplot2)
library(tidyr)
library(dplyr)
library(readxl)
library(patchwork)
#data <- read_excel("C:/Users/edmondsonef/Desktop/MHL 22-331-17 PK.xlsx")
#data <- dplyr::filter(data, Censor == 1)
#####Organ Weight
#####
dataW <- dplyr::select(data, PHLNbr, Group, #Groups,
Weight,
`Brain Weight`,
`Heart Weight`,
`Kidney Weight`,
`Liver Weight`,
`Lung Weight`,
`Spleen Weight`, Age)
body_weight <- dataW %>% gather(key= "Organ", grams, 3) %>%
ggplot(aes(x = factor(Group), y = grams))+
geom_boxplot(outlier.shape = NA, colour = "lightgray")+
theme_bw() +
theme(axis.title.x=element_blank(), text = element_text(size = 16))+
geom_jitter(aes(x = Group, y = grams, color = dataW$`Group`), width = 0.1, size = 4)+
facet_wrap(~Organ, scales = "free")
body_weight
organ_weight <- dataW %>%
gather(key= "Organ", grams, 4:9) %>%
ggplot(aes(x = factor(Group), y = grams))+
geom_boxplot(outlier.shape = NA, colour = "lightgray")+
theme_bw() +
theme(axis.title.x=element_blank(), text = element_text(size = 16))+
geom_jitter(aes(x = Group, y = grams, color = `Group`), width = 0.1, size = 4)+
facet_wrap(~Organ, scales = "free", nrow=2)
organ_weight
setwd("C:/Users/edmondsonef/Desktop/R-plots/")
tiff("Absolute Organ Weights-age.tiff", units="in", width=22, height=8, res=100)
(body_weight | organ_weight)+
plot_layout(guides = "collect") +
plot_layout(widths = c(2, 3))+
plot_annotation(title = "Absolute Organ Weights (grams)")
dev.off()
#####
#####Relative Organ Weight
#####
dataWPerc <- dplyr::select(data, PHLNbr,Group, #Groups,
Weight,
`Brain % BW`,
`Heart % BW`,
`Kidney % BW`,
`Liver % BW`,
`Lung % BW`,
`Spleen % BW`, Age)
relative_weight <- dataWPerc %>%
gather(key= "Organ", value, 4:9) %>%
ggplot(aes(x = factor(Group), y = value))+
geom_boxplot(outlier.shape = NA, colour = "lightgray")+
theme_bw() +
theme(axis.title.x=element_blank(), text = element_text(size = 16))+
geom_jitter(aes(x = Group, y = value, color = `Group`), width = 0.1, size = 4)+
facet_wrap(~Organ, scales = "free", nrow=2)
relative_weight
tiff("Relative Organ Weights - age.tiff", units="in", width=22, height=8, res=100)
(body_weight | relative_weight)+
plot_layout(guides = "collect") +
plot_layout(widths = c(2, 3))+
plot_annotation(title = "Relative Organ Weights")
dev.off()
#####
#####CBC
#####
### WBC Plot
dataCBC <- dplyr::select(data, PHLNbr,Group, #Groups,
WBC,NE,LY,MO,EO,BA,RBC,Hb,HCT,MCH,MCH,MCHC,RDW,Retics,PLT,MPV)
WBC <- dataCBC %>% gather(key= "Value", value, 4) %>%
geom_errorbar(data = my_info, aes(x = Group, ymin = ref.low, ymax = ref.hi), color = "#f5f5f5", width = 0, size=10) +
ggplot(aes(x = factor(Group), y = value))+
geom_boxplot(outlier.shape = NA, colour = "lightgray")+
theme_bw() +
theme(axis.title.x=element_blank(), text = element_text(size = 16))+
geom_jitter(aes(x = Group, y = value, color = `Groups`), width = 0.1, size = 4)+
facet_wrap(~Value, scales = "free")
WBC
CBC <- dataCBC %>%
gather(key= "Value", value, 4:9) %>%
ggplot(aes(x = factor(Group), y = value))+
geom_boxplot(outlier.shape = NA, colour = "lightgray")+
theme_bw() +
theme(axis.title.x=element_blank(), text = element_text(size = 16))+
geom_jitter(aes(x = Group, y = value, color = `Groups`), width = 0.1, size = 4)+
facet_wrap(~Value, scales = "free", nrow=2)
CBC
tiff("Relative Organ Weights.tiff", units="in", width=22, height=8, res=100)
(body_weight | relative_weight)+
plot_layout(guides = "collect") +
plot_layout(widths = c(2, 3))+
plot_annotation(title = "CBC")
dev.off()
#####
#####Chemistry
#####
dataCHEM <- dplyr::select(data, PHLNbr,Group, Groups,
ALB, ALP, ALT, AMY, TBIL, BUN, Ca, PHOS, CRE, GLU, NaPlus,KPlus,TP, GLOB)
CHEM <- dataCHEM %>%
gather(key= "Organ", value, 4:16) %>%
ggplot(aes(x = factor(Group), y = value))+
geom_boxplot(outlier.shape = NA, colour = "lightgray")+
theme_bw() +
theme(axis.title.x=element_blank(), text = element_text(size = 16))+
geom_jitter(aes(x = Group, y = value, color = `Groups`), width = 0.1, size = 4)+
facet_wrap(~Organ, scales = "free", nrow=2)
CHEM
tiff("Chemistry.tiff", units="in", width=22, height=8, res=100)
(CHEM)+
plot_layout(guides = "collect") +
plot_layout(widths = c(2, 3))+
plot_annotation(title = "Relative Organ Weights (grams)")
dev.off()