-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04_isomorph_classes_tables.R
143 lines (106 loc) · 7.37 KB
/
04_isomorph_classes_tables.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
library(openxlsx)
################################################################################
#### calculate tables with information of on isomorph classes ####
###############################################################################
#### get different characteristics/attributes from a graph
## G: graph (igraoh object)
getInfoFromGraph <- function(G) {
require(igraph)
nr_node <- length(V(G))
nr_node_protein <- sum(V(G)$type)
nr_node_peptide <- sum(!V(G)$type)
degrees_peptide_node <- unname(degree(G))[!V(G)$type]
nr_node_unique_peptides <- sum(degrees_peptide_node == 1)
nr_node_shared_peptides <- nr_node_peptide - nr_node_unique_peptides
nr_edges <- gsize(G)
return(c(nr_node, nr_node_protein, nr_node_peptide, nr_node_unique_peptides,
nr_node_shared_peptides, nr_edges))
}
################################################################################
#### function to generate table:
tab_isomorph_classes <- function (isomorph, file) {
tab <- data.frame(id = 1:(length(isomorph$isomorph_list)),
nr_nodes = rep(NA, length(isomorph$isomorph_list)),
nr_nodes_protein = rep(NA, length(isomorph$isomorph_list)),
nr_nodes_peptide = rep(NA, length(isomorph$isomorph_list)),
nr_nodes_unique_peptide = rep(NA, length(isomorph$isomorph_list)),
nr_nodes_shared_peptide = rep(NA, length(isomorph$isomorph_list)),
nr_edges = rep(NA, length(isomorph$isomorph_list)),
nr_occurrences = rep(NA, length(isomorph$isomorph_list)))
for (i in 1:length(isomorph$isomorph_list)) {
ind <- isomorph$isomorph_list[[i]][1]
G <- isomorph$Graphs[[ind]]
nr_occurrences <- length(isomorph$isomorph_list[[i]])
res <- c(i, getInfoFromGraph(G), nr_occurrences)
tab[i,] <- res
}
write.xlsx(tab, file)
}
################################################################################
#### D1 (without isoforms)
#### D1_fasta_min5AA ####
load("data/D1/D1_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D1_fasta_min5AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D1/D1_fasta/table_isomorph_classes_D1_fasta_min5AA.xlsx")
#### D1_fasta_min6AA ####
load("data/D1/D1_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D1_fasta_min6AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D1/D1_fasta/table_isomorph_classes_D1_fasta_min6AA.xlsx")
#### D1_fasta_min7AA ####
load("data/D1/D1_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D1_fasta_min7AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D1/D1_fasta/table_isomorph_classes_D1_fasta_min7AA.xlsx")
#### D1_fasta_min9AA ####
load("data/D1/D1_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D1_fasta_min9AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D1/D1_fasta/table_isomorph_classes_D1_fasta_min9AA.xlsx")
#### D1_quant ####
load("data/D1/D1_quant/isomorph_classes/isomorph_classes_all_merged_Peptides.RData")
tab_isomorph_classes(isomorph_all_merged_Peptides, file = "data/D1/D1_quant/table_isomorph_classes_D1_quant.xlsx")
################################################################################
#### D2 (without isoforms)
#### D2_fasta_min5AA ####
load("data/D2_without_isoforms/D2_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D2_fasta_min5AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D2_without_isoforms/D2_fasta/table_isomorph_classes_D2_fasta_min5AA.xlsx")
#### D2_fasta_min6AA ####
load("data/D2_without_isoforms/D2_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D2_fasta_min6AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D2_without_isoforms/D2_fasta/table_isomorph_classes_D2_fasta_min6AA.xlsx")
#### D2_fasta_min7AA ####
load("data/D2_without_isoforms/D2_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D2_fasta_min7AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D2_without_isoforms/D2_fasta/table_isomorph_classes_D2_fasta_min7AA.xlsx")
#### D2_fasta_min9AA ####
load("data/D2_without_isoforms/D2_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D2_fasta_min9AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D2_without_isoforms/D2_fasta/table_isomorph_classes_D2_fasta_min9AA.xlsx")
#### D2_quant ####
load("data/D2_without_isoforms/D2_quant/isomorph_classes/isomorph_classes_all_merged_Peptides.RData")
tab_isomorph_classes(isomorph_all_merged_Peptides, file = "data/D2_without_isoforms/D2_quant/table_isomorph_classes_D2_quant.xlsx")
################################################################################
#### D3 (without isoforms)
#### D3_fasta_min5AA ####
load("data/D3_without_isoforms/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_without_isoforms_fasta_min5AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3_without_isoforms/D3_fasta/table_isomorph_classes_D3_without_isoforms_fasta_min5AA.xlsx")
#### D3_fasta_min6AA ####
load("data/D3_without_isoforms/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_without_isoforms_fasta_min6AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3_without_isoforms/D3_fasta/table_isomorph_classes_D3_without_isoforms_fasta_min6AA.xlsx")
#### D3_fasta_min7AA ####
load("data/D3_without_isoforms/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_without_isoforms_fasta_min7AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3_without_isoforms/D3_fasta/table_isomorph_classes_D3_without_isoforms_fasta_min7AA.xlsx")
#### D3_fasta_min9AA ####
load("data/D3_without_isoforms/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_without_isoforms_fasta_min9AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3_without_isoforms/D3_fasta/table_isomorph_classes_D3_without_isoforms_fasta_min9AA.xlsx")
#### D3_quant ####
load("data/D3_without_isoforms/D3_quant/isomorph_classes/isomorph_classes_all_merged_Peptides.RData")
tab_isomorph_classes(isomorph_all_merged_Peptides, file = "data/D3_without_isoforms/D3_quant/table_isomorph_classes_D3_without_isoforms_quant.xlsx")
################################################################################
#### D3 (with isoforms)
#### D3_fasta_min5AA ####
load("data/D3/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_fasta_min5AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3/D3_fasta/table_isomorph_classes_D3_fasta_min5AA.xlsx")
#### D3_fasta_min6AA ####
load("data/D3/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_fasta_min6AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3/D3_fasta/table_isomorph_classes_D3_fasta_min6AA.xlsx")
#### D3_fasta_min7AA ####
load("data/D3/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_fasta_min7AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3/D3_fasta/table_isomorph_classes_D3_fasta_min7AA.xlsx")
#### D3_fasta_min9AA ####
load("data/D3/D3_fasta/isomorph_classes/isomorph_classes_merged_Peptides_D3_fasta_min9AA_fast.RData")
tab_isomorph_classes(isomorph, file = "data/D3/D3_fasta/table_isomorph_classes_D3_fasta_min9AA.xlsx")
#### D3_quant ####
load("data/D3/D3_quant/isomorph_classes/isomorph_classes_all_merged_Peptides.RData")
tab_isomorph_classes(isomorph_all_merged_Peptides, file = "data/D3/D3_quant/table_isomorph_classes_D3_quant.xlsx")