33
44
55# Load libraries and helper functions ----
6- library(shiny )
7- library(Seurat )
8- library(ggplot2 )
9- library(shinythemes )
10- library(pals )
11- library(dplyr )
12- library(patchwork )
13- library(shiny )
14- library(shinycssloaders )
15- library(shades )
6+ CRAN_REPO <- " http://cran.us.r-project.org"
7+ LIB_LOCATION <- " /home/centos/R/x86_64-redhat-linux-gnu-library/3.6"
8+ # "/usr/lib64/R/library/usr/share/R/library"
169
1710
18- source(" scripts/visListPlot.R" )
11+ if (! require(' shiny' , quietly = T )) {
12+ install.packages(" shiny" , lib = LIB_LOCATION ,repos = CRAN_REPO )
13+ }
14+ suppressPackageStartupMessages(library(shiny ,lib.loc = LIB_LOCATION ,quietly = T ))
15+
16+ if (! require(' Seurat' , quietly = T )) {
17+ install.packages(" Seurat" , lib = LIB_LOCATION ,lib.loc = LIB_LOCATION ,repos = CRAN_REPO )
18+ }
19+ suppressPackageStartupMessages(library(Seurat ,lib.loc = LIB_LOCATION ,quietly = T ))
20+
21+ if (! require(' ggplot2' , quietly = T )) {
22+ install.packages(" ggplot2" , lib = LIB_LOCATION ,repos = CRAN_REPO )
23+ }
24+ suppressPackageStartupMessages(library(ggplot2 ,lib.loc = LIB_LOCATION ,quietly = T ))
25+
26+ if (! require(' shinythemes' , quietly = T )) {
27+ install.packages(" shinythemes" , lib = LIB_LOCATION ,repos = CRAN_REPO )
28+ }
29+ suppressPackageStartupMessages(library(shinythemes ,lib.loc = LIB_LOCATION ,quietly = T ))
30+
31+ if (! require(' pals' , quietly = T )) {
32+ install.packages(" pals" , lib = LIB_LOCATION ,repos = CRAN_REPO )
33+ }
34+ suppressPackageStartupMessages(library(pals ,lib.loc = LIB_LOCATION ,quietly = T ))
35+
36+ if (! require(' dplyr' , quietly = T )) {
37+ install.packages(" dplyr" , lib = LIB_LOCATION ,repos = CRAN_REPO )
38+ }
39+ suppressPackageStartupMessages(library(dplyr ,lib.loc = LIB_LOCATION ,quietly = T ))
40+
41+ if (! require(' patchwork' , quietly = T )) {
42+ install.packages(" patchwork" , lib = LIB_LOCATION ,repos = CRAN_REPO )
43+ }
44+ suppressPackageStartupMessages(library(patchwork ,lib.loc = LIB_LOCATION ,quietly = T ))
45+
46+ if (! require(' shinycssloaders' , quietly = T )) {
47+ install.packages(" shinycssloaders" , lib = LIB_LOCATION ,repos = CRAN_REPO )
48+ }
49+ suppressPackageStartupMessages(library(shinycssloaders ,lib.loc = LIB_LOCATION ,quietly = T ))
50+
51+ if (! require(' shades' , quietly = T )) {
52+ install.packages(" shades" , lib = LIB_LOCATION ,repos = CRAN_REPO )
53+ }
54+ suppressPackageStartupMessages(library(shades ,lib.loc = LIB_LOCATION ,quietly = T ))
55+
56+ # if (!require('viridis', quietly=T)) {
57+ # install.packages("viridis", lib = LIB_LOCATION,repos = CRAN_REPO)
58+ # }
59+ # suppressPackageStartupMessages(library(viridis,lib.loc = LIB_LOCATION,quietly = T))
60+
61+
62+ source(" ./scripts/visListPlot.R" )
1963
2064# Settings & version info ----
2165CURR_DATA_VERSION = 1.1
@@ -26,6 +70,7 @@ myoCells_RData <- "./data/myo_slim_seurat_v1-1.RData"
2670vis_RData <- " ./data/vis_slim_v1.RData"
2771
2872cornell_red = " #B31B1B"
73+ spatial_gene_colors <- c(" #440154FF" , " #482576FF" , " #414487FF" , " #35608DFF" , " #2A788EFF" , " #21908CFF" , " #22A884FF" , " #43BF71FF" , " #7AD151FF" ," #BBDF27FF" , " #FDE725FF" )
2974spatial_theta_colors <- c(" #5E4FA2" , " #3288BD" , " #66C2A5" , " #ABDDA4" , " #E6F598" , " #FFFFBF" , " #FEE08B" , " #FDAE61" , " #F46D43" , " #D53E4F" , " #9E0142" )
3075vis.height = " 600px"
3176
@@ -504,6 +549,7 @@ ui <- fluidPage(
504549 # 'Downloads' tab----
505550 tabPanel(
506551 title = " Downloads" ,
552+ h4(" *Note- downloads may take a few minutes to prepare" ),
507553 # h4("Click on the links below to download Seurat objects, metadata files, etc."),
508554
509555 h4(" Seurat object downloads:" ),
@@ -585,12 +631,12 @@ server <- function(input, output){
585631 )
586632 dot.theme <- theme(
587633 axis.line = element_blank(),
588- panel.border = element_rect(colour = " black" , fill = NA , size = 1 ),
634+ panel.border = element_rect(color = " black" , fill = NA , size = 1 ),
589635 legend.text = element_text(size = small.font , color = " black" ),
590636 axis.title.x = element_blank(),
591637 axis.title.y = element_blank(),
592638 axis.text.x = element_text(angle = 90 ,hjust = 1 ,vjust = 0.5 ),
593- panel.grid.major = element_line(colour = " gray" , size = 0.5 )
639+ panel.grid.major = element_line(color = " gray" , size = 0.5 )
594640 )
595641 vln.theme <- theme(
596642 panel.background = element_blank(),
@@ -755,12 +801,12 @@ server <- function(input, output){
755801 features = gene1(),
756802 reduction = umap.reduction()
757803 ) +
758- scale_colour_viridis_c () +
804+ scale_color_viridis_c () +
759805 labs(color = " Log-Normalized\n Expression" ) +
760806 umap.theme + theme(
761807 legend.position = " top" ,
762808 plot.title = element_text(face = " bold.italic" )
763- )
809+ ) % > % suppressMessages()
764810 } else {
765811 FeaturePlot(
766812 scMuscle.slim.seurat ,
@@ -769,13 +815,13 @@ server <- function(input, output){
769815 features = gene1(),
770816 reduction = umap.reduction()
771817 ) +
772- scale_colour_viridis_c (direction = - 1 ) +
818+ scale_color_viridis_c (direction = - 1 ) +
773819 labs(color = " Log-Normalized\n Expression" ) +
774820 umap.theme +
775821 theme(
776822 legend.position = " top" ,
777823 plot.title = element_text(face = " bold.italic" )
778- )
824+ ) % > % suppressMessages()
779825 }
780826 })
781827
@@ -796,7 +842,9 @@ server <- function(input, output){
796842 NoLegend() +
797843 aes(stroke = pt.stroke )+
798844 umap.theme +
799- theme(plot.title = element_blank())
845+ theme(
846+ plot.title = element_blank()
847+ ) %> % suppressMessages()
800848 })
801849
802850 # generates third plot (All Cells - metadata UMAP) ----
@@ -815,7 +863,7 @@ server <- function(input, output){
815863 aes(stroke = pt.stroke )+
816864 umap.theme +
817865 theme(plot.title = element_blank())+
818- NoLegend()
866+ NoLegend() % > % suppressMessages()
819867 })
820868
821869 # generates fourth plot (All Cells - Violin Plot)----
@@ -831,9 +879,9 @@ server <- function(input, output){
831879 FUN = function (X ) X +
832880 NoLegend() +
833881 scale_y_continuous(expand = c(0 ,0 )) +
834- scale_colour_viridis_c () +
882+ scale_color_viridis_c () +
835883 vln.theme
836- ) %> % wrap_plots(ncol = 1 )
884+ ) %> % wrap_plots(ncol = 1 ) % > % suppressMessages()
837885 })
838886
839887 # renders image of fifth plot (All Cells - Split Violin Plot)----
@@ -860,7 +908,7 @@ server <- function(input, output){
860908 NoLegend() +
861909 scale_y_continuous(expand = c(0 ,0.5 ))+
862910 facet_grid(rows = vars(scMuscle.slim.seurat @ meta.data [[variables.splitVln()]])) +
863- scale_colour_viridis_c () +
911+ scale_color_viridis_c () +
864912 vln.theme
865913 )
866914 dev.off()
@@ -883,7 +931,7 @@ server <- function(input, output){
883931 features = dot(),
884932 group.by = variables.dot()
885933 )+
886- scale_colour_viridis_c () +
934+ scale_color_viridis_c () +
887935 dot.theme +
888936 labs(title = " Metadata Features" )
889937 )
@@ -935,7 +983,7 @@ server <- function(input, output){
935983 FUN = function (X ) X +
936984 NoLegend() +
937985 scale_y_continuous(expand = c(0 ,.5 ))+
938- scale_colour_viridis_c () +
986+ scale_color_viridis_c () +
939987 vln.theme
940988 ) %> % wrap_plots(ncol = 1 )
941989 )
@@ -963,7 +1011,7 @@ server <- function(input, output){
9631011 legend.position = " right" ,
9641012 pt.size = vis.pt.size ,
9651013 font.size = big.font
966- )
1014+ )& scale_color_gradientn( colors = spatial_gene_colors , na.value = gray( 0.42 ))
9671015 }
9681016 )
9691017
@@ -1081,7 +1129,7 @@ server <- function(input, output){
10811129 features = gene1(),
10821130 reduction = umap.reduction()
10831131 ) +
1084- scale_colour_viridis_c () +
1132+ scale_color_viridis_c () +
10851133 labs(color = " Log-Normalized\n Expression" ) +
10861134 umap.theme ) + theme(legend.position = " top" )
10871135 } else {
@@ -1092,7 +1140,7 @@ server <- function(input, output){
10921140 features = gene1(),
10931141 reduction = umap.reduction()
10941142 ) +
1095- scale_colour_viridis_c (direction = - 1 ) +
1143+ scale_color_viridis_c (direction = - 1 ) +
10961144 labs(color = " Log-Normalized\n Expression" ) +
10971145 umap.theme ) + theme(legend.position = " top" )
10981146 }
@@ -1128,7 +1176,7 @@ server <- function(input, output){
11281176 FUN = function (X ) X +
11291177 NoLegend() +
11301178 scale_y_continuous(expand = c(0 ,0 )) +
1131- scale_colour_viridis_c () +
1179+ scale_color_viridis_c () +
11321180 vln.theme
11331181 ) %> % wrap_plots(ncol = 1 )
11341182 )
@@ -1161,7 +1209,7 @@ server <- function(input, output){
11611209 NoLegend() +
11621210 scale_y_continuous(expand = c(0 ,.5 ))+
11631211 facet_grid(rows = vars(scMuscle.slim.seurat @ meta.data [[variables.splitVln()]]))+
1164- scale_colour_viridis_c ()+
1212+ scale_color_viridis_c ()+
11651213 vln.theme
11661214 )
11671215
@@ -1189,7 +1237,7 @@ server <- function(input, output){
11891237 features = dot(),
11901238 group.by = variables.dot()
11911239 )+
1192- scale_colour_viridis_c ()+
1240+ scale_color_viridis_c ()+
11931241 dot.theme
11941242 )
11951243 ggsave(
@@ -1261,7 +1309,7 @@ server <- function(input, output){
12611309 FUN = function (X ) X +
12621310 NoLegend() +
12631311 scale_y_continuous(expand = c(0 ,.5 ))+
1264- scale_colour_viridis_c () +
1312+ scale_color_viridis_c () +
12651313 vln.theme
12661314 ) %> % wrap_plots(ncol = 1 ))
12671315
0 commit comments