fusk-kpu commited on
Commit
bbd8905
·
verified ·
1 Parent(s): 0177887

Upload 56 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +22 -0
  2. data/microarray/Metadata/ABA.rds +0 -0
  3. data/microarray/Metadata/Cold.rds +0 -0
  4. data/microarray/Metadata/DC3000.rds +0 -0
  5. data/microarray/Metadata/Drought.rds +0 -0
  6. data/microarray/Metadata/Heat.rds +0 -0
  7. data/microarray/Metadata/High-light.rds +0 -0
  8. data/microarray/Metadata/Hypoxia.rds +0 -0
  9. data/microarray/Metadata/Osmotic.rds +0 -0
  10. data/microarray/Metadata/Oxidation.rds +0 -0
  11. data/microarray/Metadata/Salt.rds +0 -0
  12. data/microarray/Metadata/Wound.rds +0 -0
  13. data/microarray/SRratio/ABA.rds +3 -0
  14. data/microarray/SRratio/Cold.rds +3 -0
  15. data/microarray/SRratio/DC3000.rds +3 -0
  16. data/microarray/SRratio/Drought.rds +3 -0
  17. data/microarray/SRratio/Heat.rds +3 -0
  18. data/microarray/SRratio/High-light.rds +3 -0
  19. data/microarray/SRratio/Hypoxia.rds +3 -0
  20. data/microarray/SRratio/Osmotic.rds +3 -0
  21. data/microarray/SRratio/Oxidation.rds +3 -0
  22. data/microarray/SRratio/Salt.rds +3 -0
  23. data/microarray/SRratio/Wound.rds +3 -0
  24. data/microarray/SRscore_microarray.rds +0 -0
  25. data/rnaseq/Metadata/ABA.rds +0 -0
  26. data/rnaseq/Metadata/Cold.rds +0 -0
  27. data/rnaseq/Metadata/DC3000.rds +0 -0
  28. data/rnaseq/Metadata/Drought.rds +0 -0
  29. data/rnaseq/Metadata/Heat.rds +0 -0
  30. data/rnaseq/Metadata/High-light.rds +0 -0
  31. data/rnaseq/Metadata/Hypoxia.rds +0 -0
  32. data/rnaseq/Metadata/Osmotic.rds +0 -0
  33. data/rnaseq/Metadata/Oxidation.rds +0 -0
  34. data/rnaseq/Metadata/Salt.rds +0 -0
  35. data/rnaseq/Metadata/Wound.rds +0 -0
  36. data/rnaseq/SRratio/ABA.rds +3 -0
  37. data/rnaseq/SRratio/Cold.rds +3 -0
  38. data/rnaseq/SRratio/DC3000.rds +3 -0
  39. data/rnaseq/SRratio/Drought.rds +3 -0
  40. data/rnaseq/SRratio/Heat.rds +3 -0
  41. data/rnaseq/SRratio/High-light.rds +3 -0
  42. data/rnaseq/SRratio/Hypoxia.rds +3 -0
  43. data/rnaseq/SRratio/Osmotic.rds +3 -0
  44. data/rnaseq/SRratio/Oxidation.rds +3 -0
  45. data/rnaseq/SRratio/Salt.rds +3 -0
  46. data/rnaseq/SRratio/Wound.rds +3 -0
  47. data/rnaseq/SRscore_rnaseq.rds +0 -0
  48. data_processing.R +295 -0
  49. global.R +570 -0
  50. negativeSRscore_ma.gmt +0 -0
.gitattributes CHANGED
@@ -32,3 +32,25 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ data/microarray/SRratio/ABA.rds filter=lfs diff=lfs merge=lfs -text
36
+ data/microarray/SRratio/Cold.rds filter=lfs diff=lfs merge=lfs -text
37
+ data/microarray/SRratio/DC3000.rds filter=lfs diff=lfs merge=lfs -text
38
+ data/microarray/SRratio/Drought.rds filter=lfs diff=lfs merge=lfs -text
39
+ data/microarray/SRratio/Heat.rds filter=lfs diff=lfs merge=lfs -text
40
+ data/microarray/SRratio/High-light.rds filter=lfs diff=lfs merge=lfs -text
41
+ data/microarray/SRratio/Hypoxia.rds filter=lfs diff=lfs merge=lfs -text
42
+ data/microarray/SRratio/Osmotic.rds filter=lfs diff=lfs merge=lfs -text
43
+ data/microarray/SRratio/Oxidation.rds filter=lfs diff=lfs merge=lfs -text
44
+ data/microarray/SRratio/Salt.rds filter=lfs diff=lfs merge=lfs -text
45
+ data/microarray/SRratio/Wound.rds filter=lfs diff=lfs merge=lfs -text
46
+ data/rnaseq/SRratio/ABA.rds filter=lfs diff=lfs merge=lfs -text
47
+ data/rnaseq/SRratio/Cold.rds filter=lfs diff=lfs merge=lfs -text
48
+ data/rnaseq/SRratio/DC3000.rds filter=lfs diff=lfs merge=lfs -text
49
+ data/rnaseq/SRratio/Drought.rds filter=lfs diff=lfs merge=lfs -text
50
+ data/rnaseq/SRratio/Heat.rds filter=lfs diff=lfs merge=lfs -text
51
+ data/rnaseq/SRratio/High-light.rds filter=lfs diff=lfs merge=lfs -text
52
+ data/rnaseq/SRratio/Hypoxia.rds filter=lfs diff=lfs merge=lfs -text
53
+ data/rnaseq/SRratio/Osmotic.rds filter=lfs diff=lfs merge=lfs -text
54
+ data/rnaseq/SRratio/Oxidation.rds filter=lfs diff=lfs merge=lfs -text
55
+ data/rnaseq/SRratio/Salt.rds filter=lfs diff=lfs merge=lfs -text
56
+ data/rnaseq/SRratio/Wound.rds filter=lfs diff=lfs merge=lfs -text
data/microarray/Metadata/ABA.rds ADDED
Binary file (500 Bytes). View file
 
data/microarray/Metadata/Cold.rds ADDED
Binary file (951 Bytes). View file
 
data/microarray/Metadata/DC3000.rds ADDED
Binary file (550 Bytes). View file
 
data/microarray/Metadata/Drought.rds ADDED
Binary file (956 Bytes). View file
 
data/microarray/Metadata/Heat.rds ADDED
Binary file (811 Bytes). View file
 
data/microarray/Metadata/High-light.rds ADDED
Binary file (640 Bytes). View file
 
data/microarray/Metadata/Hypoxia.rds ADDED
Binary file (1 kB). View file
 
data/microarray/Metadata/Osmotic.rds ADDED
Binary file (585 Bytes). View file
 
