Skip to content

Commit 1790e09

Browse files
authored
Merge pull request #100 from databio/dev
1.3.0 release
2 parents 9a42c57 + 86bd5ea commit 1790e09

12 files changed

Lines changed: 117 additions & 72 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ apps/LOLAweb/shinylog
1414
apps/LOLAweb/results
1515
apps/LOLAweb/userSets
1616
apps/LOLAweb/scratch.R
17+
*.rdb

apps/LOLAweb/about.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ The columns in the results table are:
9797
<a name="how-to-cite"> </a>
9898
### How do I cite LOLAweb?
9999

100-
LOLAweb is pending publication. In the interim, please cite the LOLA R package:
100+
LOLAweb is published in *Nucleic Acids Research*:
101+
102+
V. P. Nagraj, N. E. Magee and N. C. Sheffield, "LOLAweb: a containerized web server for interactive genomic locus overlap enrichment analysis," Nucleic Acids Research, vol. 46, no. w1, pp. w194-w199, Jul. 2018.
103+
104+
[https://doi.org/10.1093/nar/gky464](https://doi.org/10.1093/nar/gky464)
105+
106+
The LOLA R package is published in *Bioinformatics*:
101107

102108
N. C. Sheffield and C. Bock, “LOLA: enrichment analysis for genomic region sets and regulatory elements in R and Bioconductor,” Bioinformatics, vol. 32, no. 4, pp. 587–589, Oct. 2016.
103109

apps/LOLAweb/app.R

Lines changed: 75 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ ui <- list(
133133
uiOutput("slider_pvalue"),
134134
uiOutput("select_collection"),
135135
uiOutput("select_sort"),
136-
uiOutput("select_userset")),
136+
uiOutput("select_userset"),
137+
shinyjs::hidden(
138+
downloadButton("all_plots_dl",
139+
label = "Download all plots",
140+
class = "dt-button"))),
137141
column(10,
138142
shinyjs::hidden(
139143
div(
@@ -210,7 +214,8 @@ ui <- list(
210214
),
211215
tabPanel("Run summary",
212216
h4("Run summary"),
213-
tableOutput("run_sum"), style = "font-size:18px;")
217+
tableOutput("run_sum"),
218+
style = "font-size:18px;")
214219
),
215220
id = "result-tabs")))
216221
)
@@ -740,7 +745,6 @@ server <- function(input, output, session) {
740745
shinyjs::show("gear2")
741746
shinyjs::show("result-tabs")
742747

743-
744748
# show help text for results sliders and plots
745749
shinyjs::show("infoplot_div")
746750
shinyjs::show("infodisplay_div")
@@ -770,6 +774,8 @@ server <- function(input, output, session) {
770774

771775
shinyjs::hide("gear2")
772776
shinyjs::show("scatterhead")
777+
shinyjs::show("all_plots_dl")
778+
773779

774780
}
775781

@@ -1064,7 +1070,7 @@ server <- function(input, output, session) {
10641070
".pdf",
10651071
sep="") },
10661072
content = function(file) {
1067-
ggsave(file, plot = scatterplot_input()
1073+
ggsave(file, plot = scatterplot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9))
10681074
, device = "pdf")
10691075
}
10701076
)
@@ -1084,7 +1090,7 @@ server <- function(input, output, session) {
10841090
".pdf",
10851091
sep="") },
10861092
content = function(file) {
1087-
ggsave(file, plot = plot_input(dat(), "oddsRatio", "Odds ratio", input$select_sort_i)
1093+
ggsave(file, plot = plot_input(dat(), "oddsRatio", "Odds ratio", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9))
10881094
, device = "pdf")
10891095
}
10901096
)
@@ -1118,7 +1124,7 @@ server <- function(input, output, session) {
11181124
".pdf",
11191125
sep="") },
11201126
content = function(file) {
1121-
ggsave(file, plot = plot_input(dat(), "support", "Support", input$select_sort_i)
1127+
ggsave(file, plot = plot_input(dat(), "support", "Support", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9))
11221128
, device = "pdf")
11231129
}
11241130
)
@@ -1154,7 +1160,7 @@ server <- function(input, output, session) {
11541160
".pdf",
11551161
sep="") },
11561162
content = function(file) {
1157-
ggsave(file, plot = plot_input(dat(), "pValueLog", "log(p value)", input$select_sort_i)
1163+
ggsave(file, plot = plot_input(dat(), "pValueLog", "log(p value)", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9))
11581164
, device = "pdf")
11591165
}
11601166
)
@@ -1167,7 +1173,7 @@ server <- function(input, output, session) {
11671173

11681174
if (is.null(genDist)) {
11691175

1170-
NULL
1176+
missing_plot()
11711177

11721178
} else {
11731179

@@ -1195,7 +1201,7 @@ server <- function(input, output, session) {
11951201

11961202
if (is.null(TSSDist)) {
11971203

1198-
NULL
1204+
missing_plot()
11991205

12001206
} else {
12011207

@@ -1222,7 +1228,7 @@ server <- function(input, output, session) {
12221228

12231229
if(is.null(gp)) {
12241230

1225-
NULL
1231+
missing_plot()
12261232

12271233
} else {
12281234

@@ -1247,7 +1253,7 @@ server <- function(input, output, session) {
12471253
".pdf",
12481254
sep="") },
12491255
content = function(file) {
1250-
ggsave(file, plot = distrib_plot_input(), device = "pdf")
1256+
ggsave(file, plot = distrib_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)), device = "pdf", width = 11, height = 5)
12511257
}
12521258
)
12531259

@@ -1256,19 +1262,74 @@ server <- function(input, output, session) {
12561262
".pdf",
12571263
sep="") },
12581264
content = function(file) {
1259-
ggsave(file, plot = dist_plot_input(), device = "pdf")
1265+
ggsave(file, plot = dist_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)), device = "pdf")
12601266
}
12611267
)
12621268

