-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathempirical10.R
105 lines (83 loc) · 2.66 KB
/
empirical10.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
#####################
### Load packages ###
#####################
library(igraph)
library(combinat)
library(VGAM)
##################
### Parameters ###
##################
set.seed(1)
p <- 0.10
#################
### Functions ###
#################
source("functions.R")
######################
### Empirical Data ###
######################
# Load HuRI data
HuRI <- read.table(file = 'HuRI.tsv',
sep = '\t',
stringsAsFactors = FALSE)
gHuRI <- simplify(graph_from_edgelist(el = as.matrix(HuRI),
directed = FALSE))
V(gHuRI)$name <- as.character(as.numeric(sub(pattern = "ENSG",
replacement = "",
x = V(gHuRI)$name)))
gHuRI10 <- induced_subgraph(graph = gHuRI,
vids = sample(x = V(gHuRI)$name,
size = round(p * gorder(gHuRI))))
# Run minUni
durationHuRI10 <- proc.time()
resultHuRI10 <- deconstruct(g = gHuRI10,
method = "minUni",
returnUV = TRUE)
durationHuRI10 <- proc.time() - durationHuRI10
# Load STRING data and run minUni
name <- c("caena",
"caenp",
"drosa",
"drosp",
"escha",
"eschp",
"homoa",
"homop",
"musma",
"musmp",
"sacca",
"saccp")
gSTR <- list()
resultSTR <- list()
durationSTR <- rep(x = NA,
times = length(name))
for(i in 1:length(name)){
temp <- read.table(file = paste0(name[i],
".tsv"),
sep = '\t',
stringsAsFactors = FALSE)
temp <- simplify(graph_from_edgelist(el = as.matrix(temp),
directed = FALSE))
gSTR[[i]] <- induced_subgraph(graph = temp,
vids = sample(x = V(temp)$name,
size = round(p * gorder(temp))))
V(gSTR[[i]])$name <- as.character(1:length(V(gSTR[[i]])$name))
# Run minUni
durationSTR[i] <- proc.time()[3]
resultSTR[[i]] <- deconstruct(g = gSTR[[i]],
method = "minUni",
returnUV = TRUE)
durationSTR[i] <- proc.time()[3] - durationSTR[i]
}
#############################
### Remove unwanted stuff ###
#############################
rm(gHuRI,
HuRI,
p,
temp)
rm(list = lsf.str())
#################
### Save data ###
#################
save.image("empirical10.RData")