data/microarray/Metadata/Oxidation.rds ADDED
Binary file (556 Bytes). View file
 
data/microarray/Metadata/Salt.rds ADDED
Binary file (1.57 kB). View file
 
data/microarray/Metadata/Wound.rds ADDED
Binary file (794 Bytes). View file
 
data/microarray/SRratio/ABA.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dda376305eb997acc443770fe17f8c5d7762e0a0798d6fc136614564c2a198b3
3
+ size 3187936
data/microarray/SRratio/Cold.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f015239f22f602aa949c80507d620a5177cee3bf589f0641375edbabfbcecd4b
3
+ size 10815085
data/microarray/SRratio/DC3000.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:195c0d13abb2756017dafa798a4013d9eb6af7c74b06b9a89ea6b8e2bf1da582
3
+ size 4358293
data/microarray/SRratio/Drought.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fb98812603e3c6d504b54d2577f74186b41816d0b0215e2e7af267308f62ac9
3
+ size 9986136
data/microarray/SRratio/Heat.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43883f9987293bc08131a80b90b162d58b2b9d07ac31ea257e2653252ea7771c
3
+ size 7519415
data/microarray/SRratio/High-light.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f725f3f81c18cd7dd61358aa8da2679cf42901b00fb3ba83fcc2603c95593e0c
3
+ size 4186143
data/microarray/SRratio/Hypoxia.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:161a9d0caffecf2830052f0b28448269cd45a62a3e18d016edb084f09ec6afbf
3
+ size 11643716
data/microarray/SRratio/Osmotic.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed7f78c77b96bfbe784f874da4f72726f790e79f78ec04252a17d15d2850c120
3
+ size 6048185
data/microarray/SRratio/Oxidation.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:834ac63b60b6783aab9939df8e85dea470fe342a4c6657148017b66e63fa9189
3
+ size 3859831
data/microarray/SRratio/Salt.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba10878d79957df682fd10052075466d214578b8d483d2e9546d022b6bffd69b
3
+ size 27781763
data/microarray/SRratio/Wound.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cdd57cbccee5ec15b57455c9ebdd576bb6cdd9d16d14782b4c0a9e366fbedf0
3
+ size 8670659
data/microarray/SRscore_microarray.rds ADDED
Binary file (610 kB). View file
 
data/rnaseq/Metadata/ABA.rds ADDED
Binary file (1.29 kB). View file
 
data/rnaseq/Metadata/Cold.rds ADDED
Binary file (1.61 kB). View file
 
data/rnaseq/Metadata/DC3000.rds ADDED
Binary file (1.12 kB). View file
 
data/rnaseq/Metadata/Drought.rds ADDED
Binary file (1.24 kB). View file
 
data/rnaseq/Metadata/Heat.rds ADDED
Binary file (1.6 kB). View file
 
data/rnaseq/Metadata/High-light.rds ADDED
Binary file (1.65 kB). View file
 
data/rnaseq/Metadata/Hypoxia.rds ADDED
Binary file (634 Bytes). View file
 
data/rnaseq/Metadata/Osmotic.rds ADDED
Binary file (630 Bytes). View file
 
data/rnaseq/Metadata/Oxidation.rds ADDED
Binary file (713 Bytes). View file
 
data/rnaseq/Metadata/Salt.rds ADDED
Binary file (1.24 kB). View file
 
data/rnaseq/Metadata/Wound.rds ADDED
Binary file (1.04 kB). View file
 
data/rnaseq/SRratio/ABA.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:418b5468932af0cee2f79d606d7c90d4ea10fd8c96249889ec1fee488ce272f2
3
+ size 11313527
data/rnaseq/SRratio/Cold.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e321d0e65256227dff33ae0719f0961523ffcb7b245579b4864ac004b914633
3
+ size 18419645
data/rnaseq/SRratio/DC3000.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:506efba54aaf0b0a8f5129ac067d38a797d9f2dda54b64ee5dacfd56ed7f80fa
3
+ size 10247232
data/rnaseq/SRratio/Drought.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8017e33dbfe37c0e2529b17d519e27dc30305d26da0f2b2f085119793a9b2ce5
3
+ size 11272647
data/rnaseq/SRratio/Heat.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:192a5660b3f06511bbb6b1aa5ff2e4bc4dc89dd2d2518abdfba3713446e3ceaf
3
+ size 14238052
data/rnaseq/SRratio/High-light.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ad1165f4b5bd34b6b63985200aa428678291fa50f135f3c40636c1f72c296a7
3
+ size 15116100
data/rnaseq/SRratio/Hypoxia.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f6ba27074443f3dc9c586b246b3bebbf1781bc2b57d402669b117569a4c46d4c
3
+ size 3102927
data/rnaseq/SRratio/Osmotic.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9aad7e51959b2a4e0593e02c0f611e407e797cb5a7c5ec8ff4656063d5f25b37
3
+ size 3103669
data/rnaseq/SRratio/Oxidation.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47337244afa7de747388050fc4300011198148c58ff9364e8df92566deb48bb6
3
+ size 4976387
data/rnaseq/SRratio/Salt.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0865640a1b47694e9af1798a20fb151522b3a38b0759317201b3af2c820a4362
3
+ size 12290639
data/rnaseq/SRratio/Wound.rds ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90fddc5084e4afd4b4f6555663ea70ebb6f08e8dabfb616f62b57451d41e7714
3
+ size 11673041
data/rnaseq/SRscore_rnaseq.rds ADDED
Binary file (795 kB). View file
 
