Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showcase different teal_slices in Basic teal app + update header and footer #172

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 24 additions & 50 deletions RNA-seq/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ library(teal.modules.hermes)
library(teal.modules.general)
options(shiny.useragg = FALSE)

nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"

## Data reproducible code ----
data <- teal_data()
data <- within(data, {
Expand All @@ -17,9 +15,33 @@ data <- within(data, {
})
datanames(data) <- c("ADTTE", "MAE")

## App header and footer ----
nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"
app_source <- "https://github.com/insightsengineering/teal.gallery/tree/main/RNA-seq"
gh_issues_page <- "https://github.com/insightsengineering/teal.gallery/issues"

header <- tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span("My first teal app", style = "font-size: 30px;"),
tags$span(
style = "display: flex; align-items: center;",
tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"),
tags$span(style = "font-size: 24px;", "NEST @ Roche")
)
)

footer <- tags$p(
"This teal app is brought to you by the NEST Team at Roche/Genentech.
For more information, please visit:",
tags$a(href = app_source, target = "_blank", "Source Code"), ", ",
tags$a(href = gh_issues_page, target = "_blank", "Report Issues")
)

app <- init(
data = data,
title = build_app_title("RNA-Seq Analysis Teal Demo App", nest_logo),
header = header,
footer = footer,
modules = modules(
tm_front_page(
label = "App Info",
Expand Down Expand Up @@ -62,56 +84,8 @@ app <- init(
adtte_name = "ADTTE",
mae_name = "MAE"
)
),
title = build_app_title("RNA-Seq Analysis Teal Demo App", nest_logo),
header = tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span(
style = "font-size: 30px;",
"Example teal app focusing on analysis of RNA-seq data with teal.modules.hermes"
),
tags$span(
style = "display: flex; align-items: center;",
tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"),
tags$span(style = "font-size: 24px;", "NEST @ Roche")
)
),
footer = tags$p(
actionLink("showAboutModal", "About,"),
tags$a(
href = "https://github.com/insightsengineering/teal.gallery/tree/main/RNA-seq",
target = "_blank",
"Source Code,"
),
tags$a(
href = "https://github.com/insightsengineering/teal.gallery/issues",
target = "_blank",
"Report Issues"
)
)
)

body(app$server)[[length(body(app$server)) + 1]] <- quote(
observeEvent(input$showAboutModal, {
showModal(modalDialog(
tags$p(
"This teal app is brought to you by the NEST Team at Roche/Genentech.
For more information, please visit:"
),
tags$ul(
tags$li(tags$a(
href = "https://github.com/insightsengineering", "Insights Engineering",
target = "blank"
)),
tags$li(tags$a(
href = "https://pharmaverse.org", "Pharmaverse",
target = "blank"
))
),
easyClose = TRUE
))
})
)

## Not run:
shinyApp(app$ui, app$server)
107 changes: 55 additions & 52 deletions basic-teal/app.R
Original file line number Diff line number Diff line change
@@ -1,67 +1,70 @@
library(teal)

nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"

data <- teal_data()
data <- within(data, {
IRIS <- iris
library(dplyr)

IRIS <- iris %>%
mutate(
Species1 = Species,
Species2 = Species,
Species3 = Species,
Species4 = Species,
Species5 = Species
)
MTCARS <- mtcars
})

app <- init(
data = data,
filter = teal_slices(
teal_slice(dataname = "IRIS", varname = "Species", multiple = FALSE)
filters <- teal_slices(
teal_slice(dataname = "MTCARS", varname = "gear", multiple = FALSE),
teal_slice(dataname = "IRIS", varname = "Species"),
teal_slice(dataname = "IRIS", varname = "Sepal.Length"),
teal_slice(
dataname = "IRIS", varname = "Species3",
fixed = TRUE, anchored = FALSE
),
modules = modules(example_module()),
title = build_app_title("Basic Teal Demo App", nest_logo),
header = tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span(
style = "font-size: 30px;",
"My first teal app"
),
tags$span(
style = "display: flex; align-items: center;",
tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"),
tags$span(style = "font-size: 24px;", "NEST @ Roche")
)
teal_slice(
dataname = "IRIS", varname = "Species4",
fixed = FALSE, anchored = TRUE, multiple = TRUE
),
footer = tags$p(
actionLink("showAboutModal", "About,"),
tags$a(
href = "https://github.com/insightsengineering/teal.gallery/tree/main/basic-teal",
target = "_blank",
"Source Code,"
),
tags$a(
href = "https://github.com/insightsengineering/teal.gallery/issues",
target = "_blank",
"Report Issues"
)
teal_slice(
dataname = "IRIS", varname = "Species5",
fixed = TRUE, anchored = TRUE
),
teal_slice(
dataname = "IRIS", id = "custom_expr", title = "Custom Expression",
expr = "Sepal.Width > 2.5 & Petal.Length > 1.5",
)
)

body(app$server)[[length(body(app$server)) + 1]] <- quote(
observeEvent(input$showAboutModal, {
showModal(modalDialog(
tags$p(
"This teal app is brought to you by the NEST Team at Roche/Genentech.
For more information, please visit:"
),
tags$ul(
tags$li(tags$a(
href = "https://github.com/insightsengineering", "Insights Engineering",
target = "blank"
)),
tags$li(tags$a(
href = "https://pharmaverse.org", "Pharmaverse",
target = "blank"
))
),
easyClose = TRUE
))
})
nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"
app_source <- "https://github.com/insightsengineering/teal.gallery/tree/main/basic-teal"
gh_issues_page <- "https://github.com/insightsengineering/teal.gallery/issues"

header <- tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span("My first teal app", style = "font-size: 30px;"),
tags$span(
style = "display: flex; align-items: center;",
tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"),
tags$span(style = "font-size: 24px;", "NEST @ Roche")
)
)

footer <- tags$p(
"This teal app is brought to you by the NEST Team at Roche/Genentech.
For more information, please visit:",
tags$a(href = app_source, target = "_blank", "Source Code"), ", ",
tags$a(href = gh_issues_page, target = "_blank", "Report Issues")
)

app <- init(
data = data,
filter = filters,
modules = modules(example_module()),
title = build_app_title("Basic Teal Demo App", nest_logo),
header = header,
footer = footer
)

shinyApp(app$ui, app$server)
77 changes: 25 additions & 52 deletions early-dev/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ library(teal.modules.general)
library(teal.osprey)
options(shiny.useragg = FALSE)

nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"

## Data reproducible code ----
data <- teal_data()
data <- within(data, {
Expand Down Expand Up @@ -216,9 +214,34 @@ cs_paramcd_tr <- choices_selected(
selected = "SLDINV"
)

## App header and footer ----
nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"
app_source <- "https://github.com/insightsengineering/teal.gallery/tree/main/early-dev"
gh_issues_page <- "https://github.com/insightsengineering/teal.gallery/issues"

header <- tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span("My first teal app", style = "font-size: 30px;"),
tags$span(
style = "display: flex; align-items: center;",
tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"),
tags$span(style = "font-size: 24px;", "NEST @ Roche")
)
)

footer <- tags$p(
"This teal app is brought to you by the NEST Team at Roche/Genentech.
For more information, please visit:",
tags$a(href = app_source, target = "_blank", "Source Code"), ", ",
tags$a(href = gh_issues_page, target = "_blank", "Report Issues")
)

## Setup App
app <- init(
data = data,
title = build_app_title("Early Development Analysis Teal Demo App", nest_logo),
header = header,
footer = footer,
filter = teal_slices(
count_type = "all",
teal_slice(dataname = "ADSL", varname = "SAFFL", selected = "Y"),
Expand Down Expand Up @@ -420,58 +443,8 @@ app <- init(
x_limit = "-28, 750",
plot_height = c(1200, 400, 5000)
)
),
title = build_app_title("Early Development Analysis Teal Demo App", nest_logo),
header = tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span(
style = "font-size: 30px;",
"Example teal app focusing on analysis of early-phase clinical trial data with teal.osprey"
),
tags$span(
style = "display: flex; align-items: center;",
tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"),
tags$span(style = "font-size: 24px;", "NEST @ Roche")
)
),
footer = tags$p(
actionLink("showAboutModal", "About,"),
tags$a(
href = "https://github.com/insightsengineering/teal.gallery/tree/main/early-dev",
target = "_blank",
"Source Code,"
),
tags$a(
href = "https://github.com/insightsengineering/teal.gallery/issues",
target = "_blank",
"Report Issues"
)
)
)


body(app$server)[[length(body(app$server)) + 1]] <- quote(
observeEvent(input$showAboutModal, {
showModal(modalDialog(
tags$p(
"This teal app is brought to you by the NEST Team at Roche/Genentech.
For more information, please visit:"
),
tags$ul(
tags$li(tags$a(
href = "https://github.com/insightsengineering", "Insights Engineering",
target = "blank"
)),
tags$li(tags$a(
href = "https://pharmaverse.org", "Pharmaverse",
target = "blank"
))
),
easyClose = TRUE
))
})
)


## Start Teal Shiny App ----
shinyApp(app$ui, app$server)
Loading
Loading