-
Notifications
You must be signed in to change notification settings - Fork 0
/
breastpathway.R
61 lines (38 loc) · 1.31 KB
/
breastpathway.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
library(KEGGgraph)
library(readr)
library(org.Hs.eg.db)
# 这个文件是用来提取调节通路中所有的基因的
filename <- paste (c('extdata/'),c('hsa05224.xml'), sep ="", collapse = NULL)
toyKGML <- system.file(filename,package="KEGGgraph")
toygraph <- parseKGML2Graph(toyKGML,expandGenes=TRUE)
toypathway <- parseKGML(toyKGML)
pathName <- getName(toypathway)
nodeData <- getKEGGnodeData(toygraph)
n <- length(nodeData)
if(n > 0){
for(i in 1:n){
x <-nodeData[[i]]
nodename <- getName(x)
nodeEntryID <- getEntryID(x)
nodeType <- getType(x)
if(nodeType=="gene"){
if(1>0){
p <- nodename
q <- nodeEntryID
if(require(org.Hs.eg.db)) {
ioGeneID <- translateKEGGID2GeneID(nodeEntryID)
nodesNames <- sapply(mget(ioGeneID, org.Hs.egSYMBOL, ifnotfound=NA), "[[",1)
#nodesNames <- sapply(mget(ioGeneID, org.Mm.egSYMBOL, ifnotfound=NA), "[[",1)
} else {
nodesNames <- names(ios)
}
a_list <- list(
NAME=nodesNames[[1]],
TYPE=nodeType
)
print(1)
write.table(a_list,"pathwaygene.txt",append=TRUE,sep=",")
}
}
}
}