Skip to content

Commit

Permalink
v0.2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
stevechoy committed Dec 5, 2024
1 parent a864e88 commit b00a009
Show file tree
Hide file tree
Showing 136 changed files with 547 additions and 269 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MVPapp
Title: Model Visualization Platform
Version: 0.2.10
Version: 0.2.11
Authors@R: c(
person("Steve", "Choy", email = "[email protected]", role = c("aut", "cre")),
person("Jin Gyu", "Kim", role = "aut"))
Expand Down Expand Up @@ -51,9 +51,9 @@ Suggests: readr,
Depends: R (>= 3.5.0)
LazyData: true
Collate: "utils-pipe.R"
"ui_settings_v_0_2_10.R"
"ui_settings_v_0_2_11.R"
"code_templates_v_0_2_10.R"
"functions_v_0_2_10.R"
"functions_v_0_2_11.R"
"config.R"
"run_mvp.R"
"data.R"
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export(bspop_do_sim_plotly)
export(bspop_dose)
export(bspop_dose_value)
export(bspop_download_cpp_model)
export(bspop_download_plot)
export(bspop_dp_checkbox)
export(bspop_generate_model)
export(bspop_infdur)
Expand All @@ -63,6 +64,7 @@ export(bspop_password_github)
export(bspop_percentiles)
export(bspop_plotly_file_name_label)
export(bspop_plotly_width_height)
export(bspop_plotly_width_height_corr)
export(bspop_rate)
export(bspop_scale_x_axis)
export(bspop_seed)
Expand Down
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# MVPapp 0.2.11 (2024-12-04)

## Features

