-
Notifications
You must be signed in to change notification settings - Fork 3
/
2.1_GO_categories.R
39 lines (32 loc) · 1.5 KB
/
2.1_GO_categories.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
################################################################################
# Merge GO ids of apoptosis and autophagy biological process, and remove cell-
# type specific apoptosis processes
# Author: Miguel Angel Garcia-Campos - https://github.com/AngelCampos
################################################################################
# Load/install packages
if (!require("dplyr")) {
install.packages("dplyr", dependencies = TRUE)
library(dplyr)
}
# Load GO ids (apoptosis, autophagy, cell-type specific apoptosis)
apop <- read.table(file = "GO.apoptotic_process.txt", header = F, sep = "\t",
row.names = 1, as.is = T)
autop <- read.table(file = "GO.autophagy.txt", header = F, sep = "\t",
row.names = 1, as.is = T)
cts.apop <- read.table(file = "GO.cell-type specific apoptotic process.txt",
header = F, sep = "\t", row.names = 1, as.is = T)
# Remove CTSA GO ids
just_apop <- apop[!rownames(apop) %in% rownames(cts.apop), ]
# Write pathways of apoptosis WITHOUT CTS apoptosis TXT file
write.table(x = just_apop, file = "GO.apoptotic_process_WITHOUT_ctsapop.txt",
sep = "\t", row.names = T, col.names = F)
# Merge resulting matrices
apop_autop <- bind_rows(just_apop, autop)
# Name rows with GO ids
x <- rownames(just_apop)
y <- rownames(autop)
z <- c(x,y)
rownames(apop_autop) <- z
# Write final set of GO ids to a TXT file
write.table(x = apop_autop, file = "GO.apoptotic_process+autophagy.txt",
sep = "\t", row.names = T, col.names = F)