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

Dev 202403 #12

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
898d5ab
Fix typo in title
timbrock Feb 8, 2024
d38a270
Merge pull request #67 from jumpingrivers/fix-title
russHyde Mar 14, 2024
93d8657
chore: bump lint GHA workflow
russHyde Mar 14, 2024
3f94091
chore: bump R CMD check workflow
russHyde Mar 14, 2024
1db2abe
env: bump renv definition to include Bioc 3.18 (because we couldn't i…
russHyde Mar 14, 2024
3b81763
fix renv activate script for renv >=v1
russHyde Mar 14, 2024
f19dae2
refac: use {styler} to fix some indentation lints
russHyde Mar 14, 2024
5fca50c
refac: fix some undesirable op lints
russHyde Mar 14, 2024
d4f2232
chore: bump roxygen2 version
russHyde Mar 14, 2024
61dc14c
refac: style the code that imports the about.md page
russHyde Mar 14, 2024
f5267d1
feat: add 'About' page text based on Kieran's word document
russHyde Mar 14, 2024
1966165
Merge pull request #69 from jumpingrivers/about-page
timbrock Mar 18, 2024
bd18837
refac: extract function for cluster-stats UI
russHyde Feb 23, 2024
7e0b3fa
refac: separate content for cluster-stats from details/summary
russHyde Feb 23, 2024
c174ad9
bump to bootstrap v5
russHyde Feb 23, 2024
7e75760
add help icon alongside details/summary for cluster-statistics
russHyde Feb 23, 2024
67ed1a0
feat: add help text to help icon for 'Cluster Statistics' panel
russHyde Mar 15, 2024
6f2542d
feat: add a help icon inside the cluster-statistics accordion summary
russHyde Mar 19, 2024
50f872d
add margin/padding around accordion (using the values for the outdate…
russHyde Mar 21, 2024
e0172f5
increase help-icon size from 1em to 1.5em
russHyde Mar 21, 2024
a9dc079
namespace some shiny functions
russHyde Mar 21, 2024
36d45fc
env: add bsicons to DESCRIPTION
russHyde Mar 21, 2024
a62e560
Merge pull request #71 from jumpingrivers/cluster-stats-help
russHyde Apr 16, 2024
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
29 changes: 0 additions & 29 deletions .github/workflows/R-CMD-check.yaml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
4 changes: 3 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -28,3 +28,5 @@ jobs:
- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ License: MIT + file LICENSE
Depends:
R (>= 4.0.0)
Imports:
bsicons,
bslib,
data.table,
dplyr,
Expand Down Expand Up @@ -36,4 +37,4 @@ Suggests:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
43 changes: 24 additions & 19 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,34 @@ app_server = function(input, output, session) {
shiny::bindCache(input$widgetChoice)


# Mutation colouring ------------------------------------------------------
# Mutation colouring ------------------------------------------------------

# disable dropdown unless mutation treeview
shiny::observe({
choice = ifelse(input$widgetChoice != "", input$widgetChoice, "")
# toggle mutation dropdown
shinyjs::toggleElement(id = "mutationChoice",
condition = choice == "tree-mutations.rds")
shinyjs::toggleElement(
id = "mutationChoice",
condition = choice == "tree-mutations.rds"
)
# toggle sequence dropdown
shinyjs::toggleElement(id = "sequenceChoice",
condition = choice == "tree-sequences.rds")
shinyjs::toggleElement(
id = "sequenceChoice",
condition = choice == "tree-sequences.rds"
)
# select input for sequences
if (choice == "tree-sequences.rds") {
avail_seqs = data.table::as.data.table(available_sequences(data_dir))
names(avail_seqs) = "Sequences"
shiny::updateSelectInput(inputId = "sequenceChoice",
choices = avail_seqs
)
shiny::updateSelectInput(
inputId = "sequenceChoice",
choices = avail_seqs
)
}
})

# get selected nodes from mutation choice
shiny::observeEvent(input$mutationChoice, {

nodeChoice = selected_mut_nodes(input$mutationChoice, data_dir)

# the 'node' column contains integers that define the IDs for graph-nodes in the htmlwidget
Expand All @@ -124,11 +128,10 @@ app_server = function(input, output, session) {
)
})

# Sequence colouring ------------------------------------------------------
# Sequence colouring ------------------------------------------------------

# get selected nodes from sequence choice
shiny::observeEvent(input$sequenceChoice, {

nodeChoice = selected_seq_nodes(input$sequenceChoice, data_dir)

# the 'node' column contains integers that define the IDs for graph-nodes in the htmlwidget
Expand All @@ -146,15 +149,17 @@ app_server = function(input, output, session) {
)
})

# Get click ---------------------------------------------------------------
# Get click ---------------------------------------------------------------

# get selected cluster id based on widget choice
selected_cluster_id = shiny::reactive({
shiny::req(input$widgetChoice)
shiny::req(input$treeview_selected)
get_selected_cluster_id(widgetChoice = input$widgetChoice,
treeviewSelected = utils::tail(input$treeview_selected, 1),
data_dir = data_dir)
get_selected_cluster_id(
widgetChoice = input$widgetChoice,
treeviewSelected = utils::tail(input$treeview_selected, 1),
data_dir = data_dir
)
}) %>%
shiny::bindCache(input$widgetChoice, input$treeview_selected)

Expand All @@ -169,9 +174,10 @@ app_server = function(input, output, session) {
shiny::req(input$widgetChoice)
fname = stringr::str_replace(input$widgetChoice, ".rds", ".md")
shiny::includeMarkdown(system.file("app", "www", "content", "treeview",
fname,
package = "tfpbrowser",
mustWork = TRUE))
fname,
package = "tfpbrowser",
mustWork = TRUE
))
})

