-
Notifications
You must be signed in to change notification settings - Fork 15
/
00_Intro.R
56 lines (45 loc) · 1.57 KB
/
00_Intro.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
#######################################
### Project: Network Medicine Framework for Identifying Drug Repurposing Opportunities for COVID-19.
### Description: Descriptive analysis
### Find Disease Module, Significance and Network Visualization
### Author: Deisy Gysi
### date: March 1st 2021
#######################################
rm(list = ls())
library(tidyr)
require(magrittr)
require(data.table)
require(igraph)
require(dplyr)
require(NetSci)
PPI = fread("DatasetS2.csv") # Read PPI
COVID = fread("DatasetS1.csv") # Read COVID Genes
PPI %<>% filter(!is.na(proteinA_entrezid) & !is.na(proteinB_entrezid))
gPPI = graph_from_data_frame(PPI, directed = F) %>%
simplify() # Create the PPI network and remove self-loops
Target_COVID = COVID %>%
pull(EntrezID) %>%
as.character()
gCOVID = gPPI %>%
induced.subgraph(., vids = Target_COVID ) # Select the subgraph from COVID
# Plot it
V(gCOVID)$label = NA
gCOVID %<>% simplify()
V(gCOVID)$size = degree(gCOVID)
V(gCOVID)$size = degree(gCOVID) %>% CoDiNA::normalize()
V(gCOVID)$size = (V(gCOVID)$size + 0.1)*5
gCOVID %<>% delete.vertices(., degree(.) == 0)
coord = layout_with_fr(gCOVID)
V(gCOVID)$label = ifelse(V(gCOVID)$size > 2.5, V(gCOVID)$name, NA)
E(gCOVID)$curved =0.1
V(gCOVID)$color = V(gCOVID)$frame.color = "red"
V(gCOVID)$label.color = "darkred"
V(gCOVID)$label.cex = V(gCOVID)$size/5
E(gCOVID)$color = 'salmon1'
plot(gCOVID)
# Calculate the LCC significance, degree preserving
LCC = LCC_Significance(N = 1000,
Targets = Target_COVID,
G = gPPI)
# Plot the distribution
Histogram_LCC(LCC)