-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbiogrid_vs_huri.Rmd
166 lines (122 loc) · 4.42 KB
/
biogrid_vs_huri.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
---
title: "HURI VS Biogrid stringent VS BioPlex networks"
author: "Johann Hawe <[email protected]"
output:
html_notebook:
toc: True
---
```{r setup}
library(tidyverse)
library(graph)
source("scripts/lib.R")
source("scripts/reg_net_utils.R")
```
## Load PPI dbs
We load different PPI networks:
- HURI: Human Reference Interactome
- Bioplex: two different networks, one for HEL293T cells and one for HCT116 cells
- Biogrid stringent: Our prior network
```{r load_ppi_dbs}
fannot <- "data/current/gencode_annotations/gencode.v19.annotation.gene.gtf"
ga <- load_gene_annotation(fannot)
ga_tibble <- ga %>% as.data.frame %>% as_tibble(rownames = "ENSG") %>%
mutate(ENSG_gene = gsub("\\..*", "", ENSG)) %>%
dplyr::select(ENSG_gene, SYMBOL)
biogrid_stringent_graph <- readRDS("results/current/ppi_biogrid_stringent.rds")
biogrid_stringent <- graph2table(biogrid_stringent_graph) %>%
dplyr::rename(gene1 = n1, gene2 = n2)
bioplex_hek <- read_tsv("data/current/interactome_bioplex/HEK293T_interactome.tsv") %>%
dplyr::select(gene1 = SymbolA, gene2 = SymbolB)
bioplex_hek_graph <- graphNEL(unique(c(bioplex_hek$gene1, bioplex_hek$gene2)),
edgemode = "undirected")
bioplex_hek_graph <- addEdge(bioplex_hek$gene1, bioplex_hek$gene2, bioplex_hek_graph)
bioplex_hct <- read_tsv("data/current/interactome_bioplex/HCT116_interactome.tsv") %>%
dplyr::select(gene1 = SymbolA, gene2 = SymbolB)
bioplex_hct_graph <- graphNEL(unique(c(bioplex_hct$gene1, bioplex_hct$gene2)),
edgemode = "undirected")
bioplex_hct_graph <- addEdge(bioplex_hct$gene1, bioplex_hct$gene2, bioplex_hct_graph)
huri <- read_tsv("data/current/interactome_atlas_huri/HuRI.tsv",
col_names = c("gene1", "gene2")) %>%
left_join(ga_tibble, by=c("gene1" = "ENSG_gene")) %>%
left_join(ga_tibble, by = c("gene2" = "ENSG_gene")) %>%
dplyr::select(gene1 = SYMBOL.x, gene2 = SYMBOL.y) %>%
tidyr::drop_na()
huri_graph <- graphNEL(unique(c(huri$gene1, huri$gene2)),
edgemode = "undirected")
huri_graph <- addEdge(huri$gene1, huri$gene2, huri_graph)
# filter all networks for expression in whole blood and get largest CC
# (same processing as for priors)
make_prior_network <- function(network) {
fgtex <- "data/current/gtex/GTEx_Analysis_v6_RNA-seq_RNA-SeQCv1.1.8_gene_median_rpkm.gct"
filtered <- filter_expression(fgtex, ga, network)
filtered_largest_cc <- get_largest_cc(filtered)
return(filtered_largest_cc)
}
huri_graph
bioplex_hct_graph
bioplex_hek_graph
huri_graph <- make_prior_network(huri_graph)
bioplex_hct_graph <- make_prior_network(bioplex_hct_graph)
bioplex_hek_graph <- make_prior_network(bioplex_hek_graph)
huri_graph
bioplex_hct_graph
bioplex_hek_graph
```
## Compare PPI DBs
Check general overlaps
```{r overlap_networks}
hg <- huri_graph_expressed_in_blood
pg <- biogrid_stringent_graph
print("HURI graph:")
hg
print("Prior graph:")
pg
print("possible edges huri:")
n <- numNodes(hg)
((n*(n-1))/2)
print("possible edges biogrid:")
n <- numNodes(pg)
((n*(n-1))/2)
print("common nodes:")
length(intersect(nodes(hg), nodes(pg)))
print("intersected graph (keep only common edges):")
cg <- combine_graphs(hg, pg)
cg
print("edges in huri but not biogrid:")
numEdges(hg) - numEdges(cg)
print("edges in biogrid but not huri:")
numEdges(pg) - numEdges(cg)
```
For each possible comparison, we now investigate the overalapping edges in terms of
- number of false positives
- number of false negatives
- MCC
We always set one network as the ground truth
```{r compare_networks}
require(BDgraph)
networks <- list(huri_graph, biogrid_stringent_graph, bioplex_hct_graph, bioplex_hek_graph)
names(networks) <- c("huri", "biogrid", "bioplex_hct", "bioplex_hek")
result <- lapply(names(networks), function(n) {
truth <- networks[[n]]
comparison <- networks[!grepl(n, names(networks))]
lapply(names(comparison), function(comp) {
a <- as(truth, "matrix")
b <- as(comparison[[comp]], "matrix")
common_nodes <- intersect(colnames(a), colnames(b))
a <- a[common_nodes, common_nodes]
b <- b[common_nodes, common_nodes]
t(BDgraph::compare(a,b)) %>%
as_tibble() %>%
mutate(truth = n, comparison = comp) %>%
tail(1)
}) %>% bind_rows()
}) %>% bind_rows()
result
result %>%
xtable::xtable(auto = T,
caption = "Comparison of reference networks in human")
```
## SessionInfo
```{r session_info}
devtools::session_info()
```