Application Deployment Guide
deploy.RmdApplication Deployment Guide
This guide documents standalone deployment files, setup scripts, and
Shiny application templates for running and deploying
foundrShiny applications located in the inst/shinyApp/
directory.
- Data Preliminaries
- Directory Overview
- Expected Data Directory Layout
- Setting Up Data for Shiny App
- How to Run the Shiny App
Data Preliminaries
Unless you have already loaded data, you will need to do that with one of the scripts, for either a minimal subset or the full Liver panel. You will need to be on campus or use GlobalProtect VPN.
The processed data for the foundrShiny app are in
[RD]/adattie/General/founder_diet_study where
[RD] is /research.drive.wisc.edu, which you
typically mount as /Volumes for Linux and MacOS and
R: for Windows.
On MacOS, it is convenient to establish a symbolic link in your home
directory (~) with the one-time command:
Raw data are in ~/founder_diet_study/RawData and
harmonized data are in ~/founder_diet_study/HarmonizedData.
These are accessed via the setup scripts as input to the
foundrShiny app.
Directory Overview
The inst/shinyApp/
deployment directory contains the following components:
| File | Description |
|---|---|
app.R |
Primary Shiny application entry point using
foundrShiny::foundrSetup(). |
setup.R |
Standalone script for loading datasets into the
workspace without foundrSetup(). |
TraitData.R |
Helper script sourced by foundrSetup() to
process and filter input RDS files. |
appDetail.R |
Alternative standalone Shiny deployment script with explicit file path configurations. |
intro.md |
Markdown overview displayed in the entry panel of the Shiny app. |
help.md |
User help documentation displayed within the interactive panels. |
foundrDAG.Rmd |
Directed Acyclic Graph (DAG) documentation file for trait module structures. |
Data Prerequisites & Directory Structure
To run the Shiny application, your data directory
(dirpath) must contain pre-processed .rds data
objects generated by the foundr package pipeline.
Expected Data Directory Layout
dirpath/
├── liverData.rds # Trait measurements (or traitData.rds)
├── liverSignal.rds # Statistical signal data (or traitSignal.rds)
├── liverStats.rds # Differential analysis statistics (or traitStats.rds)
├── traitModule.rds # Module definitions / clustering (optional)
├── datasets.rds # Metadata table mapping dataset keys to titles
└── AppSetup/
└── Liver/
└── help.md # (Optional) Instance-specific help file
[!NOTE] The prefix (
liverortrait) corresponds to thedata_instanceparameter passed tofoundrSetup().
Setting Up Data for Shiny App
You must have key data files loaded into the R workspace
prior to running app.R (or
foundrShinyApp()). These can be loaded via
foundrSetup() or using the setup.R script.
These create five key R objects in the global
environment:
-
traitData: Data frame containing raw/normalized trait values, strain, sex, diet, and dataset metadata. -
traitSignal: Data frame of ANOVA / statistical model summaries per trait. -
traitStats: Data frame of pairwise contrasts, effect sizes, and p-values. -
traitModule: (Optional) Data frame mapping traits to co-expression/functional modules. -
customSettings: Named list of app settings (help file path, condition name, group name, dataset lookup table).
Automated Setup via foundrSetup() (Recommended)
In app.R,
configure foundrSetup() with your data location and desired
data subset:
library(foundrShiny)
# 1. Initialize runtime data objects (with subset of data)
foundrShiny::foundrSetup(
data_subset = c("Physio", "MixMod")
)
# 2. Define application title
title <- "Founder Diet Study"
# 3. Construct UI and Server using foundrShiny modules
ui <- shiny::fluidPage(
shiny::titlePanel(title),
shiny::sidebarLayout(
shiny::sidebarPanel(
foundrShiny::foundrInput("foundr")
),
shiny::mainPanel(
foundrShiny::foundrOutput("foundr")
)
)
)
server <- function(input, output, session) {
foundrShiny::foundrServer(
"foundr",
traitData, traitSignal, traitStats,
customSettings, traitModule
)
}
shiny::shinyApp(ui, server)Manual Data Loading via setup.R
If you are running in a custom environment or debugging without
foundrSetup(), you can define variables prior to sourcing
setup.R:
small <- FALSE # Set to FALSE for full dataset (defaults to TRUE if unset)
source("inst/shinyApp/setup.R")If small = TRUE, only the first 2 datasets and the first
2 traits per dataset are included.
How to Run the App
From RStudio / R Console
Launch directly from the repository root:
# Run directly using shiny::runApp
shiny::runApp("inst/shinyApp")Or open inst/shinyApp/app.R in RStudio and click
Run App.