From 7f57d8b63e5b8d217689b2faeab3a25836a9565e Mon Sep 17 00:00:00 2001 From: u061745 Date: Wed, 17 Apr 2024 14:43:20 +0100 Subject: [PATCH] Changed S7::`@` to S7::prop. --- R/get_analytes.R | 2 +- R/get_curve_data.R | 2 +- R/get_expected.R | 2 +- R/get_metadata.R | 2 +- R/get_recovery.R | 2 +- R/get_recovery_avg.R | 2 +- R/get_summary_data.R | 2 +- R/get_well_data.R | 2 +- R/plot_curves.R | 6 +++--- R/update_curve_data.R | 1 + man/update_curve_data.Rd | 2 +- scratch/workflow example.r | 28 ++++++++++++++++++++++++++++ 12 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 scratch/workflow example.r diff --git a/R/get_analytes.R b/R/get_analytes.R index 99f3e46..d54cf23 100644 --- a/R/get_analytes.R +++ b/R/get_analytes.R @@ -10,5 +10,5 @@ #' @examples #' 1+1 get_analytes <- function(.intelliframe) { - S7::`@`(.intelliframe, "analytes") + S7::prop(.intelliframe, "analytes") } diff --git a/R/get_curve_data.R b/R/get_curve_data.R index d90ca46..90795f2 100644 --- a/R/get_curve_data.R +++ b/R/get_curve_data.R @@ -10,6 +10,6 @@ #' @examples #' 1+1 get_curve_data <- function(.intelliframe) { - S7::`@`(.intelliframe, "curve_data") + S7::prop(.intelliframe, "curve_data") } diff --git a/R/get_expected.R b/R/get_expected.R index ac40f06..54ab519 100644 --- a/R/get_expected.R +++ b/R/get_expected.R @@ -10,5 +10,5 @@ #' @examples #' 1+1 get_expected <- function(.intelliframe) { - S7::`@`(.intelliframe, "expected") + S7::prop(.intelliframe, "expected") } diff --git a/R/get_metadata.R b/R/get_metadata.R index 135db87..ab5ab00 100644 --- a/R/get_metadata.R +++ b/R/get_metadata.R @@ -10,5 +10,5 @@ #' @examples #' 1+1 get_metadata <- function(.intelliframe) { - S7::`@`(.intelliframe, "metadata") + S7::prop(.intelliframe, "metadata") } diff --git a/R/get_recovery.R b/R/get_recovery.R index 6e1def8..4198516 100644 --- a/R/get_recovery.R +++ b/R/get_recovery.R @@ -10,5 +10,5 @@ #' @examples #' 1+1 get_recovery <- function(.intelliframe) { - S7::`@`(.intelliframe, "recovery") + S7::prop(.intelliframe, "recovery") } diff --git a/R/get_recovery_avg.R b/R/get_recovery_avg.R index 60dd84b..e8975d9 100644 --- a/R/get_recovery_avg.R +++ b/R/get_recovery_avg.R @@ -10,6 +10,6 @@ #' @examples #' 1+1 get_recovery_avg <- function(.intelliframe) { - S7::`@`(.intelliframe, "recovery_avg") + S7::prop(.intelliframe, "recovery_avg") } diff --git a/R/get_summary_data.R b/R/get_summary_data.R index a4395b4..cacaf71 100644 --- a/R/get_summary_data.R +++ b/R/get_summary_data.R @@ -10,5 +10,5 @@ #' @examples #' 1+1 get_summary_data <- function(.intelliframe) { - S7::`@`(.intelliframe, "summary_data") + S7::prop(.intelliframe, "summary_data") } diff --git a/R/get_well_data.R b/R/get_well_data.R index 48128a8..0ed34bc 100644 --- a/R/get_well_data.R +++ b/R/get_well_data.R @@ -10,5 +10,5 @@ #' @examples #' 1+1 get_well_data <- function(.intelliframe) { - S7::`@`(.intelliframe, "well_data") + S7::prop(.intelliframe, "well_data") } diff --git a/R/plot_curves.R b/R/plot_curves.R index 75af336..ce756d3 100644 --- a/R/plot_curves.R +++ b/R/plot_curves.R @@ -27,9 +27,9 @@ plot_curves <- function(.intelliframe, analytes = NULL, type = "individual", int stopifnot("data argument must be an intelliframe object" = S7::S7_inherits(.intelliframe, intelliframe)) if(type == "individual") { - dat <- S7::`@`(.intelliframe, "well_data") + dat <- S7::prop(.intelliframe, "well_data") } else if(type == "summary") { - dat <- S7::`@`(.intelliframe, "summary_data") |> + dat <- S7::prop(.intelliframe, "summary_data") |> dplyr::rename("MFI" = "MFI_Avg", "Result" = "Result_Avg") } else stop(paste0('Argument type should be "individual" or "summary", not "', type, '".')) @@ -42,7 +42,7 @@ plot_curves <- function(.intelliframe, analytes = NULL, type = "individual", int experimental_data <- dplyr::filter(dat, .data[["Type"]] != "Standard") |> dplyr::arrange(dplyr::desc(.data[["Type"]])) - curve_data <- S7::`@`(.intelliframe, "curve_data") + curve_data <- S7::prop(.intelliframe, "curve_data") if(!is.null(analytes)) { curve_data <- dplyr::filter(curve_data, .data[["Analyte"]] %in% analytes) diff --git a/R/update_curve_data.R b/R/update_curve_data.R index 16856d3..590474f 100644 --- a/R/update_curve_data.R +++ b/R/update_curve_data.R @@ -103,6 +103,7 @@ new_curve_data <- lapply(names(.fits), function(x) { }) |> dplyr::bind_rows() if(!.silent) { + message() warning( "LLoQ, MDD, and LoD may be calculated differently than in Belysa. See ?refit_curves for details.", call. = FALSE diff --git a/man/update_curve_data.Rd b/man/update_curve_data.Rd index 7373f2e..6c0481f 100644 --- a/man/update_curve_data.Rd +++ b/man/update_curve_data.Rd @@ -7,7 +7,7 @@ update_curve_data(.summary_data, .well_data, .fits, .silent) } \arguments{ -\item{.summary_data}{A tibble containing the curve_data property.} +\item{.summary_data}{A tibble containing the summary_data property.} \item{.well_data}{A tibble containing the well_data property.} diff --git a/scratch/workflow example.r b/scratch/workflow example.r new file mode 100644 index 0000000..f3bf43f --- /dev/null +++ b/scratch/workflow example.r @@ -0,0 +1,28 @@ +# load package +# library(luminary) + +# load example dataset +data(u5plex) + +# display object +u5plex + +# extract elements +get_well_data(u5plex) |> View() +get_summary_data(u5plex) |> View() +get_analytes(u5plex) |> View() +get_metadata(u5plex) |> View() +get_curve_data(u5plex) |> View() + +# plot curves +plot_curves(u5plex) +plot_curves(u5plex, facet_scales = "free") +plot_curves( + u5plex, + interactive = TRUE, + rug = FALSE, + analytes = c("AFM", "EPCR") +) + +# refit curves +refit_u5plex <- refit_curves(u5plex)