Skip to content

Commit

Permalink
Merge pull request #100 from databio/dev
Browse files Browse the repository at this point in the history
1.3.0 release
  • Loading branch information
vpnagraj authored Oct 2, 2018
2 parents 9a42c57 + 86bd5ea commit 1790e09
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 72 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ apps/LOLAweb/shinylog
apps/LOLAweb/results
apps/LOLAweb/userSets
apps/LOLAweb/scratch.R
*.rdb
8 changes: 7 additions & 1 deletion apps/LOLAweb/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ The columns in the results table are:
<a name="how-to-cite"> </a>
### How do I cite LOLAweb?

LOLAweb is pending publication. In the interim, please cite the LOLA R package:
LOLAweb is published in *Nucleic Acids Research*:

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.

[https://doi.org/10.1093/nar/gky464](https://doi.org/10.1093/nar/gky464)

The LOLA R package is published in *Bioinformatics*:

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.

Expand Down
89 changes: 75 additions & 14 deletions apps/LOLAweb/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ ui <- list(
uiOutput("slider_pvalue"),
uiOutput("select_collection"),
uiOutput("select_sort"),
uiOutput("select_userset")),
uiOutput("select_userset"),
shinyjs::hidden(
downloadButton("all_plots_dl",
label = "Download all plots",
class = "dt-button"))),
column(10,
shinyjs::hidden(
div(
Expand Down Expand Up @@ -210,7 +214,8 @@ ui <- list(
),
tabPanel("Run summary",
h4("Run summary"),
tableOutput("run_sum"), style = "font-size:18px;")
tableOutput("run_sum"),
style = "font-size:18px;")
),
id = "result-tabs")))
)
Expand Down Expand Up @@ -740,7 +745,6 @@ server <- function(input, output, session) {
shinyjs::show("gear2")
shinyjs::show("result-tabs")


# show help text for results sliders and plots
shinyjs::show("infoplot_div")
shinyjs::show("infodisplay_div")
Expand Down Expand Up @@ -770,6 +774,8 @@ server <- function(input, output, session) {

shinyjs::hide("gear2")
shinyjs::show("scatterhead")
shinyjs::show("all_plots_dl")


}

Expand Down Expand Up @@ -1064,7 +1070,7 @@ server <- function(input, output, session) {
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = scatterplot_input()
ggsave(file, plot = scatterplot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9))
, device = "pdf")
}
)
Expand All @@ -1084,7 +1090,7 @@ server <- function(input, output, session) {
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = plot_input(dat(), "oddsRatio", "Odds ratio", input$select_sort_i)
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))
, device = "pdf")
}
)
Expand Down Expand Up @@ -1118,7 +1124,7 @@ server <- function(input, output, session) {
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = plot_input(dat(), "support", "Support", input$select_sort_i)
ggsave(file, plot = plot_input(dat(), "support", "Support", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9))
, device = "pdf")
}
)
Expand Down Expand Up @@ -1154,7 +1160,7 @@ server <- function(input, output, session) {
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = plot_input(dat(), "pValueLog", "log(p value)", input$select_sort_i)
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))
, device = "pdf")
}
)
Expand All @@ -1167,7 +1173,7 @@ server <- function(input, output, session) {

if (is.null(genDist)) {

NULL
missing_plot()

} else {

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

if (is.null(TSSDist)) {

NULL
missing_plot()

} else {

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

if(is.null(gp)) {

NULL
missing_plot()

} else {

Expand All @@ -1247,7 +1253,7 @@ server <- function(input, output, session) {
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = distrib_plot_input(), device = "pdf")
ggsave(file, plot = distrib_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)), device = "pdf", width = 11, height = 5)
}
)

Expand All @@ -1256,19 +1262,74 @@ server <- function(input, output, session) {
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = dist_plot_input(), device = "pdf")
ggsave(file, plot = dist_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)), device = "pdf")
}
)

output$part_plot_dl <- downloadHandler(
filename = function() { paste("paritions",
filename = function() { paste("partitions",
".pdf",
sep="") },
content = function(file) {
ggsave(file, plot = part_plot_input(), device = "pdf")
ggsave(file, plot = part_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)), device = "pdf")
}
)

# to zip all plots and save individually ...

