2 Setup

2.1 R, RStudio and Packages Versions

If the user chooses to install and use exposomeShiny using RStudio instead of Docker, the list of package versions used for the development of the application is provided for stability purposes. When using the Docker version of the application, all of the following is bundled on the image so the user does not have to deal with the installation of any package.

Software:

R software Version
R 4.0.2
RStudio 1.4.1103

R packages:

R Packages Version
shiny 1.5.0
shinyBS 0.61
rexposome 1.12.2
omicRexposome 1.12.0
MultiDataSet 1.18.0
mice 3.11.0
DT 0.16
ggplot2 3.3.2
data.table 1.13.2
truncdist 1.0
shinyalert 2.0.0
shinydashboard 0.7.1
shinyjs 2.0.0
TxDb.Hsapiens.UCSC.hg19.knownGene 3.2.2
org.Hs.eg.db 3.12.0
GenomicRanges 1.42.0
CTDquerier 1.4.3
shinycssloaders 1.0.0
pastecs 1.3.21
shinyWidgets 0.5.4
clusterProfiler 3.18.1
enrichplot 1.10.2
ggupset 0.3.0
imputeLCMD 2.0
mixOmics 6.14.0

There are two different ways of setting up and using exposomeShiny

2.2 Downloading the source files, installing the libraries and running the application

The user can choose to download the source code of the shiny application and install all the required libraries on their local R installation. Make sure Rtools is installed to use this method.

  # Set working directory
setwd(dir = "/some/path/")
      
  # Download zip
download.file(url = "https://github.com/isglobal-brge/exposomeShiny/archive/master.zip", destfile = "master.zip")

  # Unzip the .zip to the working directory
unzip(zipfile = "master.zip")

  # Set the working directory inside the downloaded folder
setwd(dir = "/some/path/exposomeShiny-master")
Now all the source files are downloaded to the location of chose and the working directory moved to the correct folder, to start the project, open the Rproj file by clicking it on the Files explorer of RStudio.
Source files

Once the project is loaded, the file found on the source folder called installer.R has to be sourced and run. This will install the newest versions of the packages required by Exposome Shiny on this R session. To do so, run the following code on the RStudio console.

source("installer.R")

This is only needed on the first run, once completed it doesn’t need to be done prior to launching the application itself any other time.

Now everything is ready to launch the Shiny application. To do so there a two approaches, one is to open the ui.R or the server.R files that are inside the R folder and press Run App.

Start Shiny application

Or the other option is to input the following command on the console.

shiny::runApp('R')

2.3 Pulling the official Docker image from DockerHub

If there’s any troubble downloading the required R packages to make exposomeShiny work, there’s the option of using Docker. It has the disadvantage of being a little bit difficult to install on a Windows machine, however, it’s extremely simple on a Mac OS X / Linux environment. For the Windows users refer to the following links for instructions on how to install Docker and setup you machine to run WSL2 and launch bash commands on Windows 1, 2, 3.

To download and launch exposomeShiny, execute the following command on a bash terminal(make sure Docker is running, if not search for the Docker Desktop app and launch it).

docker run --rm -p 80:80 brgelab/exposome-shiny

This command will download the Docker image of exposomeShiny (be aware it weights ~ 3 GB, so if your internet connection is slow it may take a while) and run a container with it. The container will be exposed on the local port 80 and it will render on that port the application itself, so to start using exposomeShiny open your web browser and go to the site

localhost:80

At the beginning it may take some time for the application to render, this is because all the needed R libraries are being loaded, to be sure the container is actually working, take a look at the terminal where you inputed the Docker command, there you will see all the R verbose stating the libraries are being loaded.

Once the user has finished using exposomeShiny, the container needs to be stopped to avoid wasting CPU resources, to do so, input the following command on a bash terminal (the command needs to be inputed on a new bash window):

docker container ls

This will prompt all the running containers, find the one with the NAMES brgelab/exposome-shiny and copy it’s CONTAINER ID, then input the following bash command:

docker stop xxxxxxxxxxxx

Where xxxxxxxxxxxx is the CONTAINER ID.

To run the application again, just enter the first bash command (docker run --rm -p 80:80 brgelab/exposome-shiny), since it has already been downloaded, the application is cached on the computer and it will launch straight away. If the user wants to remove the Docker image from the computer, input the following bash command:

docker image rm brgelab/exposome-shiny