data_processing.R ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Menu : Microarray #########################################################
2
+
3
+ ## Sub Menu : Atlas ####
4
+ ### アトラスを読み込む ####
5
+ SRscore_microarray <- readRDS("data/microarray/SRscore_microarray.rds")
6
+ colnames_microarray <- gsub("\\..+", "", list.files("data/microarray/SRratio/"))
7
+ SRscore_microarray[colnames_microarray] <- round(SRscore_microarray[colnames_microarray])
8
+
9
+ ### アトラスをヒートマップ化する時の色の設定 ####
10
+ paletteLength <- 100
11
+ microarrayBreaks <- c(seq(min(SRscore_microarray[colnames_microarray]), 0, length.out = (paletteLength/2)),
12
+ seq(0, max(SRscore_microarray[colnames_microarray]), length.out = (paletteLength/2))[-1])
13
+ microarrayColor <- colorRampPalette(c("deepskyblue", "white", "hotpink"))(paletteLength)
14
+
15
+ ### 外部DBへのリンクをアトラスに追加する ####
16
+ # リンクの見た目設定
17
+ link <- rep("link", nrow(SRscore_microarray))
18
+
19
+ # AlphaFold2
20
+ url <- rep(paste0("https://alphafold.ebi.ac.uk/search/text/",
21
+ SRscore_microarray$ensembl_gene_id))
22
+ AF2 <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
23
+
24
+ # ATTED-II
25
+ url <- rep(paste0("https://atted.jp/kwsearch/?stype=any&kword=",
26
+ SRscore_microarray$ensembl_gene_id,
27
+ "&searchBtnK.x=0&searchBtnK.y=0"))
28
+ ATTED2 <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
29
+
30
+ # eFP Browser
31
+ url <- rep(paste0("https://bar.utoronto.ca/efp/cgi-bin/efpWeb.cgi?dataSource=Abiotic_Stress&mode=Absolute&primaryGene=",
32
+ SRscore_microarray$ensembl_gene_id))
33
+ eFP <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
34
+
35
+ # KEGG
36
+ url <- rep(paste0("https://www.genome.jp/dbget-bin/www_bget?ath:", SRscore_microarray$ensembl_gene_id))
37
+ KEGG <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
38
+
39
+ # STRING
40
+ url <- rep(paste0("https://string-db.org/cgi/network?identifiers=",
41
+ SRscore_microarray$ensembl_gene_id,
42
+ "&species=3702&show_query_node_labels=1"))
43
+ STRING <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
44
+
45
+ # TAIR
46
+ url <- rep(paste0("https://www-arabidopsis-org.translate.goog/servlets/TairObject?type=locus&name=",
47
+ SRscore_microarray$ensembl_gene_id,
48
+ "&_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc"))
49
+ TAIR <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
50
+
51
+ # ThaleMine
52
+ url <- rep(paste0("https://bar.utoronto.ca/thalemine/keywordSearchResults.do?searchTerm=",
53
+ SRscore_microarray$ensembl_gene_id, "&searchSubmit=GO"))
54
+ TM <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
55
+
56
+ # それぞれのリンクをアトラスに結合
57
+ SRscore_microarray <- cbind(SRscore_microarray, "AlphaFold2" = AF2, "ATTED-II" = ATTED2, "eFP Browser" = eFP,
58
+ "KEGG" = KEGG, "STRING" = STRING, "TAIR" = TAIR, "Thale Mine" = TM)
59
+
60
+ ### SRratioの読み込み ####
61
+ ABA_ratiom <- readRDS("data/microarray/SRratio/ABA.rds")
62
+ Cold_ratiom <- readRDS("data/microarray/SRratio/Cold.rds")
63
+ DC3000_ratiom <- readRDS("data/microarray/SRratio/DC3000.rds")
64
+ Drought_ratiom <- readRDS("data/microarray/SRratio/Drought.rds")
65
+ Heat_ratiom <- readRDS("data/microarray/SRratio/Heat.rds")
66
+ `High-light_ratiom` <- readRDS("data/microarray/SRratio/High-light.rds")
67
+ Hypoxia_ratiom2 <- readRDS("data/microarray/SRratio/Hypoxia.rds")
68
+ Osmotic_ratiom <- readRDS("data/microarray/SRratio/Osmotic.rds")
69
+ Oxidation_ratiom <- readRDS("data/microarray/SRratio/Oxidation.rds")
70
+ Salt_ratiom <- readRDS("data/microarray/SRratio/Salt.rds")
71
+ Wound_ratiom <- readRDS("data/microarray/SRratio/Wound.rds")
72
+
73
+ ### メタデータの読み込み ####
74
+ ABA_metadatam <- readRDS("data/microarray/Metadata/ABA.rds")
75
+ Cold_metadatam <- readRDS("data/microarray/Metadata/Cold.rds")
76
+ DC3000_metadatam <- readRDS("data/microarray/Metadata/DC3000.rds")
77
+ Drought_metadatam <- readRDS("data/microarray/Metadata/Drought.rds")
78
+ Heat_metadatam <- readRDS("data/microarray/Metadata/Heat.rds")
79
+ `High-light_metadatam` <- readRDS("data/microarray/Metadata/High-light.rds")
80
+ Hypoxia_metadatam <- readRDS("data/microarray/Metadata/Hypoxia.rds")
81
+ Osmotic_metadatam <- readRDS("data/microarray/Metadata/Osmotic.rds")
82
+ Oxidation_metadatam <- readRDS("data/microarray/Metadata/Oxidation.rds")
83
+ Salt_metadatam <- readRDS("data/microarray/Metadata/Salt.rds")
84
+ Wound_metadatam <- readRDS("data/microarray/Metadata/Wound.rds")
85
+
86
+ ## Sub Menu : Template Matching ####
87
+ ### アトラスをgenefinder()に入力可能な形式に変換 ####
88
+ genefinder_microarray <- column_to_rownames(SRscore_microarray, var = "ensembl_gene_id")
89
+ genefinder_microarray <- genefinder_microarray[colnames_microarray]
90
+ genefinder_microarray <- as.matrix(genefinder_microarray)
91
+
92
+ # GMTファイルを読み込む
93
+ positiveSRscore_ma <- read.gmt("positiveSRscore_ma.gmt")
94
+ negativeSRscore_ma <- read.gmt("negativeSRscore_ma.gmt")
95
+ genesets <- read.gmt("Ara_kegg_go.gmt")
96
+
97
+ positiveSRscore_ma <- rbind(positiveSRscore_ma, genesets)
98
+ negativeSRscore_ma <- rbind(negativeSRscore_ma, genesets)
99
+
100
+ # データ集計
101
+ list_microarray <- list(ABA_metadatam,
102
+ Cold_metadatam,
103
+ DC3000_metadatam,
104
+ Drought_metadatam,
105
+ Heat_metadatam,
106
+ `High-light_metadatam`,
107
+ Hypoxia_metadatam,
108
+ Osmotic_metadatam,
109
+ Oxidation_metadatam,
110
+ Salt_metadatam,
111
+ Wound_metadatam
112
+ )
113
+ ## 対象サンプルの集計
114
+ numof_control_ma <- list_microarray %>%
115
+ lapply("[[", "control_sample") %>%
116
+ lapply(na.omit) %>%
117
+ lapply(length)
118
+ numof_control_ma <- unlist(numof_control_ma)
119
+ ## 実験サンプルの集計
120
+ numof_treatment_ma <- list_microarray %>%
121
+ lapply("[[", "treated_sample") %>%
122
+ lapply(na.omit) %>%
123
+ lapply(length)
124
+ numof_treatment_ma <- unlist(numof_treatment_ma)
125
+ ## 研究プロジェクトの集計
126
+ numof_series_ma <- list_microarray %>%
127
+ lapply("[[", "Series") %>%
128
+ lapply(unique) %>%
129
+ lapply(length)
130
+ numof_series_ma <- unlist(numof_series_ma)
131
+ ## 集計カテゴリ行とストレス列からなるデータフレームを作成する
132
+ collections_ma <- rbind(numof_control_ma, numof_treatment_ma, numof_series_ma)
133
+ collections_ma <- as.data.frame(collections_ma)
134
+ colnames(collections_ma) <- colnames_microarray
135
+
136
+ # RNA-Seq #########################################################
137
+
138
+ ## Atlas ####
139
+ ### アトラスを読み込む ####
140
+ ABA_metadatam <- readRDS("data/rnaseq/SRscore_rnaseq.rds")
141
+ colnames_rnaseq <- gsub("\\..+", "", list.files("data/rnaseq/SRratio/"))
142
+ SRscore_rnaseq[colnames_rnaseq] <- round(SRscore_rnaseq[colnames_rnaseq])
143
+
144
+ ### アトラスをヒートマップ化する時の色の設定 ####
145
+ paletteLength <- 100
146
+ rnaseqBreaks <- c(seq(min(SRscore_rnaseq[colnames_rnaseq]), 0, length.out = (paletteLength/2)),
147
+ seq(0, max(SRscore_rnaseq[colnames_rnaseq]), length.out = (paletteLength/2))[-1])
148
+ rnaseqColor <- colorRampPalette(c("deepskyblue", "white", "hotpink"))(paletteLength)
149
+
150
+ ### 外部DBへのリンクをアトラスに追加する ####
151
+ # リンクの見た目設定
152
+ link <- rep("link", nrow(SRscore_rnaseq))
153
+
154
+ # AlphaFold2
155
+ url <- rep(paste0("https://alphafold.ebi.ac.uk/search/text/",
156
+ SRscore_rnaseq$ensembl_gene_id))
157
+ AF2 <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
158
+
159
+ # ATTED-II
160
+ url <- rep(paste0("https://atted.jp/kwsearch/?stype=any&kword=",
161
+ SRscore_rnaseq$ensembl_gene_id,
162
+ "&searchBtnK.x=0&searchBtnK.y=0"))
163
+ ATTED2 <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
164
+
165
+ # eFP Browser
166
+ url <- rep(paste0("https://bar.utoronto.ca/efp/cgi-bin/efpWeb.cgi?dataSource=Abiotic_Stress&mode=Absolute&primaryGene=",
167
+ SRscore_rnaseq$ensembl_gene_id))
168
+ eFP <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
169
+
170
+ # KEGG
171
+ url <- rep(paste0("https://www.genome.jp/dbget-bin/www_bget?ath:", SRscore_rnaseq$ensembl_gene_id))
172
+ KEGG <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
173
+
174
+ # STRING
175
+ url <- rep(paste0("https://string-db.org/cgi/network?identifiers=",
176
+ SRscore_rnaseq$ensembl_gene_id,
177
+ "&species=3702&show_query_node_labels=1"))
178
+ STRING <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
179
+
180
+ # TAIR
181
+ url <- rep(paste0("https://www-arabidopsis-org.translate.goog/servlets/TairObject?type=locus&name=",
182
+ SRscore_rnaseq$ensembl_gene_id,
183
+ "&_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc"))
184
+ TAIR <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
185
+
186
+ # ThaleMine
187
+ url <- rep(paste0("https://bar.utoronto.ca/thalemine/keywordSearchResults.do?searchTerm=",
188
+ SRscore_rnaseq$ensembl_gene_id, "&searchSubmit=GO"))
189
+ TM <- paste0("<a href = ", "'", url, "'", ">", link, "</a>")
190
+
191
+ # 各リンクをアトラスへ結合
192
+ SRscore_rnaseq <- cbind(SRscore_rnaseq, "AlphaFold2" = AF2, "ATTED-II" = ATTED2, "eFP Browser" = eFP,
193
+ "KEGG" = KEGG, "STRING" = STRING, "TAIR" = TAIR, "Thale Mine" = TM)
194
+
195
+ ### SRratioの読み込み ####
196
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/ABA.rds")
197
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Cold.rds")
198
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/DC3000.rds")
199
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Drought.rds")
200
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Heat.rds")
201
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/High-light.rds")
202
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Hypoxia.rds")
203
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Osmotic.rds")
204
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Oxidation.rds")
205
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Salt.rds")
206
+ ABA_ratior <- readRDS("data/rnaseq/SRratio/Wound.rds")
207
+
208
+ ### メタデータの読み込み ####
209
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/ABA.rds")
210
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Cold.rds")
211
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/DC3000.rds")
212
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Drought.rds")
213
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Heat.rds")
214
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/High-light.rds")
215
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Hypoxia.rds")
216
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Osmotic.rds")
217
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Oxidation.rds")
218
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Salt.rds")
219
+ ABA_metadatar <- readRDS("data/rnaseq/Metadata/Wound.rds")
220
+
221
+ ## Sub Menu : Template Matching ####
222
+ ### アトラスをgenefinder()に入力可能な形式に変換 ####
223
+ genefinder_rnaseq <- column_to_rownames(SRscore_rnaseq, var = "ensembl_gene_id")
224
+ genefinder_rnaseq <- genefinder_rnaseq[colnames_rnaseq]
225
+ genefinder_rnaseq <- as.matrix(genefinder_rnaseq)
226
+
227
+ # GMTファイルを読み込む
228
+ positiveSRscore_rs <- read.gmt("positiveSRscore_rs.gmt")
229
+ negativeSRscore_rs <- read.gmt("negativeSRscore_rs.gmt")
230
+ genesets <- read.gmt("Ara_kegg_go.gmt")
231
+
232
+ positiveSRscore_rs <- rbind(positiveSRscore_rs, genesets)
233
+ negativeSRscore_rs <- rbind(negativeSRscore_rs, genesets)
234
+
235
+ # データ集計
236
+ list_rnaseq <- list(ABA_metadatar,
237
+ Cold_metadatar,
238
+ DC3000_metadatar,
239
+ Drought_metadatar,
240
+ Heat_metadatar,
241
+ `High-light_metadatar`,
242
+ Hypoxia_metadatar,
243
+ Osmotic_metadatar,
244
+ Oxidation_metadatar,
245
+ Salt_metadatar,
246
+ Wound_metadatar
247
+ )
248
+ ## 対象サンプルの集計
249
+ numof_control_rs <- list_rnaseq %>%
250
+ lapply("[[", "control_sample") %>%
251
+ lapply(na.omit) %>%
252
+ lapply(length)
253
+ numof_control_rs <- unlist(numof_control_rs)
254
+ ## 実験サンプルの集計
255
+ numof_treatment_rs <- list_rnaseq %>%
256
+ lapply("[[", "treated_sample") %>%
257
+ lapply(na.omit) %>%
258
+ lapply(length)
259
+ numof_treatment_rs <- unlist(numof_treatment_rs)
260
+ ## 研究プロジェクトの集計
261
+ numof_series_rs <- list_rnaseq %>%
262
+ lapply("[[", "Series") %>%
263
+ lapply(unique) %>%
264
+ lapply(length)
265
+ numof_series_rs <- unlist(numof_series_rs)
266
+ ## 集計カテゴリ行とストレス列からなるデータフレームを作成する
267
+ collections_rs <- rbind(numof_control_rs, numof_treatment_rs, numof_series_rs)
268
+ collections_rs <- as.data.frame(collections_rs)
269
+ colnames(collections_rs) <- colnames_rnaseq
270
+
271
+ CollectionsInfo <- function(stress) {
272
+ HTML(paste0(
273
+ "<h4> # of control samples : ", stress[1],
274
+ "<br><br>",
275
+ "# of treatment samples : ", stress[2],
276
+ "<br><br>",
277
+ "# of GSE : ", stress[3],
278
+ "<br></h3>"
279
+ ))
280
+ }
281
+
282
+ # GMTファイルを読み込む
283
+ positiveSRscore_ma <- read.gmt("positiveSRscore_ma.gmt")
284
+ negativeSRscore_ma <- read.gmt("negativeSRscore_ma.gmt")
285
+
286
+ positiveSRscore_rs <- read.gmt("positiveSRscore_rs.gmt")
287
+ negativeSRscore_rs <- read.gmt("negativeSRscore_rs.gmt")
288
+
289
+ genesets <- read.gmt("Ara_kegg_go.gmt")
290
+
291
+ positiveSRscore_ma <- rbind(positiveSRscore_ma, genesets)
292
+ negativeSRscore_ma <- rbind(negativeSRscore_ma, genesets)
293
+
294
+ positiveSRscore_rs <- rbind(positiveSRscore_rs, genesets)
295
+ negativeSRscore_rs <- rbind(negativeSRscore_rs, genesets)
global.R ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installation
2
+ library("shiny")
3
+ library("shinydashboard")
4
+ library("shinyWidgets")
5
+ library("dplyr")
6
+ library("tibble")
7
+ library("ggplot2")
8
+ library("DT")
9
+ library("withr")
10
+ library("targets")
11
+ library("htmlwidgets")
12
+ library("plotly")
13
+ library("heatmaply")
14
+ library("magrittr")
15
+ library("genefilter")
16
+ library("openxlsx")
17
+ library("clusterProfiler")
18
+
19
+ # Source scripts
20
+ source("proxy.R", local = TRUE)
21
+ source("data_processing.R", local = TRUE)
22
+
23
+ # Sub Menu : Atlas ####
24
+ ## Tab : Overview ####
25
+ overviewUI <- function(id) {
26
+ ns <- NS(id)
27
+ tagList(
28
+ fluidPage(
29
+ actionButton(ns("clear"), "Clear Selected Rows"),
30
+ actionButton(ns("reset"), "Reset Table"),
31
+ actionButton(ns("remove"), "Remove",
32
+ style = "color: red"),
33
+ br(),
34
+ br(),
35
+ dataTableOutput(ns("atlas"))
36
+ ),
37
+ br(),
38
+ br(),
39
+ fluidRow(
40
+ column(width = 4,
41
+ box(title = "Bulk Search",
42
+ width = 12,
43
+ status = "primary",
44
+ solidHeader = TRUE,
45
+ textAreaInput(ns("text"), h4("Input list of identifiers :"),
46
+ width = "400px", height = "300px"
47
+ ),
48
+ actionButton(ns("submit"), "Submit",
49
+ style = "color: white; background-color: #337ab7; border-color: #2e6da4"),
50
+ actionButton(ns("example1"), "Example1"),
51
+ actionButton(ns("example2"), "Example2"),
52
+ br(),
53
+ actionButton(ns("selected"), "Entries shown above"))),
54
+ column(width = 4,
55
+ box(title = "Bulk Search → Heatmap",
56
+ width = 12,
57
+ status = "success",
58
+ solidHeader = TRUE,
59
+ h4("Control paremeters of heatmap"),
60
+ selectInput(ns("identifier"),
61
+ label = "Choose y axis :",
62
+ choices = c("ensembl_gene_id",
63
+ "SYMBOL"),
64
+ selected = "ensembl_gene_id"),
65
+ numericInput(ns("height"),
66
+ label = "height :",
67
+ value = 400),
68
+ actionButton(ns("heatmap"), "Plot",
69
+ style = "color: white; background-color: #337ab7; border-color: #2e6da4"))),
70
+ column(width = 4,
71
+ box(title = "Bulk Search → Enrichment analysis",
72
+ width = 12,
73
+ status = "warning",
74
+ solidHeader = TRUE,
75
+ radioButtons(ns("source"), "Include gene sets from AtSRGA :", c("positiveSRscore (SRscore ≧ 1)", "negativeSRscore (SRscore ≦ -1)"), selected = ""),
76
+ actionButton(ns("reset2"), "Reset"),
77
+ br(),
78
+ br(),
79
+ actionButton(ns("analysis"), "Analysis",
80
+ style = "color: white; background-color: #337ab7; border-color: #2e6da4"),
81
+ br(),
82
+ selectInput(ns("xaxis"),
83
+ label = "Choose x-axis :",
84
+ choices = c("GeneRatio","Count", "pvalue",
85
+ "p.adjust", "qvalue"),
86
+ selected = "GeneRatio"),
87
+ numericInput(ns("showCategory"),
88
+ label = "Set number of categories to display :",
89
+ value = 30),
90
+ numericInput(ns("labelFormat"),
91
+ label = "Set wrap length :",
92
+ value = 100)
93
+ )
94
+ )
95
+ ),
96
+ plotOutput(ns("result"))
97
+ )
98
+ }
99
+
100
+ overview <- function(input, output, session, srga, cl, Breaks, Color, prop, positive, negative) {
101
+ ## Table Display : SRGA (Stress Response Gene Atlas) ####
102
+ ### Display the atlas as a heatmap ####
103
+ rv <- reactiveValues(df = srga)
104
+
105
+ observeEvent(input$reset, {
106
+ rv$df <- srga
107
+ })
108
+
109
+ output$atlas <- renderDataTable({
110
+ datatable(
111
+ rv$df,
112
+ filter = "top",
113
+ selection = "multiple",
114
+ extensions = c("Buttons", "FixedColumns"),
115
+ escape = FALSE,
116
+ rownames = FALSE,
117
+ options = list(columnDefs = list(list(className = "dt-nowrap", targets = "_all"),
118
+ list(visible = FALSE, targets = NULL)),
119
+ scrollX = TRUE,
120
+ fixedColumns = TRUE,
121
+ dom = "lrtBip",
122
+ buttons = list(
123
+ I("colvis"),
124
+ list(extend = "collection",
125
+ buttons = list(list(extend = "excel", filename = "SRGA")
126
+ ),
127
+ text = "Download"))
128
+ )
129
+ ) %>%
130
+ formatStyle(names(srga[cl]), backgroundColor = styleInterval(Breaks, Color))
131
+ }, server = TRUE)
132
+
133
+ ## Side Bar : Bulk Search → Heatmap ####
134
+ ### Input string ####
135
+ #### Lowercase conversion and delimiter splitting(Space or New Line or Tab or commma)####
136
+ lower_input <- reactive({
137
+ gsub("\"", "", strsplit(tolower(input$text), " |\n|\t|,")[[1]])
138
+ })
139
+
140
+ #### Get index of AGI code ####
141
+ agi_index <- reactive({
142
+ grepl("at.g.+", lower_input(), ignore.case = T)
143
+ })
144
+
145
+ #### Delete Version Part of AGI Code(e.g., ATXGXXXX.1, ATXGXXXXX.3) ####
146
+ key <- reactive({
147
+ c(gsub("\\..+", "", lower_input()[agi_index()]), lower_input()[!agi_index()])
148
+ })
149
+
150
+ ### SRGA ####
151
+ #### Extract AGI code and SYMBOL for each line
152
+ AGIandSYMBOL <- reactive(apply(srga[c("ensembl_gene_id", "SYMBOL")], 1, paste, collapse = "/"))
153
+
154
+ #### Divide with a slash ####
155
+ splited_AGIandSYMBOL <- reactive(strsplit(AGIandSYMBOL(), "/"))
156
+
157
+ #### Convert to lowcase ####
158
+ lowered_AGIandSYMBOL <- reactive(lapply(splited_AGIandSYMBOL(), tolower))
159
+
160
+ #### Get the index of the element that exactly matches the input string ####
161
+ matched_AGIandSYMBOL <- reactive(lapply(lowered_AGIandSYMBOL(), match, key()[which(key() != "")]))
162
+
163
+ ### Retrieve the row corresponding to the number from SRGA ####
164
+ observeEvent(input$submit, {
165
+ rv$df <- srga[which(lapply(matched_AGIandSYMBOL(), any) == TRUE), ]
166
+ })
167
+
168
+ ### Remove line ####
169
+ observeEvent(input$remove, {
170
+ rv$df <- rv$df[-as.numeric(input$atlas_rows_selected), ]
171
+ })
172
+
173
+ ## clear selected rows by pressing the button ####
174
+ observeEvent(input$clear, {
175
+ selectRows(dataTableProxy("atlas"), NULL)
176
+ })
177
+
178
+ ### Example of input string ####
179
+ #### First ####
180
+ observeEvent(input$example1, {
181
+ name <- paste("ADH1", "DREB1A", "ELIP1", "HSP17.8", "JAZ1", "NCED3", "PP2CA")
182
+ updateTextAreaInput(session, "text", value = name)
183
+ })
184
+ #### Second ####
185
+ observeEvent(input$example2, {
186
+ name <- paste("DREB1A", "DREB1B", "DREB1C", "DREB2A", "DREB2B", "GolS1", "GolS2", "GolS3", sep = "\n")
187
+ updateTextAreaInput(session, "text", value = name)
188
+ })
189
+ observeEvent(input$selected, {
190
+ updateTextAreaInput(session, "text", value = rv$df$ensembl_gene_id[input$atlas_rows_all])
191
+ })
192
+
193
+ ### Create heatmap ####
194
+ heatmap_tbl <- reactive(
195
+ heatmaply(set_rownames(rv$df[cl], value = rv$df[, input$identifier]),
196
+ height = input$height,
197
+ grid_gap = 0.2, grid_color = "gray90",
198
+ scale_fill_gradient_fun = scale_fill_gradient2(
199
+ low = "deepskyblue",
200
+ high = "hotpink",
201
+ midpoint = 0
202
+ ),
203
+ Rowv = FALSE,
204
+ Colv = FALSE,
205
+ cellnote = set_rownames(rv$df[cl], value = rv$df[, input$identifier]),
206
+ cellnote_size = 18,
207
+ cellnote_textposition = "middle center")
208
+ )
209
+
210
+ ### Display a heatmap inside the modal dialog box ####
211
+ output$plot <- renderPlotly({
212
+ heatmap_tbl()
213
+ })
214
+ ns <- session$ns
215
+ observeEvent(input$heatmap, {
216
+ showModal(modalDialog({
217
+ plotlyOutput(ns("plot"))},
218
+ easyClose = TRUE,
219
+ size = "l",
220
+ title = "Heatmap"))
221
+ })
222
+
223
+ ## 指定した範囲内のSRscoreを持つ遺伝子のID抽出
224
+ query <- reactive({
225
+ srga$ensembl_gene_id[which(lapply(matched_AGIandSYMBOL(), any) == TRUE)]
226
+ })
227
+
228
+ ## カスタムデータのoff
229
+ observeEvent(input$reset2, {
230
+ updateRadioButtons(session,
231
+ inputId = "source",
232
+ choices = c("positiveSRscore (SRscore ≧ 1)",
233
+ "negativeSRscore (SRscore ≦ -1)"),
234
+ selected = "")
235
+ })
236
+
237
+ observeEvent(input$analysis, {
238
+ withProgress(message = "", {
239
+ if (is.null(input$source)) {
240
+ rv$earesult <- enrichGO(gene = query(),
241
+ OrgDb = "org.At.tair.db",
242
+ keyType = "TAIR",
243
+ ont = "BP",
244
+ pvalueCutoff = 0.05,
245
+ maxGSSize = 2000)
246
+ } else if (input$source == "positiveSRscore (SRscore ≧ 1)") {
247
+ rv$earesult <- enricher(gene = query(),
248
+ TERM2GENE = positive,
249
+ pvalueCutoff = 0.05,
250
+ maxGSSize = 2000)
251
+ } else if (input$source == "negativeSRscore (SRscore ≦ -1)") {
252
+ rv$earesult <- enricher(gene = query(),
253
+ TERM2GENE = negative,
254
+ pvalueCutoff = 0.05,
255
+ maxGSSize = 2000)
256
+ }
257
+ for (i in 1:10) {
258
+ incProgress(1/10)
259
+ Sys.sleep(0.1)
260
+ }
261
+ })
262
+ })
263
+
264
+ output$result <- renderPlot({
265
+ dotplot(rv$earesult,
266
+ showCategory = input$showCategory,
267
+ label_format = input$labelFormat,
268
+ x = input$xaxis)
269
+ })
270
+
271
+ # output$result <- renderDataTable({
272
+ # options(digits = 3)
273
+ # rv$earesult$p_value <- format(rv$earesult$p_value, scientific = TRUE)
274
+ # datatable(
275
+ # rv$earesult,
276
+ # selection = "single",
277
+ # rownames = FALSE,
278
+ # extensions = c("Buttons", "FixedColumns"),
279
+ # options = list(columnDefs = list(list(className = "dt-nowrap", targets = "_all")),
280
+ # scrollX = TRUE,
281
+ # dom = 'flrtBip',
282
+ # buttons = list(
283
+ # I("colvis"),
284
+ # list(extend = 'collection',
285
+ # buttons = list(list(extend = 'excel', filename = 'ea_results', exportOptions = list(columns = ":visible"))),
286
+ # text = 'Download'))))
287
+ # }, server = FALSE)
288
+
289
+ return(list(
290
+ geneid = reactive(rv$df$ensembl_gene_id[input$atlas_rows_selected]),
291
+ query_ea = reactive(srga[which(lapply(matched_AGIandSYMBOL(), any) == TRUE), ])
292
+ )
293
+ )
294
+ }
295
+
296
+ ## Tab : Abiotic and biotic stress ####
297
+ stressUI <- function(id) {
298
+ ns <- NS(id)
299
+ tagList(
300
+ br(),
301
+ actionButton(ns("button_ratio"), "Show SRratio", icon("table"),
302
+ style = "color: white; background-color: #337ab7; border-color: #2e6da4"),
303
+ br(),
304
+ br(),
305
+ dataTableOutput(ns("ratio")),
306
+ br(),
307
+ br(),
308
+ br(),
309
+ actionButton(ns("button_metadata"), "Show metadata", icon("table"),
310
+ style = "color: white; background-color: #337ab7; border-color: #2e6da4"),
311
+ actionButton(ns("button_metadata_more"), "", icon("filter"),
312
+ style = "color: pink; background-color: white; border-color: #2e6da4"),
313
+ actionButton(ns("button_metadata_middle"), "", icon("filter"),
314
+ style = "color: black; background-color: white; border-color: #2e6da4"),
315
+ actionButton(ns("button_metadata_less"), "", icon("filter"),
316
+ style = "color: skyblue; background-color: white; border-color: #2e6da4"),
317
+ br(),
318
+ dataTableOutput(ns("metadata"))
319
+ )
320
+ }
321
+
322
+ stress <- function(input, output, session, ratio, srga, selectedRow, metadata) {
323
+ ## Table Display : SRratio ####
324
+ rv <- reactiveValues(ratio = NULL, metadata = NULL)
325
+
326
+ ### Retrieve the SR ratio of the specified gene ####
327
+ selectedRatio <- reactive({
328
+ ratio[which(ratio$ensembl_gene_id %in% selectedRow()), ]
329
+ })
330
+ observeEvent(input$button_ratio, {
331
+ rv$ratio <- selectedRatio()
332
+ })
333
+
334
+ ### Display SRratio ####
335
+ output$ratio <- renderDataTable({
336
+ num_cl <- which(sapply(rv$ratio, is.numeric))
337
+ rv$ratio[, num_cl] <- round(rv$ratio[, num_cl], digits = 2)
338
+ datatable(rv$ratio,
339
+ extensions = c("Buttons", "FixedColumns"),
340
+ rownames = FALSE,
341
+ selection = "single",
342
+ options = list(scrollX =TRUE,
343
+ fixedColumns = TRUE,
344
+ dom = 'lrtBip',
345
+ buttons = list(list(extend = 'collection',
346
+ buttons = list(list(extend = 'excel', filename = 'Metadata')),
347
+ text = 'Download')))) %>%
348
+ formatStyle(colnames(selectedRatio())[-1], backgroundColor = styleInterval(c(-2, 2), c("skyblue", "white", "pink")))
349
+ })
350
+
351
+ ### Identify the treated samples that meet the following criteria ####
352
+
353
+ #### Specify a gene in the SRratio table
354
+ ratio_single <- reactive({
355
+ rv$ratio[input$ratio_rows_selected, ]
356
+ })
357
+
358
+ #### SRratio ≧ 2 (1) ####
359
+ more <- reactive({
360
+ which(metadata$treated_sample %in% colnames(ratio_single())[ratio_single() >= 2])
361
+ })
362
+
363
+ #### -2 < SRratio < 2 ####
364
+ middle <- reactive({
365
+ which(metadata$treated_sample %in% colnames(ratio_single())[-2 <= ratio_single() & ratio_single() <= 2])
366
+ })
367
+
368
+ #### SRratio ≦ -2 (2) ####
369
+ less <- reactive({
370
+ which(metadata$treated_sample %in% colnames(ratio_single())[ratio_single() <= -2])
371
+ })
372
+
373
+ ## Table Display : Metadata ####
374
+ ### Color metadata (1 → pink、2 → skyblue) ####
375
+ observeEvent(input$button_metadata, {
376
+ if (length(more()) == 0 & length(less()) == 0) {
377
+ rv$metadata <- datatable(
378
+ metadata,
379
+ selection = "single",
380
+ rownames = FALSE,
381
+ options = list(paging = FALSE,
382
+ scrollY = "1000px",
383
+ columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
384
+ dom = 'flrtBip',
385
+ buttons = list(list(extend = 'collection',
386
+ buttons = list(list(extend = 'excel', filename = 'Metadata')),
387
+ text = 'Download'))))
388
+ } else {
389
+ rv$metadata <- datatable(
390
+ metadata,
391
+ selection = "single",
392
+ rownames = FALSE,
393
+ options = list(paging = FALSE,
394
+ scrollY = "1000px",
395
+ columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
396
+ dom = 'flrtBip',
397
+ buttons = list(list(extend = 'collection',
398
+ buttons = list(list(extend = 'excel', filename = 'Metadata')),
399
+ text = 'Download')))) %>%
400
+ formatStyle(
401
+ "treated_sample",
402
+ target = "row",
403
+ backgroundColor = styleRow(c(more(), less()), c(rep("pink", length(more())), rep("skyblue", length(less())))
404
+ )
405
+ )
406
+ }
407
+ })
408
+
409
+ ### SRratio ≧ 2のストレス処理サンプルのみを含むメタデータの取得 ####
410
+ observeEvent(input$button_metadata_more, {
411
+ rv$metadata <- datatable(
412
+ metadata[more(), ],
413
+ selection = "single",
414
+ rownames = FALSE,
415
+ options = list(columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
416
+ dom = 'flrtBip',
417
+ buttons = list(list(extend = 'collection',
418
+ buttons = list(list(extend = 'excel', filename = 'Metadata_detected_up')),
419
+ text = 'Download')))
420
+ )
421
+ })
422
+
423
+ ### -2 < SRratio < 2のストレス処理サンプルのみを含むメタデータの取得 ####
424
+ observeEvent(input$button_metadata_middle, {
425
+ rv$metadata <- datatable(
426
+ metadata[middle(), ],
427
+ selection = "single",
428
+ rownames = FALSE,
429
+ options = list(columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
430
+ dom = 'flrtBip',
431
+ buttons = list(list(extend = 'collection',
432
+ buttons = list(list(extend = 'excel', filename = 'Metadata_not_detected')),
433
+ text = 'Download')))
434
+ )
435
+ })
436
+
437
+ ### SRratio ≦ -2のストレス処理サンプルのみを含むメタデータの取得 ####
438
+ observeEvent(input$button_metadata_less, {
439
+ rv$metadata <- datatable(
440
+ metadata[less(), ],
441
+ selection = "single",
442
+ rownames = FALSE,
443
+ options = list(columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
444
+ dom = 'flrtBip',
445
+ buttons = list(list(extend = 'collection',
446
+ buttons = list(list(extend = 'excel', filename = 'Metadata_detected_down')),
447
+ text = 'Download')))
448
+ )
449
+ })
450
+
451
+ ### Display metadata ####
452
+ output$metadata <- renderDataTable({
453
+ rv$metadata
454
+ }, server = FALSE)
455
+ }
456
+
457
+ # Sub Menu : Template Matching ####
458
+ TemplateMatchUI <- function(id) {
459
+ ns <- NS(id)
460
+
461
+ tagList(
462
+ box(title = "Template Matching → Heatmap",
463
+ width = 4,
464
+ status = "danger",
465
+ solidHeader = TRUE,
466
+ h4("1. Select a gene in overview"),
467
+ selectInput(ns("method"),
468
+ label = "Choose a method :",
469
+ choices = c("euclidean","maximum", "manhattan",
470
+ "canberra", "correlation", "binary"),
471
+ selected = "euclidean"),
472
+ numericInput(ns("display"),
473
+ label = "Number of results to display :",
474
+ value = 5),
475
+ h4("2. Control paremeters of heatmap"),
476
+ selectInput(ns("identifier"),
477
+ label = "Choose y axis :",
478
+ choices = c("ensembl_gene_id", "SYMBOL"),
479
+ selected = "ensembl_gene_id"),
480
+ numericInput(ns("height"),
481
+ label = "height :",
482
+ value = 400),
483
+ actionButton(ns("heatmap"), "Plot",
484
+ style = "color: white; background-color: #337ab7; border-color: #2e6da4")
485
+ ),
486
+ dataTableOutput(ns("close_genes")),
487
+ br(),
488
+ br(),
489
+ dataTableOutput(ns("template"))
490
+ )
491
+ }
492
+
493
+ TemplateMatch <- function(input, output, session, query, selectRow, srga, cl, Breaks, Color) {
494
+ ## Table Display : Template Matching results ####
495
+ ### Template matching ####
496
+ close_genes <- reactive({
497
+ genefinder(query,
498
+ selectRow(),
499
+ input$display,
500
+ method = input$method)})
501
+
502
+ ### Display matching result ####
503
+ output$close_genes <- renderDataTable({
504
+ datatable(
505
+ add_column(srga[close_genes()[[1]]$indices, ],
506
+ "dists" = round(close_genes()[[1]]$dists, digits = 3),
507
+ .after = max(which(sapply(srga, is.numeric)))
508
+ ),
509
+ filter = "top",
510
+ selection = "single",
511
+ extensions = c("Buttons", "FixedColumns"),
512
+ options = list(columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
513
+ scrollX = TRUE, fixedColumns = TRUE,
514
+ dom = 'lrtBip', buttons = list(list(extend = 'collection',
515
+ buttons = list(list(extend = 'excel', filename = 'closegenes')),
516
+ text = 'Download'))
517
+ ),
518
+ escape = FALSE, rownames = FALSE
519
+ ) %>%
520
+ formatStyle(names(srga[cl]), backgroundColor = styleInterval(Breaks, Color)) %>%
521
+ formatStyle("dists", backgroundColor = "yellow")
522
+ },
523
+ server = FALSE)
524
+
525
+ ### Display template ####
526
+ output$template <- renderDataTable({
527
+ datatable(
528
+ srga[srga$ensembl_gene_id == selectRow(), ],
529
+ extensions = "FixedColumns",
530
+ selection = "single",
531
+ options = list(columnDefs = list(list(className = 'dt-nowrap', targets = "_all")),
532
+ scrollX = TRUE,
533
+ fixedColumns = TRUE,
534
+ dom = 'rti'
535
+ ),
536
+ escape = FALSE, rownames = FALSE
537
+ ) %>%
538
+ formatStyle(names(srga[cl]), backgroundColor = styleInterval(Breaks, Color))
539
+ })
540
+
541
+ ## Side Bar : Template Matching → Heatmap ####
542
+ ### Create heatmap ####
543
+ heatmap_tbl <- reactive(
544
+ heatmaply(set_rownames(srga[close_genes()[[1]]$indices, cl],
545
+ value = srga[close_genes()[[1]]$indices, input$identifier]),
546
+ height = input$height,
547
+ grid_gap = 0.2, grid_color = "gray90",
548
+ scale_fill_gradient_fun = scale_fill_gradient2(
549
+ low = "deepskyblue",
550
+ high = "hotpink",
551
+ midpoint = 0
552
+ ),
553
+ Rowv = FALSE,
554
+ Colv = FALSE)
555
+ )
556
+
557
+ ### Display a heatmap inside the modal dialog box ####
558
+ output$plot <- renderPlotly({
559
+ heatmap_tbl()
560
+ })
561
+ ns <- session$ns
562
+ observeEvent(input$heatmap, {
563
+ showModal(modalDialog({
564
+ plotlyOutput(ns("plot"))},
565
+ easyClose = TRUE,
566
+ size = "l",
567
+ title = "Heatmap")
568
+ )
569
+ })
570
+ }
negativeSRscore_ma.gmt ADDED
The diff for this file is too large to render. See raw diff