-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
269 lines (269 loc) · 9.94 KB
/
.Rhistory
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
source("KEGGGraphLoader.Rproj")
source("KEGGLoader.R")
View(gene.db)
View(gene.db)
gene.db.edit <- data.frame()
for(r in gene.db){
if(r["symbol"]!="" &&r["entrez"]!="" && !is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
gene.db.edit <- rbind(gene.db.edit,n)
}
}
for(r in gene.db){
if(r["symbol"]!="" &&r["entrez"]!="" && !is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
gene.db.edit <- data.frame(gene.db.edit,n)
}
}
View(gene.db.edit)
for(r in gene.db){
if(r["symbol"]!="" &&r["entrez"]!="" && !is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
gene.db.edit <- c(gene.db.edit,n)
}
}
for(r in gene.db){
if(r["symbol"]!="" &&r["entrez"]!="" && !is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
View(n)
gene.db.edit <- c(gene.db.edit,n)
}
}
for(r in gene.db){
if(r["symbol"]!="" &&r["entrez"]!="" && !is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
print(n)
gene.db.edit <- c(gene.db.edit,n)
}
}
View(gene.db)
for(r in gene.db){
print(r)
if(r["symbol"]!="" &&r["entrez"]!="" && !is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
print(n)
gene.db.edit <- c(gene.db.edit,n)
}
}
gene.db.edit <- data.frame()
for(r in gene.db){
if(!is.na(r["entrez"])){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
print(n)
gene.db.edit <- c(gene.db.edit,n)
}
}
View(gene.db)
is.na(gene.db[1,"entrez"])
View(gene.db)
is.na(gene.db[6,"entrez"])
for(r in gene.db){
if(is.na(r["entrez"])){
next
}
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
print(n)
gene.db.edit <- c(gene.db.edit,n)
}
View(gene.db.edit)
for(r in gene.db){
n <- data.frame("ensembl"=r["ensembl"],"symbol"=r["symbol"],"entrez"=as.character(r["entrez"]))
print(n)
gene.db.edit <- c(gene.db.edit,n)
}
View(gene.db)
for(r in gene.db){
if(is.na(r["entrez"])){
print(r)
}
}
gene.db <- na.omit(gene.db)
View(gene.db)
gene.db[gene.db=="",]<-NA
gene.db[gene.db$symbol=="",]<-NA
gene.db <- na.omit(gene.db)
View(gene.db)
for(r in gene.db){
r["entrez"]<-as.character(r["entrez"])
}
View(gene.db)
class(r$entrez)
class(gene.db$entrez)
for(i in 1:nrow(gene.db)){
gene.db[i,"entrez"]<-as.character(gene.db[i,"entrez"])
}
View(gene.db)
save(c(gene.db,kegg.relationship.db),"database")
save(c(gene.db,kegg.relationship.db),file="database")
save(list = c(gene.db,kegg.relationship.db),file="database")
save(c(gene.db,kegg.relationship.db),file="database")
save(c("gene.db","kegg.relationship.db"),file="database")
save(gene.db,file="database.gene")
save(gene.db,kegg.relationship.db,file="database.gene")
save(gene.db,kegg.relationship.db,file="database")
source("KEGGLoader.R")
View(gene.db)
convertGeneID("PORCN","symbol","entrez")
getTarget(convertGeneID("PORCN","symbol","entrez"),ajd.mat.wnt)
wnt <- getPathwayRelationshipTable("hsa04310")
ajd.mat.wnt <- createAdjacencyMatrix(wnt,FALSE)
getTarget(convertGeneID("PORCN","symbol","entrez"),ajd.mat.wnt)
tes <- sapply(getTarget(convertGeneID("PORCN","symbol","entrez"),ajd.mat.wnt),function(x){
convertGeneID(x,"entrez","symbol")
})
tes <- sapply(getTarget(convertGeneID("PORCN","symbol","entrez"),ajd.mat.wnt),function(x){
convertGeneID(x,"entrez","symbol")
},simplify=TRUE)
convertGeneID("7473","entrez","symbol")
convertGeneID <- function(query,from,to){
if(from=="ensembl"){
return(unique(gene.db[gene.db$ensembl==query,to]))
}
if(from=="symbol"){
return(unique(gene.db[gene.db$symbol==query,to]))
}
if(from=="entrez"){
return(unique(gene.db[gene.db$entrez==query,to]))
}
}
tes <- sapply(getTarget(convertGeneID("PORCN","symbol","entrez"),ajd.mat.wnt),function(x){
convertGeneID(x,"entrez","symbol")
},simplify=TRUE)
tes
View(tes)
getTargetSimple <- function(gene,matrix){
output <- sapply(getTarget(convertGeneID(gene,"symbol","entrez"),matrix),function(x){
convertGeneID(x,"entrez","symbol")
},simplify=TRUE)
output
}
getTargetSimple()
getTargetSimple("PORCN",ajd.mat.wnt)
getTFSimple <- function(gene,matrix){
output <- sapply(getTF(convertGeneID(gene,"symbol","entrez"),matrix),function(x){
convertGeneID(x,"entrez","symbol")
},simplify=TRUE)
output
}
getTFSimple("LEF1",ajd.mat.wnt)
View(kegg.relationship.db)
tes <- read.table("E:\Dropbox\kuliah\M1\Reference\thesis\logFC.xlsx")
tes <- read.table("E/Dropbox/kuliah/M1/Reference/thesis/logFC.xlsx")
tes <- read.table("logFC.xlsx")
View(tes)
tes <- read.table("logFC.csv",header=TRUE,row.names = 4,sep=";")
View(tes)
plot(log2FoldChange~-log10(padj),data=tes)
plot(-log10(padj)~log2FoldChange,data=tes)
install.packages(“calibrate”)
install.packages("calibrate")
library(calibrate)
textxy(tes$log2FoldChange, -log10(tes$padj), rownames(tes))
plot(-log10(padj)~log2FoldChange,data=tes)
textxy(tes[c(1,6,18,30,56),"log2FoldChange"], -log10(tes[c(1,6,18,30,56),"padj"]), rownames(tes[c(1,6,18,30,56),]))
plot(-log10(padj)~log2FoldChange,data=tes,)
plot(-log10(padj)~log2FoldChange,data=tes)
par(pch=16)
plot(-log10(padj)~log2FoldChange,data=tes)
par(pch=16,bg="blue")
plot(-log10(padj)~log2FoldChange,data=tes)
par(pch=16,bg="blue")
par(pch=16)
plot(-log10(padj)~log2FoldChange,data=tes)
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
textxy(tes[c(1,6,18,30,56),"log2FoldChange"], -log10(tes[c(1,6,18,30,56),"padj"]), rownames(tes[c(1,6,18,30,56),]))
?texty
??textxy
plot(-log10(padj)~log2FoldChange,data=tes)
textxy(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(0, -1, untf = FALSE, \dots)
abline(0, -1)
abline(0, 0)
abline(1, 0)
plot(-log10(padj)~log2FoldChange,data=tes)
textxy(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(v=0)
plot(-log10(padj)~log2FoldChange,data=tes)
textxy(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(v=0,col = "lightgray")
abline(h=0,col = "lightgray")
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
plot(-log10(padj)~log2FoldChange,data=tes)
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
tes <- read.table("logFC.csv",header=TRUE,row.names = 4,sep=";")
plot(-log10(padj)~log2FoldChange,data=tes)
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=(-0.6),col = "green")
?text
text(6,20,"upregulated area")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"upregulated area")
text(-2,11,"downregulated area")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"up regulated")
text(-2,11,"down regulated")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"up regulated",col="red")
text(-2,11,"down regulated",col="green")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"up regulated",col="red")
text(-2.4,11,"down regulated",col="green")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"up regulated",col="red")
text(-2.4,16,"down regulated",col="green")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes)
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"up regulated",col="red")
text(-2.4,20,"down regulated",col="green")
par(pch=16,bg="white")
plot(-log10(padj)~log2FoldChange,data=tes,ylab = "-log10(pvalue)")
text(tes[c(1,3,12,6,19,18,78,96,30,56),"log2FoldChange"], -log10(tes[c(1,3,12,6,19,18,78,96,30,56),"padj"]), rownames(tes[c(1,3,12,6,19,18,78,96,30,56),]))
abline(h=0,col = "lightgray")
abline(v=0,col = "lightgray")
abline(v=0.6,col = "red")
abline(v=-0.6,col = "green")
text(5,20,"up regulated",col="red")
text(-2.4,20,"down regulated",col="green")