-
Notifications
You must be signed in to change notification settings - Fork 1
/
04-application.Rmd
187 lines (142 loc) · 6.33 KB
/
04-application.Rmd
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Method for drug-repurpusing
In this Chapter, we will learn how to calculate the proximity of a drug to a disease - and infer drug repurpusing (Session \@ref(proximity))- based on network methodologies.
There are different methods that are used for drug-repurpusing based on networks, such as the **diffusion state distance (DSD)** [@Cao2013], that uses a **graph diffusion property** to derive a similarity metric for pairs of nodes, it takes into account how their similarly affect the rest of the network; and **AI-based methods**, where a heterogeneous graph $G = (V,R)$ with N nodes $v_i \in V$ representing distinct types of biomedical entities and labeled edges representing semantically distinct types of edges between the entities (i.e., protein-protein interactions, drug-target associations, disease-protein associations, and drug-disease indications) and are tasked to predict drugs for a particular disease [@Zitnik2018]. Due to the limited time, we will focus only on the proximity-based method.
For this, we will be using the `R` package `NetSci` and to make the appropriate visualizations we will use `igraph`.
## Proximity
Given G, the set of Disease-Genes, T, the set of drug targets, and d(g,t), the shortest path length between nodes $g \in G$ and $t \in T$ in the network, the proximity can be defined as [@Guney2016]:
$$
d(g,t) = \frac{1}{|\left|T\right||}\sum_{t\in T}\underset{v\in V}\min{d(g,t)}.
$$
A visual representation of the method can be seen in Figure \@ref(fig:proximity).
The proximity for drug 2 to the disease is calculated by the average of the shortest path from its targets to the disease genes. The shortest path from N to D is 1, from F to D is 3, the average is 2.
For Drug 1, we have:
$$d(Drug_1, disease) = \frac{2 + 2 + 1}{3} = 1.66.$$
```{r, results='hide', echo=FALSE}
require(igraph)
mytriangle <- function(coords, v=NULL, params) {
vertex.color <- params("vertex", "color")
if (length(vertex.color) != 1 && !is.null(v)) {
vertex.color <- vertex.color[v]
}
vertex.size <- 1/200 * params("vertex", "size")
if (length(vertex.size) != 1 && !is.null(v)) {
vertex.size <- vertex.size[v]
}
symbols(x=coords[,1], y=coords[,2], bg=vertex.color,
stars=cbind(vertex.size, vertex.size, vertex.size),
add=TRUE, inches=FALSE)
}
# clips as a circle
igraph::add_shape("triangle", clip=shapes("circle")$clip,
plot=mytriangle)
```
```{r proximity,fig.cap='Drug-Target & Disease-Module Proximity. Triangles represent Disease Associated Genes, while circles represent non-associated genes. In dark purple, we see the drugs and light purple, its targets.', results='hide', echo=FALSE}
set.seed(124)
N = 20
DTs = c("M", "C", "H", "F", "N")
A = data.frame(source = sample(LETTERS[1:5], size = N, replace = T),
target = sample(LETTERS[1:15], replace = T, size = N), type = "PPI")
Drug = data.frame(source = c('Drug 1', 'Drug 1','Drug 1','Drug 2', 'Drug 2'),
target = DTs, type = "DT" )
A = unique(A)
A %<>% filter(source != target)
g = igraph::graph_from_data_frame(rbind(A, Drug), directed = F)
V(g)$color = "#FFCDB2"
V(g)$size = (degree(g)+1)*5
V(g)$label.color = '#B5838D'
V(g)$color = ifelse(V(g)$name %in% DTs, '#B65064', V(g)$color )
V(g)$color = ifelse(V(g)$name %in% c("Drug 1", "Drug 2"), '#574474', V(g)$color )
DG = c("D", "B", "K")
V(g)$shape = ifelse(V(g)$name %in% DG, "triangle", "circle")
E(g)$color = '#E5989B'
E(g)$color = ifelse(E(g)$type == "DT", "gray70", E(g)$color)
E(g)$color[c(4,5,9, 8, 16, 18)]<- "#e63946"
E(g)$width = 0.6
E(g)$width[c(4,5,9, 8, 16, 18)]<- 1.5
E(g)$curved = 0.1
V(g)$frame.color = V(g)$color
par(mar = c(0,0,0,0))
plot(g)
```
Similarly to the LCC (Session \@ref(diseasemodule)) it is important to calculate a measure of randomness associate to the proximity. In the same sense, it is important that the nodes being randomized, the nodes are not simply randomly selected from the pool of proteins in the PPI, but rather selected from matching degree proteins. To calculate the significance of the proximity one can calculate its Z-Score or simply calculate the empirical probability under the curve from the empirical distribution. Similarly, the Z-score is given by:
$$
Z-Score_{d(g,t)} = \frac{d(g,t) - \mu_{d(g,t)}}{\sigma_{d(g,t)}}.
$$
## Example in real data
Let's try it to identify drugs that could work for our disease sets. Let's focus on hyperlipidemia and focus on five drugs at first.
- Asenapine;
- Phentermine;
- Simvastatin;
- Pizotifen;
- Eprotirome.
```{r}
hyperlipidemia_genes = Cleaned_GDA %>%
filter(diseaseName == 'hyperlipidemia') %>%
pull(geneSymbol) %>%
unique()
Asenapine_t = DT %>%
filter(Name == 'Asenapine') %>%
pull(Gene_Target)
Asenapine_t
proximity_average(gPPI,
source = hyperlipidemia_genes,
targets = Asenapine_t)
```
Let's do it in a loop:
```{r}
drugs = c("Asenapine",
'Phentermine',
'Simvastatin',
'Pizotifen',
'Eprotirome')
p = list()
for(i in 1:length(drugs)){
d = drugs[i]
Drug_targets = DT %>%
filter(Name %in% d) %>%
pull(Gene_Target)
prox = proximity_average(gPPI,
source = hyperlipidemia_genes,
targets = Drug_targets)
p[[i]] = data.frame(prox = prox,
ntargets = length(Drug_targets),
drug = d)
}
p %<>% bind_rows()
```
Now, let's do the same, but also calculating the significance of the proximity.
```{r}
Drug_Target = DT %>%
filter(Name %in% drugs) %>%
select(Name, Gene_Target) %>%
unique()
names(Drug_Target) = c('ID', "Target" )
proximity_significance = avr_proximity_multiple_target_sets(
set = drugs,
G = gPPI,
ST = Drug_Target,
source = hyperlipidemia_genes,
N = 1000,
bins = 100,
min_per_bin = 20
)
```
Which are the drugs that we can use for hyperlipidemia?
```{r}
proximity_significance
```
Now, let us check those drug indications:
```{r}
Indication = DT %>%
filter(Name %in% drugs) %>%
select(Name, Indication) %>%
unique()
Indication
```
## Exercises
1. Test the same drugs for all the five other diseases we are interested. How do those values compare?
- Autistic Disorder;
- Obesity;
- Hyperlipidemia;
- Rheumatoid Arthritis.
2. Choose one disease and visualize the disease module along with each of the drugs we tested.