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

All features 202403 #14

Open
wants to merge 69 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 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
26b1884
env: bump the version of {renv}
russHyde Apr 16, 2024
78d5e7a
env: add {bsicons} to renv.lock
russHyde Apr 16, 2024
c3dc4a2
fix: get_data_dir() should return fully-specified path for data direc…
russHyde Apr 16, 2024
34151f4
[TEMP] use renv::use() to specify env for creating browser data
russHyde Mar 12, 2024
4dfdd56
update version of tfpscanner used in browser-data script
russHyde Apr 16, 2024
b0460c4
configure / run create_browser_data() in browser-data script
russHyde Apr 16, 2024
a47a47a
browser-data script outputs a message on how to use the new browser-d…
russHyde Apr 19, 2024
ce391af
comment-wash the create_browser_data script
russHyde Apr 19, 2024
938a71e
fix: normalisePath -> normalizePath
russHyde Apr 19, 2024
7cc51b6
temp
russHyde Apr 19, 2024
621352d
define {svglite} in the env for create_browser_data()
russHyde Apr 19, 2024
4cc490c
match create-browser env to tfpbrowser env
russHyde Apr 19, 2024
80b1c2a
dynamically match the create-browser env to the renv.lock, for it's r…
russHyde Apr 19, 2024
b3c0884
refac: put user-modified section at start of script
russHyde May 23, 2024
7af7313
ensure repos are defined before the script runs
russHyde May 23, 2024
e91e7c8
ensure renv doesn't use fig-prep script when defining the app environ…
russHyde May 23, 2024
c2cae29
{renv} needn't check the www/data directory
russHyde Jun 13, 2024
f2ead90
use bioconductor 3.16 for R 4.2.x
russHyde Jun 13, 2024
4a90218
env: get ggtree from github, since BioC 3.16 version is incompatible …
russHyde Jun 13, 2024
f342320
env: define renv.lock using BioC 3.16 dependencies (for R 4.2.x)
russHyde Jun 13, 2024
475fa4d
env(helper-script): hard-code the ggtree dev version used by the script
russHyde Jun 13, 2024
984a523
env: add {markdown} to dependencies - needed when importing .rds file…
russHyde Aug 8, 2024
66bb233
doc: installing/cloning tfpbrowser code
russHyde Aug 15, 2024
8598fd8
doc: activating the app's package environment
russHyde Aug 15, 2024
f89f93a
doc: creating and configuring a data directory for tfpbrowser
russHyde Sep 3, 2024
eaeb8f8
env: fix conflict between DESCRIPTION and renv re ggtree version
russHyde Sep 10, 2024
c2c3a64
env: infrastructure for building vignettes
russHyde Sep 10, 2024
83eb109
doc: vignette explaining deployment workflow
russHyde Sep 10, 2024
0e4a785
add app.R so that the app can be deployed to shinyapps.io
russHyde Sep 10, 2024
c8f9f9e
env: use bioconductor 3.16
russHyde Sep 10, 2024
5d617b8
doc: alternative deployment method using RStudio 'Publish' button
russHyde Sep 10, 2024
daa1d64
doc: store data for deployment outside of inst/ in deployment workflo…
russHyde Sep 10, 2024
50435c3
git: ignore dir for built vignettes & their index
russHyde Sep 12, 2024
3ee4517
doc: readme points to deploy vignette for deployment info
russHyde Sep 12, 2024
1c4e2d7
fix lint in vignette
russHyde Sep 12, 2024
a3f1026
fix path in vignette
russHyde Sep 12, 2024
b0710b7
env(create_browser_data): explicitly install rmarkdown
russHyde Oct 15, 2024
c0a9cba
env(create_browser_data): ensure packages are installed without lockf…
russHyde Oct 15, 2024
65dac85
doc: how to get MPI/Rmpi installed on a Windows machine (for use in c…
russHyde Oct 15, 2024
7a08565
refac: move creation of interactive ggiraph graphics into a function
russHyde Mar 11, 2024
9a66a6f
refac: reduce some duplicated code for setting girafe options
russHyde Mar 11, 2024
3bd7e61
feat: scatterplots are less tall than dendrograms
russHyde Mar 14, 2024
c5d41db
env: roll-back {promises} so we can install it on Kieran's computer
russHyde Oct 18, 2024
4581cc4
ensure library for create_browser_data goes into a tempdir
russHyde Oct 18, 2024
bc3f17a
create-browser-data: use tfpscanner version that has correct default …
russHyde Oct 25, 2024
f64a32a
fix: use server-side selectize for mut/seq selection; allows thousand…
russHyde Nov 8, 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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
^\.github$
^LICENSE\.md$
_\.new\.png$
^doc$
^Meta$
9 changes: 9 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
source("renv/activate.R")

options("repos" = c(
"BioCsoft" = "https://bioconductor.org/packages/3.16/bioc",
"BioCann" = "https://bioconductor.org/packages/3.16/data/annotation",
"BioCexp" = "https://bioconductor.org/packages/3.16/data/experiment",
"BioCworkflows" = "https://bioconductor.org/packages/3.16/workflows",
"BioCbooks" = "https://bioconductor.org/packages/3.16/books",
"CRAN" = "https://cloud.r-project.org"
))
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ po/*~

# RStudio Connect folder
rsconnect/
inst/doc
/doc/
/Meta/
2 changes: 2 additions & 0 deletions .renvignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scripts/create_browser_data.R
inst/app/www/data/
11 changes: 9 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ License: MIT + file LICENSE
Depends:
R (>= 4.0.0)
Imports:
bsicons,
bslib,
data.table,
dplyr,
fs,
ggiraph (>= 0.8.4),
ggplot2,
ggtree,
glue,
htmltools,
janitor,
magrittr,
markdown,
purrr,
reactable,
readr,
Expand All @@ -29,11 +32,15 @@ Imports:
stringr,
tibble
Suggests:
ggtree,
knitr,
rmarkdown,
shinytest2,
testthat,
usethis
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Remotes:
YuLab-SMU/ggtree@daf3371
VignetteBuilder: knitr
107 changes: 43 additions & 64 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ app_server = function(input, output, session) {

shiny::observe({
mutation_set = available_mutations(data_dir = data_dir)
shiny::updateSelectInput(
shiny::updateSelectizeInput(
session = session,
inputId = "mutationChoice",
choices = mutation_set
choices = mutation_set,
server = TRUE
)
})

Expand All @@ -36,77 +37,54 @@ app_server = function(input, output, session) {
# create ggiraph output from saved ggplot2 outputs
output$treeview = ggiraph::renderGirafe({
shiny::req(input$widgetChoice)
# define tooltip
tooltip_css = paste0(
"background-color:black;",
"color:grey;",
"padding:14px;",
"border-radius:8px;",
"font-family:\"Courier New\",monospace;"
)
# set options
if (input$widgetChoice == "tree-mutations.rds") {
girafe_options = list(
ggiraph::opts_selection(css = "fill:red;"),
ggiraph::opts_selection_inv(css = "fill:grey;"),
ggiraph::opts_sizing(rescale = FALSE),
ggiraph::opts_zoom(max = 5),
ggiraph::opts_tooltip(
css = tooltip_css,
use_fill = FALSE
)
)

# set the relative height/width of the ggiraph-based graphs
is_dendrogram = grepl("^tree-", x = input$widgetChoice)
width = shinybrowser::get_width() / 72
height = if (is_dendrogram) {
(1800 - 40) / 72
} else {
girafe_options = list(
ggiraph::opts_selection(type = "single"),
ggiraph::opts_sizing(rescale = FALSE),
ggiraph::opts_zoom(max = 5),
ggiraph::opts_tooltip(
css = tooltip_css,
use_fill = FALSE
)
)
(600 - 40) / 72
}
# set size
w = shinybrowser::get_width() / 72
h = (1800 - 40) / 72
# make tree
suppressWarnings(
ggiraph::girafe(
ggobj = imported_ggtree(),
width_svg = w,
height_svg = h,
options = girafe_options
)

create_girafe(
ggobj = imported_ggtree(),
widget_choice = input$widgetChoice,
width_svg = width,
height_svg = height,
suppress_warnings = TRUE
)
}) %>%
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
)
avail_seqs = available_sequences(data_dir)
shiny::updateSelectizeInput(
inputId = "sequenceChoice",
choices = avail_seqs,
server = TRUE
)
}
})

# 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 +102,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 +123,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 +148,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 +174,4 @@ app_server = function(input, output, session) {
cluster_choice = selected_cluster_id,
data_dir = data_dir
)

} # end server function
Loading
Loading