output$all_plots_dl <- downloadHandler(
filename = function() {
paste("lolawebplots", "zip", sep=".")
},
content = function(fname) {

ggsave(filename = "scatter.pdf",
plot = scatterplot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
device = "pdf",
path = "plots")

ggsave(filename = "oddsratio.pdf",
plot = plot_input(dat(), "oddsRatio", "Odds ratio", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
device = "pdf",
path = "plots")

ggsave(filename = "support.pdf",
plot = plot_input(dat(), "support", "Support", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
device = "pdf",
path = "plots")

ggsave(filename = "pvalue.pdf",
plot = plot_input(dat(), "pValueLog", "log(p value)", input$select_sort_i) + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
device = "pdf",
path = "plots")

# using pdf() device here bc custom aspect ratio not working with ggsave() in this case
pdf("plots/gendist.pdf", width = 11, height = 5)
print(distrib_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)))
dev.off()

ggsave(filename = "tssdist.pdf",
plot = dist_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
device = "pdf",
path = "plots")

ggsave(filename = "partitions.pdf",
plot = part_plot_input() + theme(axis.text = element_text(size = 9), text = element_text(size = 9)),
device = "pdf",
path = "plots")

# identify files to be zipped and zip them
fs <- list.files("plots", full.names = TRUE)
zip(zipfile=fname, files=fs)

# delete tmp plot files after zip is done
unlink(fs)

},
contentType = "application/zip"

)



# data table
Expand Down
16 changes: 16 additions & 0 deletions apps/LOLAweb/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ plot_input <- function(res, metric, ylabel, sortcol) {

}

# missing_plot() creates
missing_plot <- function() {

ggplot(data.frame(x=1:5, y = 1:5), aes(x, y)) +
geom_blank() +
annotate("text", x = 3, y = 4, label = "Unable to render plot", size = 10, col = "red") +
xlab("") +
ylab("") +
theme(line = element_blank(),
rect = element_blank(),
axis.ticks.length = unit(0,"cm"),
axis.text = element_blank(),
legend.position = "none",
panel.spacing = unit(0,"lines"),
plot.margin = unit(c(0, 0, 0, 0), "lines"))
}

# This function just wraps the base Sys.gentenv function to provide a default
# value for the case that the environment variable is not specified.
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ RUN git clone https://github.com/databio/LOLAweb.git
# add dir for cache
RUN mkdir LOLAweb/cache
RUN chown -R shiny:shiny LOLAweb/cache

# add plots dir for zipping up all figures to download with one button
RUN mkdir LOLAweb/apps/LOLAweb/plots
RUN chown -R shiny:shiny LOLAweb/apps/LOLAweb/plots

# run the server setup script
CMD ["/usr/bin/shiny-server.sh"]
2 changes: 2 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Shiny LOLAweb for Docker

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/).

## `build` the container image yourself

1. Clone this repository
Expand Down
4 changes: 4 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ RUN git clone -b dev https://github.com/databio/LOLAweb.git
RUN mkdir LOLAweb/cache
RUN chown -R shiny:shiny LOLAweb/cache

# add plots dir for zipping up all figures to download with one button
RUN mkdir LOLAweb/apps/LOLAweb/plots
RUN chown -R shiny:shiny LOLAweb/apps/LOLAweb/plots

# run the server setup script
CMD ["/usr/bin/shiny-server.sh"]
4 changes: 4 additions & 0 deletions docker/dev/shiny-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server

# make sure relevant environment variables are visible to shiny server .Renviron
env | grep "LWLOCAL\|LWREF" > /home/shiny/.Renviron
chown shiny.shiny /home/shiny/.Renviron

exec shiny-server 2>&1

# done
4 changes: 4 additions & 0 deletions docker/shiny-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server

# make sure relevant environment variables are visible to shiny server .Renviron
env | grep "LWLOCAL\|LWREF" > /home/shiny/.Renviron
chown shiny.shiny /home/shiny/.Renviron

exec shiny-server 2>&1

# done
18 changes: 0 additions & 18 deletions docker/staging/Dockerfile

This file was deleted.

29 changes: 0 additions & 29 deletions docker/staging/shiny-server.conf

This file was deleted.

10 changes: 0 additions & 10 deletions docker/staging/shiny-server.sh

This file was deleted.

0 comments on commit 1790e09

Please sign in to comment.