12631269
output$part_plot_dl <- downloadHandler(
1264-
filename = function() { paste("paritions",
1270+
filename = function() { paste("partitions",
12651271
".pdf",
12661272
sep="") },
12671273
content = function(file) {
1268-
ggsave(file, plot = part_plot_input(), device = "pdf")
1274+
ggsave(file, plot = part_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)), device = "pdf")
12691275
}
12701276
)
12711277

1278+
# to zip all plots and save individually ...
1279+
1280+
output$all_plots_dl <- downloadHandler(
1281+
filename = function() {
1282+
paste("lolawebplots", "zip", sep=".")
1283+
},
1284+
content = function(fname) {
1285+
1286+
ggsave(filename = "scatter.pdf",
1287+
plot = scatterplot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
1288+
device = "pdf",
1289+
path = "plots")
1290+
1291+
ggsave(filename = "oddsratio.pdf",
1292+
plot = plot_input(dat(), "oddsRatio", "Odds ratio", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
1293+
device = "pdf",
1294+
path = "plots")
1295+
1296+
ggsave(filename = "support.pdf",
1297+
plot = plot_input(dat(), "support", "Support", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
1298+
device = "pdf",
1299+
path = "plots")
1300+
1301+
ggsave(filename = "pvalue.pdf",
1302+
plot = plot_input(dat(), "pValueLog", "log(p value)", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
1303+
device = "pdf",
1304+
path = "plots")
1305+
1306+
# using pdf() device here bc custom aspect ratio not working with ggsave() in this case
1307+
pdf("plots/gendist.pdf", width = 11, height = 5)
1308+
print(distrib_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)))
1309+
dev.off()
1310+
1311+
ggsave(filename = "tssdist.pdf",
1312+
plot = dist_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
1313+
device = "pdf",
1314+
path = "plots")
1315+
1316+
ggsave(filename = "partitions.pdf",
1317+
plot = part_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
1318+
device = "pdf",
1319+
path = "plots")
1320+
1321+
# identify files to be zipped and zip them
1322+
fs <- list.files("plots", full.names = TRUE)
1323+
zip(zipfile=fname, files=fs)
1324+
1325+
# delete tmp plot files after zip is done
1326+
unlink(fs)
1327+
1328+
},
1329+
contentType = "application/zip"
1330+
1331+
)
1332+
12721333

12731334

12741335
# data table

apps/LOLAweb/misc.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ plot_input <- function(res, metric, ylabel, sortcol) {
6060

6161
}
6262

63+
# missing_plot() creates
64+
missing_plot <- function() {
65+
66+
ggplot(data.frame(x=1:5, y = 1:5), aes(x, y)) +
67+
geom_blank() +
68+
annotate("text", x = 3, y = 4, label = "Unable to render plot", size = 10, col = "red") +
69+
xlab("") +
70+
ylab("") +
71+
theme(line = element_blank(),
72+
rect = element_blank(),
73+
axis.ticks.length = unit(0,"cm"),
74+
axis.text = element_blank(),
75+
legend.position = "none",
76+
panel.spacing = unit(0,"lines"),
77+
plot.margin = unit(c(0, 0, 0, 0), "lines"))
78+
}
6379

6480
# This function just wraps the base Sys.gentenv function to provide a default
6581
# value for the case that the environment variable is not specified.

docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ RUN git clone https://github.com/databio/LOLAweb.git
1313
# add dir for cache
1414
RUN mkdir LOLAweb/cache
1515
RUN chown -R shiny:shiny LOLAweb/cache
16+
17+
# add plots dir for zipping up all figures to download with one button
18+
RUN mkdir LOLAweb/apps/LOLAweb/plots
19+
RUN chown -R shiny:shiny LOLAweb/apps/LOLAweb/plots
1620

1721
# run the server setup script
1822
CMD ["/usr/bin/shiny-server.sh"]

docker/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# Shiny LOLAweb for Docker
44

5+
The `databio/lolaweb` container is based on the `databio/shinybase` container, which you can find in its [github repository](https://github.com/databio/shinyBase) or [on dockerhub](https://hub.docker.com/r/databio/shinybase/).
6+
57
## `build` the container image yourself
68

79
1. Clone this repository

docker/dev/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ RUN git clone -b dev https://github.com/databio/LOLAweb.git
1414
RUN mkdir LOLAweb/cache
1515
RUN chown -R shiny:shiny LOLAweb/cache
1616

17+
# add plots dir for zipping up all figures to download with one button
18+
RUN mkdir LOLAweb/apps/LOLAweb/plots
19+
RUN chown -R shiny:shiny LOLAweb/apps/LOLAweb/plots
20+
1721
# run the server setup script
1822
CMD ["/usr/bin/shiny-server.sh"]

docker/dev/shiny-server.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
mkdir -p /var/log/shiny-server
66
chown shiny.shiny /var/log/shiny-server
77

8+
# make sure relevant environment variables are visible to shiny server .Renviron
9+
env | grep "LWLOCAL\|LWREF" > /home/shiny/.Renviron
10+
chown shiny.shiny /home/shiny/.Renviron
11+
812
exec shiny-server 2>&1
913

1014
# done

docker/shiny-server.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
mkdir -p /var/log/shiny-server
66
chown shiny.shiny /var/log/shiny-server
77

8+
# make sure relevant environment variables are visible to shiny server .Renviron
9+
env | grep "LWLOCAL\|LWREF" > /home/shiny/.Renviron
10+
chown shiny.shiny /home/shiny/.Renviron
11+
812
exec shiny-server 2>&1
913

1014
# done

docker/staging/Dockerfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)