# Tables Tab --------------------------------------------------------------
Expand All @@ -194,5 +200,4 @@ app_server = function(input, output, session) {
cluster_choice = selected_cluster_id,
data_dir = data_dir
)

} # end server function
142 changes: 60 additions & 82 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,103 +3,83 @@
#' @param request Internal parameter for `{shiny}`.
#' @noRd
app_ui = function(request) {
data_dir <- get_data_dir()
data_dir = get_data_dir()

shiny::tagList(

shinyjs::useShinyjs(),
shinybrowser::detect(),

shiny::navbarPage(
# title
title = place_title_logo(),

header = add_ext_resources(data_dir),
# theme
theme = bslib::bs_theme(version = 4,
bootswatch = "minty",
bg = "#EBEEEE",
fg = "#002147",
primary = "#003E74",
secondary = "#9D9D9D"),
theme = bslib::bs_theme(
version = 5,
bootswatch = "minty",
bg = "#EBEEEE",
fg = "#002147",
primary = "#003E74",
secondary = "#9D9D9D"
),

# Input widgets
shiny::tabPanel(
title = "Data",

shiny::fluidRow(
shiny::column(12,
# use details and summary to create expandable section
htmltools::tags$details(
# preview of expandable section
htmltools::tags$summary("Cluster statistics (click to expand)"),

shiny::br(),

# text to print choice
shiny::textOutput("select_text"),
shiny::br(),

# output options
shiny::tabsetPanel(id = "plot_tabs",

# Tables tab
tablesUI("table1"),

# Plots tab
plotsUI("plot1"),

# RDS tab
rdsUI("rds1")

)
)
)
shiny::column(12, clusterStatsUI(id = NULL))
), # end fluid row

# Bottom row - show tree (static html output from tfpscanner)
shiny::fluidRow(
shiny::column(12,
id="view-container",
shiny::div(id="view-selection",
htmltools::tags$details(
id="sidebar-toggle",
open="open",
`aria-role`="button",
`aria-label`="Toggle sidebar visibility",
htmltools::tags$summary(
shiny::span(">>"),
shiny::span("<<")
)
),
# choose type of treeview
shiny::selectInput(inputId = "widgetChoice",
label = "View",
choices = c("None" = ""),
selectize = FALSE),

# choose type of mutation
shiny::selectInput(inputId = "mutationChoice",
label = "Mutation",
choices = character(0),
selectize = FALSE),

# choose type of sequence
shiny::selectInput(inputId = "sequenceChoice",
label = "Sequence",
choices = NULL,
selectize = FALSE),
id = "view-container",
shiny::div(
id = "view-selection",
htmltools::tags$details(
id = "sidebar-toggle",
open = "open",
`aria-role` = "button",
`aria-label` = "Toggle sidebar visibility",
htmltools::tags$summary(
shiny::span(">>"),
shiny::span("<<")
)
),
# choose type of treeview
shiny::selectInput(
inputId = "widgetChoice",
label = "View",
choices = c("None" = ""),
selectize = FALSE
),

# choose type of mutation
shiny::selectInput(
inputId = "mutationChoice",
label = "Mutation",
choices = character(0),
selectize = FALSE
),

# choose type of sequence
shiny::selectInput(
inputId = "sequenceChoice",
label = "Sequence",
choices = NULL,
selectize = FALSE
),
),
shiny::div(id="view-graphic",
# markdown files to add description
shiny::uiOutput("tree_md_files"),

# show treeview widget
shiny::wellPanel(
ggiraph::girafeOutput("treeview"),
style = "background: white; height: 1800px;",
),
shiny::br()
shiny::div(
id = "view-graphic",
# markdown files to add description
shiny::uiOutput("tree_md_files"),

# show treeview widget
shiny::wellPanel(
ggiraph::girafeOutput("treeview"),
style = "background: white; height: 1800px;",
),
shiny::br()
)
)
) # end fluid row
Expand All @@ -108,12 +88,10 @@ app_ui = function(request) {
# about page
shiny::tabPanel(
title = "About",
shiny::includeMarkdown(system.file("app", "www", "content", "about.md",
package = "tfpbrowser",
mustWork = TRUE))
shiny::includeMarkdown(
system.file("app", "www", "content", "about.md", package = "tfpbrowser", mustWork = TRUE)
)
)

) # end navbar page
) # end tag list

}
2 changes: 1 addition & 1 deletion R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#'
#' @return Scalar string. The data-directory for use in the app.

get_data_dir <- function() {
get_data_dir = function() {
Sys.getenv(
"APP_DATA_DIR",
system.file("app", "www", "data", package = "tfpbrowser")
Expand Down
Loading