-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript results CTS_analyses.R
168 lines (156 loc) · 10.2 KB
/
script results CTS_analyses.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
options(knitr.duplicate.label = "allow")
############################### paths ##############################
path_data_models <- "Data/CTS_analyses/Models"
path_data_models_age <- "Data/CTS_analyses/agegroups/Models"
############################### data ###############################
###################### models celtype ##############################
# univariate model
ADHD_uni_model <- make_univariate_model("ADHD_univariate_model.txt")
ALZ_uni_model <- make_univariate_model("ALZ_univariate_model.txt")
AN_uni_model <- make_univariate_model("AN_univariate_model.txt")
ASD_uni_model <- make_univariate_model("ASD_univariate_model.txt")
BIP_uni_model <- make_univariate_model("BIP_univariate_model.txt")
HGHT_uni_model <- make_univariate_model("HGHT_univariate_model.txt")
INS_uni_model <- make_univariate_model("INS_univariate_model.txt")
MDD_uni_model <- make_univariate_model("MDD_univariate_model.txt")
NEUdep_uni_model <- make_univariate_model("NEUdep_univariate_model.txt")
NEUwor_uni_model <- make_univariate_model("NEUwor_univariate_model.txt")
PTSD_uni_model <- make_univariate_model("PTSD_univariate_model.txt")
SCZ_uni_model <- make_univariate_model("SCZ_univariate_model.txt")
SUDcan_uni_model <- make_univariate_model("SUDcan_univariate_model.txt")
input_ct_uni <- rbind(ADHD_uni_model, ALZ_uni_model, AN_uni_model, ASD_uni_model,
BIP_uni_model, HGHT_uni_model, INS_uni_model, MDD_uni_model,
NEUdep_uni_model, NEUwor_uni_model, PTSD_uni_model, SCZ_uni_model,
SUDcan_uni_model)
rm(ADHD_uni_model, ALZ_uni_model, AN_uni_model, ASD_uni_model,
BIP_uni_model, HGHT_uni_model, INS_uni_model, MDD_uni_model,
NEUdep_uni_model, NEUwor_uni_model, PTSD_uni_model, SCZ_uni_model,
SUDcan_uni_model)
# full model coefficient p value
ADHD_full_model <- make_full_model("ADHD_full_model.results", "CNS", "ADHD")
ALZ_full_model <- make_full_model("ALZ_full_model.results", "CNS", "ALZ")
AN_full_model <- make_full_model("AN_full_model.results", "CNS", "AN")
ASD_full_model <- make_full_model("ASD_full_model.results", "CNS", "ASD")
BIP_full_model <- make_full_model("BIP_full_model.results", "CNS", "BIP")
HGHT_full_model <- make_full_model("HGHT_full_model.results", "CNS", "HGHT")
INS_full_model <- make_full_model("INS_full_model.results", "CNS", "INS")
MDD_full_model <- make_full_model("MDD_full_model.results", "CNS", "MDD")
NEUdep_full_model <- make_full_model("NEUdep_full_model.results", "CNS", "NEUdep")
NEUwor_full_model <- make_full_model("NEUwor_full_model.results", "CNS", "NEUwor")
PTSD_full_model <- make_full_model("PTSD_full_model.results", "CNS", "PTSD")
SCZ_full_model <- make_full_model("SCZ_full_model.results", "CNS", "SCZ")
SUDcan_full_model <- make_full_model("SUDcan_full_model.results", "CNS", "CAN")
input_ct <- rbind(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
rm(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
# full model enrichment
ADHD_full_model <- make_full_model_enrichment("ADHD_full_model.results", "CNS", "ADHD")
ALZ_full_model <- make_full_model_enrichment("ALZ_full_model.results", "CNS", "ALZ")
AN_full_model <- make_full_model_enrichment("AN_full_model.results", "CNS", "AN")
ASD_full_model <- make_full_model_enrichment("ASD_full_model.results", "CNS", "ASD")
BIP_full_model <- make_full_model_enrichment("BIP_full_model.results", "CNS", "BIP")
HGHT_full_model <- make_full_model_enrichment("HGHT_full_model.results", "CNS", "HGHT")
INS_full_model <- make_full_model_enrichment("INS_full_model.results", "CNS", "INS")
MDD_full_model <- make_full_model_enrichment("MDD_full_model.results", "CNS", "MDD")
NEUdep_full_model <- make_full_model_enrichment("NEUdep_full_model.results", "CNS", "NEUdep")
NEUwor_full_model <- make_full_model_enrichment("NEUwor_full_model.results", "CNS", "NEUwor")
PTSD_full_model <- make_full_model_enrichment("PTSD_full_model.results", "CNS", "PTSD")
SCZ_full_model <- make_full_model_enrichment("SCZ_full_model.results", "CNS", "SCZ")
SUDcan_full_model <- make_full_model_enrichment("SUDcan_full_model.results", "CNS", "CAN")
input_ct_enrichment <- rbind(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
rm(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
###################### models age ##############################
# full model coefficient p value
ADHD_full_model <- make_full_model_agegroups("ADHD_full_model.results", "ADHD")
ALZ_full_model <- make_full_model_agegroups("ALZ_full_model.results", "ALZ")
AN_full_model <- make_full_model_agegroups("AN_full_model.results", "AN")
ASD_full_model <- make_full_model_agegroups("ASD_full_model.results", "ASD")
BIP_full_model <- make_full_model_agegroups("BIP_full_model.results", "BIP")
HGHT_full_model <- make_full_model_agegroups("HGHT_full_model.results", "HGHT")
INS_full_model <- make_full_model_agegroups("INS_full_model.results", "INS")
MDD_full_model <- make_full_model_agegroups("MDD_full_model.results", "MDD")
NEUdep_full_model <- make_full_model_agegroups("NEUdep_full_model.results", "NEUdep")
NEUwor_full_model <- make_full_model_agegroups("NEUwor_full_model.results", "NEUwor")
PTSD_full_model <- make_full_model_agegroups("PTSD_full_model.results", "PTSD")
SCZ_full_model <- make_full_model_agegroups("SCZ_full_model.results", "SCZ")
SUDcan_full_model <- make_full_model_agegroups("SUDcan_full_model.results", "CAN")
input_age <- rbind(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
rm(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
# full model enrichment p value
ADHD_full_model <- make_full_model_enrichment_agegroups("ADHD_full_model.results", "ADHD")
ALZ_full_model <- make_full_model_enrichment_agegroups("ALZ_full_model.results", "ALZ")
AN_full_model <- make_full_model_enrichment_agegroups("AN_full_model.results", "AN")
ASD_full_model <- make_full_model_enrichment_agegroups("ASD_full_model.results", "ASD")
BIP_full_model <- make_full_model_enrichment_agegroups("BIP_full_model.results", "BIP")
HGHT_full_model <- make_full_model_enrichment_agegroups("HGHT_full_model.results", "HGHT")
INS_full_model <- make_full_model_enrichment_agegroups("INS_full_model.results", "INS")
MDD_full_model <- make_full_model_enrichment_agegroups("MDD_full_model.results", "MDD")
NEUdep_full_model <- make_full_model_enrichment_agegroups("NEUdep_full_model.results", "NEUdep")
NEUwor_full_model <- make_full_model_enrichment_agegroups("NEUwor_full_model.results", "NEUwor")
PTSD_full_model <- make_full_model_enrichment_agegroups("PTSD_full_model.results", "PTSD")
SCZ_full_model <- make_full_model_enrichment_agegroups("SCZ_full_model.results", "SCZ")
SUDcan_full_model <- make_full_model_enrichment_agegroups("SUDcan_full_model.results", "CAN")
input_age_enrichment <- rbind(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
rm(ADHD_full_model, ALZ_full_model, AN_full_model, ASD_full_model,
BIP_full_model, HGHT_full_model, INS_full_model, MDD_full_model,
NEUdep_full_model, NEUwor_full_model, PTSD_full_model, SCZ_full_model,
SUDcan_full_model)
####################### trait lists ###############################
set.seed(444)
col <- rainbow(1000)
col2 <- sample(col, 13)
# cell type
trait_list_ct <- tibble(
category = c("CNS"),
trait = c("ADHD", "ALZ", "AN", "ASD",
"BIP", "HGHT", "INS", "MDD",
"NEUdep", "NEUwor", "PTSD", "SCZ",
"CAN"),
color = sample(col2, 13)
)
# age groups
trait_list_age <- tibble(
category = c(rep("Hippocampus", times = 13), rep("Prefrontal Cortex", times = 13)),
trait = rep(c("ADHD", "ALZ", "AN", "ASD",
"BIP", "HGHT", "INS", "MDD",
"NEUdep", "NEUwor", "PTSD", "SCZ",
"CAN"), times = 2),
color = rep(col2, times = 2)
)
################### names for CT and AGE ################
ct_names <- tibble(
category = c("CNS"),
cell_type = c("Astrocyte 1", "Astrocyte 2", "Endothelial Cell", "Pyramidal Hippocampal CA 1", "Pyramidal Hippocampal CA 3",
"Granule Neuron Hippocampal Dentate Gyrus Region", "Glutamatergic Neuron PFC 1", "Glutamatergic Neuron PFC 2", ", GABAergic interneuron 1", ", GABAergic interneuron 2",
"Microglia", "Neural Stem Cell", "Oligodendrocyte 1", "Oligodendrocyte Precursor Cell", "Unclassified"),
cell_type_clean = c("ASC1", "ASC2", "END", "exCA1", "exCA3",
"exDG", "exPFC1", "exPFC2", "GABA1", "GABA2",
"MG", "NSC", "ODC1", "OPC", "Unclassified")
)
age_names <- tibble(
category = c(rep("Hippocampus", times = 7), rep("Prefrontal Cortex", times = 7)),
cell_type = rep(c("Early Prenatal", "Middle Prenatal", "Late Prenatal", "Infancy",
"Childhood", "Adolescence", "Adulthood"), times = 2),
cell_type_clean = rep(c("Early Prenatal", "Middle Prenatal", "Late Prenatal", "Infancy",
"Childhood", "Adolescence", "Adulthood"), times = 2)
)