* Support for uploading tab-delimited .txt files on Data Upload, with the option to automatically create ID column. (#9)
* Uses dose column instead of manually entering dose amount for NCA.
* Download Options now support non-interactive plots, with a dedicated "Download Non-Interactive Plot" button. (#11)

## Bugfixes

* NCA Clearance unit corrected to be based on the supplied time unit.
* Linear regression is center aligned for ggplots (#10)

# MVPapp 0.2.10 (2024-11-28)

## Features
Expand Down
37 changes: 30 additions & 7 deletions R/functions_v_0_2_10.R → R/functions_v_0_2_11.R
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ log10_axis_label[seq(1, length(logbreaks_y_minor), 9)] <- as.character(logbreaks
#' @param plot_title Optional plot title
#' @param label_size font size for geom_text labels (N=x for boxplots or linear regressions)
#' @param discrete_threshold Draws geom_count if there are <= this number of unique Y-values
#' @param boxplot_x_threshold Throws an error when the unique values of x-axis exceeds this number
#' @param error_text_color error text color for element text
#' @param debug show debugging messages
#'
#' @returns a ggplot object
Expand Down Expand Up @@ -248,6 +250,8 @@ do_data_page_plot <- function(nmd,
plot_title,
label_size = 3,
discrete_threshold = 5,
boxplot_x_threshold = 20,
error_text_color = "#F8766D",
debug = FALSE) {
if(debug) {
message(paste0("Creating data_page_plot"))
Expand All @@ -268,6 +272,13 @@ do_data_page_plot <- function(nmd,
}

if(boxplot) {
if(length(unique(nmd[[x_axis]])) > boxplot_x_threshold) {
a <- ggplot2::ggplot() +
ggplot2::labs(title = paste0('ERROR: There are too many X-axis categories (>', boxplot_x_threshold, ') for boxplots.')) +
ggplot2::theme(panel.background = ggplot2::element_blank(),
plot.title = ggplot2::element_text(color = error_text_color))
return(a)
}
nmd[[x_axis]] <- as.factor(nmd[[x_axis]])

if(is.character(nmd[[y_axis]]) || length(unique(nmd[[y_axis]])) <= discrete_threshold ) { # ... or if there are <= discrete_threshold unique values of y-axis
Expand Down Expand Up @@ -321,12 +332,20 @@ do_data_page_plot <- function(nmd,

if(treat_y_axis_as_discrete) {
a <- a +
ggplot2::geom_count() + ggplot2::scale_size_area(max_size = 12) +
ggplot2::geom_text(data = df_count, aes(x = .data[[x_axis]], y = .data[[y_axis]], label = paste0(n), size = n, group = NULL), color = "black", vjust = 2, size = label_size)
ggplot2::geom_count() + ggplot2::scale_size_area(max_size = 12)

if(label_size > 0) {
a <- a +
ggplot2::geom_text(data = df_count, aes(x = .data[[x_axis]], y = .data[[y_axis]], label = paste0(n), size = n, group = NULL), color = "black", vjust = 2, size = label_size)
}

} else {
a <- a +
ggplot2::geom_boxplot(varwidth = TRUE) +
ggplot2::geom_text(data = df_count, aes(x = .data[[x_axis]], y = max(nmd[[y_axis]]) * 1.02, label = paste0("N=", n), group = NULL), color = "black", vjust = 2, size = label_size)
ggplot2::geom_boxplot(varwidth = TRUE)
if(label_size > 0) {
a <- a +
ggplot2::geom_text(data = df_count, aes(x = .data[[x_axis]], y = max(nmd[[y_axis]]) * 1.02, label = paste0("N=", n), group = NULL), color = "black", vjust = 2, size = label_size)
}
}

} else { # end of boxplot check
Expand Down Expand Up @@ -374,8 +393,10 @@ do_data_page_plot <- function(nmd,
max_y <- max(data$y, na.rm = TRUE)

a <- a + ggplot2::stat_smooth(ggplot2::aes(group = NULL), method = "lm", formula = y ~ x, se = FALSE, colour = "grey", show.legend = FALSE)
a <- a + ggplot2::geom_text(data = df_stats, aes(label = label, x = med_x, y = max_y, group = NULL, color = NULL),
hjust = 0, vjust = 1, show.legend = FALSE, size = label_size)
if(label_size > 0) {
a <- a + ggplot2::geom_text(data = df_stats, aes(label = label, x = med_x, y = max_y, group = NULL, color = NULL),
hjust = 0.5, vjust = 1, show.legend = FALSE, size = label_size)
}
}

if (facet_name != "") {
Expand Down Expand Up @@ -448,6 +469,7 @@ lowerFn <- function(data, mapping, method = "lm", ...) { ## Plots linear regress
#' @returns a ggplot object
#' @importFrom dplyr distinct select all_of
#' @importFrom GGally ggpairs wrap
#' @importFrom ggplot2 theme_bw
#' @export
#-------------------------------------------------------------------------------

Expand Down Expand Up @@ -485,7 +507,8 @@ draw_correlation_plot <- function(input_df,

corr_plot <- GGally::ggpairs(corr_data_id_trimmed, cardinality_threshold = 30,
mapping = mapping,
lower = list(continuous = GGally::wrap(lowerFn, method = "lm")))
lower = list(continuous = GGally::wrap(lowerFn, method = "lm"))) +
ggplot2::theme_bw()

return(corr_plot)
}
Expand Down
16 changes: 10 additions & 6 deletions R/ui_settings_v_0_2_10.R → R/ui_settings_v_0_2_11.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bspop_calc_nca <- 'Whenever the above settings are adjusted, a new NCA sh
#' @export
bspop_dose_value <- '(Optional) Provide a dose amount to derive metrics normalized by dose.'
#' @export
bspop_mw_value <- '(Optional) Provide a molecular weight to derive metrics related to Clearance and Volume.'
bspop_mw_value <- '(Optional) Provide a molecular weight to derive metrics related to Clearance and Volume (assumed to be in L).'

## Plotting options
#' @export
Expand Down Expand Up @@ -84,24 +84,26 @@ plot_title_placeholder<- "Insert optional plot title"
#' @export
select_label_size_label<- "Text Label Size"
#' @export
bspop_select_label_size<- "Label sizes are only applicable for linear regression formulae or boxplot counts (N=x)."
bspop_select_label_size<- "Label sizes are only applicable for linear regression formulae or counts (N=x)."

#' @export
add_data_stat_sum <- 'Median line [dataset]'
#' @export
bspop_data_stat_sum <- 'Insert a line connecting median values for grouped observations in equidistant time bins'
bspop_data_stat_sum <- 'Insert a line connecting median values for grouped observations in equidistant time bins for non-boxplots.'
#' @export
boxplot_label <- 'Boxplot'
#' @export
bspop_do_boxplot <- 'Boxplot figure assumes the X-axis variable is categorical, the Y-axis variable is continuous, and counts (N) represents the number of unique IDs i.e. usually the baseline value.<br><br>Turning off interactive plots may achieve better visual results for Boxplots (Color variable is dodged and boxplot widths are proportional to the square-roots of the number of observations in the groups).'
#' @export
bspop_do_data_plotly <- 'Interactive plots using the "plotly" package could take a longer time for big datasets. Turning it off may achieve better visual results for Boxplots. <br><br>Note - "Download Options" do not apply when plots are not interactive.'
bspop_do_data_plotly <- 'Interactive plots using the "plotly" package could take a longer time for big datasets. Turning it off may achieve better visual results for Boxplots.'# <br><br>Note - "Download Options" do not apply when plots are not interactive.'


#' @export
bspop_download_plot <- 'Adjust output settings in the "Download Options" box below.'
#' @export
plotly_filename_label <- "Plot name"
#' @export
bspop_plotly_file_name_label <- 'The plot can be downloaded by hovering over the plot and clicking on the Camera icon.'
bspop_plotly_file_name_label <- 'The plot can be downloaded by hovering over the plot and clicking on the Camera icon (for interactive plots), or by clicking the Download Plot button (for non-interactive plots).'
#' @export
plotly_format_label <- "File format"
#' @export
Expand All @@ -110,6 +112,8 @@ plotly_width_label <- "Width (px)"
plotly_height_label <- "Height (px)"
#' @export
bspop_plotly_width_height <- 'Leave empty to use current dimensions.'
#' @export
bspop_plotly_width_height_corr <- 'Leave empty to use current dimensions.<br><br>Tip: a larger size (e.g. >5000) is recommended if there are more than a few variables.'

## shinyAce placeholder
#' @export
Expand Down Expand Up @@ -247,7 +251,7 @@ show_model_1_label <- "Show Model 1 (red)"
#' @export
show_model_2_label <- "Show Model 2 (blue)"
#' @export
bspop_do_sim_plotly <- 'Interactive plots using the "plotly" package could take a long time for simulations with lots of data (e.g. from overlaying datasets).<br><br>Note - "Download Options" do not apply when plots are not interactive.'
bspop_do_sim_plotly <- 'Interactive plots using the "plotly" package could take a long time for simulations with lots of data (e.g. from overlaying datasets).' #<br><br>Note - "Download Options" do not apply when plots are not interactive.'


#' @export
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ This is the default landing page when the App is launched. It looks a bit empty
![Camera icon from the plotly toolbar](www/plotlytoolbar.png)


### Uploading NONMEM Datasets and Data Exploration
### Uploading Datasets and Data Exploration

Uploading NONMEM-formatted datasets is supported in the "Data Input" page. Some default cleaning options are applied automatically from the "Built-in Dataset Cleaning Options" box. Further filtering and cleaning may be applied in the code editor on the left hand side. At minimum, the dataset should have the "ID", "TIME", and "DV" columns to be fully supported by the rest of the app. If missing, the user may create / rename these columns using the code editor.
Uploading NONMEM-formatted datasets (.csv) and tab-delimited text files (.txt) is supported in the "Data Input" page. Some default cleaning options are applied automatically from the "Built-in Dataset Cleaning Options" box. Further filtering and cleaning may be applied in the code editor on the left hand side. The dataset should have the "ID", "TIME", and "DV" columns to be fully supported by the rest of the app (e.g. data overlay). At minimum, only the "ID" column is required to support Data Exploration in the Data Input page. If missing, the user may create / rename these columns using the code editor.

1. The filtered dataset (i.e. after passing through the code editor) is shown on the right hand side table.
2. Summary statistics of the data per ID is shown on the second sub tab on the top right hand side.
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,16 @@ alt="Camera icon from the plotly toolbar" />
toolbar</figcaption>
</figure>

### Uploading NONMEM Datasets and Data Exploration

Uploading NONMEM-formatted datasets is supported in the “Data Input”
page. Some default cleaning options are applied automatically from the
“Built-in Dataset Cleaning Options” box. Further filtering and cleaning
may be applied in the code editor on the left hand side. At minimum, the
dataset should have the “ID”, “TIME”, and “DV” columns to be fully
supported by the rest of the app. If missing, the user may create /
### Uploading Datasets and Data Exploration

Uploading NONMEM-formatted datasets (.csv) and tab-delimited text files
(.txt) is supported in the “Data Input” page. Some default cleaning
options are applied automatically from the “Built-in Dataset Cleaning
Options” box. Further filtering and cleaning may be applied in the code
editor on the left hand side. The dataset should have the “ID”, “TIME”,
and “DV” columns to be fully supported by the rest of the app (e.g. data
overlay). At minimum, only the “ID” column is required to support Data
Exploration in the Data Input page. If missing, the user may create /
rename these columns using the code editor.

1. The filtered dataset (i.e. after passing through the code editor) is
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/supply-passwords.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b00a009

Please sign in to comment.