diff --git a/docs/install.rst b/docs/install.rst index 72fa9ccc..73faf357 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -77,8 +77,8 @@ Download the archives for `class I `_ and .. code-block:: none apt-get update && apt-get install -y tcsh gawk - wget https://downloads.iedb.org/tools/mhci/3.1.2/IEDB_MHC_I-3.1.2.tar.gz - tar -zxvf IEDB_MHC_I-3.1.2.tar.gz + wget https://downloads.iedb.org/tools/mhci/3.1.5/IEDB_MHC_I-3.1.5.tar.gz + tar -zxvf IEDB_MHC_I-3.1.5.tar.gz cd mhc_i ./configure @@ -90,8 +90,8 @@ Download the archives for `class II `_ an .. code-block:: none apt-get update && apt-get install -y tcsh gawk - wget https://downloads.iedb.org/tools/mhcii/3.1.6/IEDB_MHC_II-3.1.6.tar.gz - tar -zxvf IEDB_MHC_II-3.1.6.tar.gz + wget https://downloads.iedb.org/tools/mhcii/3.1.11/IEDB_MHC_II-3.1.11.tar.gz + tar -zxvf IEDB_MHC_II-3.1.11.tar.gz cd mhc_ii ./configure.py diff --git a/pvactools/tools/pvacview/Dockerfile b/pvactools/tools/pvacview/Dockerfile new file mode 100644 index 00000000..bb05b8fc --- /dev/null +++ b/pvactools/tools/pvacview/Dockerfile @@ -0,0 +1,31 @@ +FROM rocker/shiny-verse + +RUN R -e "install.packages(c('shiny',\ + 'shinyjs',\ + 'shinythemes',\ + 'plotly', \ + 'RMySQL',\ + 'ggplot2',\ + 'DT',\ + 'reshape2',\ + 'jsonlite',\ + 'tibble',\ + 'tidyr',\ + 'plyr',\ + 'dplyr',\ + 'stringr', \ + 'shinydashboard', \ + 'shinydashboardPlus', \ + 'shinycssloaders', \ + 'fresh', \ + 'RCurl' ), repos='https://cran.rstudio.com/')" + +RUN R -e "devtools::install_github('eclarke/ggbeeswarm', ref='v0.6.1')" + +RUN rm -rf /srv/shiny-server/* + +COPY . /srv/shiny-server/ + +EXPOSE 3333 + +CMD ["R", "-e", "shiny::runApp('/srv/shiny-server/', port = 3333, host='0.0.0.0')"] \ No newline at end of file diff --git a/pvactools/tools/pvacview/app.R b/pvactools/tools/pvacview/app.R index e705e9d9..621b8197 100644 --- a/pvactools/tools/pvacview/app.R +++ b/pvactools/tools/pvacview/app.R @@ -3,7 +3,7 @@ library(shiny) source(server.R) source(ui.R) -options(shiny.host = '127.0.0.1') +options(shiny.host = '0.0.0.0') options(shiny.port = 3333) shinyApp(ui, server) diff --git a/pvactools/tools/pvacview/gcloud_service.sh b/pvactools/tools/pvacview/gcloud_service.sh new file mode 100755 index 00000000..2586c5be --- /dev/null +++ b/pvactools/tools/pvacview/gcloud_service.sh @@ -0,0 +1,137 @@ +IMAGE_NAME="pvacview" +TAG_NAME="latest" # do not change this unless you have looked at how your service fetches the tag +REGION="us-central1" +LAB="griffith-lab" # also the project name +REPO="shiny-apps" +SERVICE_NAME="pvacview" +SERVICE_TAG=$2 # format like: v1-0-0 + +# script +COMMAND=$1 # init or update + +function show_help { + echo "usage: sh gcloud_service.sh COMMAND " + echo "" + echo "commands:" + echo " init Creates a new service in Cloud Run." + echo " update updates an existing service in Cloud Run." + echo "" + echo "arguments:" + echo " Positional argument that tags the revision/release of the service (example: v1-0-0)." + echo "" +} + +function validate { + # check if Docker is running + if ! docker info >/dev/null 2>&1; then + echo "ERROR: Docker does not appear to be running. Please start Docker." + # Exit with a non-zero status to indicate that Docker isn't running + exit 1 + fi + + # check if you are logged in + if [[ -z $(gcloud auth list --filter=status:ACTIVE --format="value(account)") ]]; then + echo "<< Please log in.>>" + gcloud auth login + else + echo "<< [Alread logged in]: Welcome, $(gcloud auth list --filter=status:ACTIVE --format="value(account)") >>" + fi + + # check if user is allowed to push to Artifact Registry + if [[ -z $(cat ~/.docker/config.json | grep "\"$REGION-docker.pkg.dev\": \"gcloud\"") ]]; then + echo "<< Attempting to Authenticate before pushing to Artifact Registry. >>" + gcloud auth configure-docker $REGION-docker.pkg.dev + else + echo "<< Allowed to push to Artifact Registry >>" + fi +} + +function build_and_push_image { + # build the image + docker build . --tag $REGION-docker.pkg.dev/$LAB/$REPO/$IMAGE_NAME:$TAG_NAME + + # Check the exit code of the docker build command + if [ $? -ne 0 ]; then + echo "Error: Docker build failed" + exit 1 + fi + + # push the image + docker push $REGION-docker.pkg.dev/$LAB/$REPO/$IMAGE_NAME:$TAG_NAME + + # Check the exit code of the docker push command + if [ $? -ne 0 ]; then + echo "Error: Docker push failed" + exit 1 + fi +} + +function init { + build_and_push_image + + # deploy: https://cloud.google.com/sdk/gcloud/reference/run/deploy + gcloud --project $LAB run deploy $SERVICE_NAME \ + --image $REGION-docker.pkg.dev/$LAB/$REPO/$IMAGE_NAME:$TAG_NAME \ + --port=3333 \ + --min-instances=0 \ + --max-instances=100 \ + --memory=2Gi \ + --cpu=4 \ + --timeout=300 \ + --allow-unauthenticated \ + --update-env-vars KEY=VALUE --revision-suffix $SERVICE_TAG +} + +function update { + # check SERVICE_TAG does not already exist + TAGS=$(gcloud run revisions list --project $LAB --service $SERVICE_NAME --format="value(REVISION)") + if [[ $TAGS =~ $SERVICE_TAG ]]; then + echo "ERROR: The Service \"$SERVICE_NAME\" already has revision $SERVICE_TAG. Please use a new tag." + exit 1 + fi + + # set region; updating service will ask for region if this is not set + if [[ $(gcloud config get-value run/region) != "$REGION" ]]; then + echo "<< Upadting property [run/region] to $REGION >>" + gcloud config set run/region $REGION + fi + + build_and_push_image + + # update service + if [[ -z $(gcloud --project $LAB run services list | grep -w $SERVICE_NAME) ]]; then + echo "<>" + else + gcloud --project $LAB run services update $SERVICE_NAME --update-env-vars KEY=VALUE --revision-suffix $SERVICE_TAG + fi +} + +if [[ ($COMMAND != "init") && ($COMMAND != "update")]]; then + show_help + echo "ERROR: invalid command." + exit 1 +else + validate + case $COMMAND in + "init") + init + ;; + "update") + update + ;; + esac +fi + + + + + + + + + + + + + + diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index 1aa566a0..1c10e672 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -14,7 +14,7 @@ source("styling.R") #specify max shiny app upload size (currently 300MB) options(shiny.maxRequestSize = 300 * 1024^2) -options(shiny.host = '127.0.0.1') +options(shiny.host = '0.0.0.0') options(shiny.port = 3333) server <- shinyServer(function(input, output, session) { @@ -73,7 +73,7 @@ server <- shinyServer(function(input, output, session) { colnames(mainData) <- mainData[1, ] mainData <- mainData[-1, ] row.names(mainData) <- NULL - mainData$`Eval` <- shinyInput(mainData, selectInput, nrow(mainData), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "60px") + mainData$`Eval` <- shinyInput(mainData, selectInput, nrow(mainData), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "90px") mainData$Select <- shinyInputSelect(actionButton, nrow(mainData), "button_", label = "Investigate", onclick = 'Shiny.onInputChange(\"select_button\", this.id)') mainData$`IC50 MT` <- as.numeric(mainData$`IC50 MT`) mainData$`%ile MT` <- as.numeric(mainData$`%ile MT`) @@ -157,7 +157,7 @@ server <- shinyServer(function(input, output, session) { colnames(mainData) <- mainData[1, ] mainData <- mainData[-1, ] row.names(mainData) <- NULL - mainData$`Eval` <- shinyInput(mainData, selectInput, nrow(mainData), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "60px") + mainData$`Eval` <- shinyInput(mainData, selectInput, nrow(mainData), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "90px") mainData$Select <- shinyInputSelect(actionButton, nrow(mainData), "button_", label = "Investigate", onclick = 'Shiny.onInputChange(\"select_button\", this.id)') mainData$`IC50 MT` <- as.numeric(mainData$`IC50 MT`) mainData$`%ile MT` <- as.numeric(mainData$`%ile MT`) @@ -332,7 +332,7 @@ server <- shinyServer(function(input, output, session) { df$mainTable$`Rank_ic50` <- NULL df$mainTable$`Rank_expr` <- NULL df$mainTable$Select <- shinyInputSelect(actionButton, nrow(df$mainTable), "button_", label = "Investigate", onclick = 'Shiny.onInputChange(\"select_button\", this.id)') - df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "60px") + df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "90px") }) #reset tier-ing with original parameters observeEvent(input$reset_params, { @@ -368,7 +368,7 @@ server <- shinyServer(function(input, output, session) { df$mainTable$`Rank_ic50` <- NULL df$mainTable$`Rank_expr` <- NULL df$mainTable$Select <- shinyInputSelect(actionButton, nrow(df$mainTable), "button_", label = "Investigate", onclick = 'Shiny.onInputChange(\"select_button\", this.id)') - df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "60px") + df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "90px") }) #determine hla allele count in order to generate column tooltip locations correctly hla_count <- reactive({ @@ -432,7 +432,7 @@ server <- shinyServer(function(input, output, session) { df$pageLength <- as.numeric(input$page_length) session$sendCustomMessage("unbind-DT", "mainTable") df$mainTable$`Evaluation` <- shinyValue("selecter_", nrow(df$mainTable), df$mainTable) - df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "60px") + df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "90px") }) output$filesUploaded <- reactive({ val <- !(is.null(df$mainTable) | is.null(df$metricsData)) @@ -541,7 +541,7 @@ server <- shinyServer(function(input, output, session) { df$selectedRow <- as.numeric(strsplit(input$select_button, "_")[[1]][2]) session$sendCustomMessage("unbind-DT", "mainTable") df$mainTable$`Evaluation` <- shinyValue("selecter_", nrow(df$mainTable), df$mainTable) - df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "60px") + df$mainTable$`Eval` <- shinyInput(df$mainTable, selectInput, nrow(df$mainTable), "selecter_", choices = c("Pending", "Accept", "Reject", "Review"), width = "90px") dataTableProxy("mainTable") %>% selectPage((df$selectedRow - 1) %/% df$pageLength + 1) })