diff --git a/CHANGELOG b/CHANGELOG index 2d10b3bd6e40c51533d7578d2c16d6a70a82399d..e4ec350761cfd4056563507b38926cbc82caacf1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,4 +13,15 @@ To do: - The identity plot's point shape has been modified, enhancing the visual clarity of comparisons between HTRfit and DESeq2 results. - Similar to the identity plot, the dispersion plot also benefits from improved point shape, contributing to a more effective visual analysis. - Add xlab/ylab to ROC plot - - The vignette section now includes a new topic, "About mixed model evaluation". \ No newline at end of file + - The vignette section now includes a new topic, "About mixed model evaluation". + + +# v1.0.2 : R files reorganization, log file enhancement and versioning + + - R files have been restructured to enhance clarity. + - The log file location has been relocated to the R temporary directory. + - A bug that was causing issues with writing the 'group' information in log files during model update has been fixed. + - Fix NOTE "no visible binding for global variable" linked to ggplot2 + - Fix bug with packageVersion("HTRfit") + + diff --git a/NAMESPACE b/NAMESPACE index 97817f4ab418db8446ef1b0909d5ba6011ab3f4d..bd1c8e33dc27762287f9d98187f4add7f2503186 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -162,6 +162,7 @@ importFrom(plotROC,geom_roc) importFrom(reshape2,dcast) importFrom(reshape2,melt) importFrom(rlang,":=") +importFrom(rlang,.data) importFrom(stats,anova) importFrom(stats,as.formula) importFrom(stats,cor) diff --git a/R/evaluate_dispersion.R b/R/evaluate_dispersion.R index a16f96a514fd8ae6760bc4fafadf10627fae5cc2..f0492716a9d82268c69ceafac21688d30fa00195 100644 --- a/R/evaluate_dispersion.R +++ b/R/evaluate_dispersion.R @@ -103,6 +103,7 @@ extract_tmbDispersion <- function(list_tmb) { #' @param eval_dispersion A data frame containing actual and inferred dispersion values. #' @param ... Additional arguments to be passed to the ggplot2::aes function. #' @importFrom ggplot2 ggplot geom_point aes geom_abline theme_bw ggtitle scale_x_log10 scale_y_log10 +#' @importFrom rlang .data #' @return A ggplot2 scatter plot. #' #' @export @@ -117,7 +118,7 @@ dispersion_plot <- function(eval_dispersion, ...) { args <- lapply(list(...), function(x) if (!is.null(x)) ggplot2::sym(x)) p <- ggplot2::ggplot(eval_dispersion) + - ggplot2::geom_point(ggplot2::aes(x = actual_dispersion, y = inferred_dispersion, !!!args), size = 3, alpha = 0.6) + + ggplot2::geom_point(ggplot2::aes(x = .data$actual_dispersion, y = .data$inferred_dispersion, !!!args), size = 3, alpha = 0.6) + ggplot2::geom_abline(intercept = 0, slope = 1, lty = 3, col = 'red', linewidth = 1) + ggplot2::theme_bw() + ggplot2::ggtitle("Dispersion evaluation") + diff --git a/R/identity_plot.R b/R/identity_plot.R index 943704f6db51af8f14986e04d9cb50f6286b4784..01b7ed94388841b495548ac3cf099907d815a3f9 100644 --- a/R/identity_plot.R +++ b/R/identity_plot.R @@ -10,6 +10,7 @@ #' @return A ggplot2 identity plot. #' #' @importFrom ggplot2 sym aes geom_point geom_abline facet_wrap theme_bw ggtitle scale_x_log10 scale_y_log10 +#' @importFrom rlang .data #' @export #' @examples #' comparison_data <- data.frame( @@ -24,7 +25,7 @@ identity_plot <- function(comparison_df, ...){ ggplot2::ggplot(comparison_df) + - ggplot2::geom_point(ggplot2::aes(x = actual, y = estimate, !!!args), alpha = 0.6, size = 2) + + ggplot2::geom_point(ggplot2::aes(x = .data$actual, y = .data$estimate, !!!args), alpha = 0.6, size = 2) + ggplot2::geom_abline(intercept = 0, slope = 1, lty = 3, col = 'red', linewidth = 1) + ggplot2::facet_wrap(~description, scales = "free") + ggplot2::theme_bw() + diff --git a/R/plot_metrics.R b/R/plot_metrics.R index 24fbb45bfc7d06bc87f5724cae3ae9b59b42b841..956e2dedd3e80881493343f02996b2a3d2ed7501 100644 --- a/R/plot_metrics.R +++ b/R/plot_metrics.R @@ -44,7 +44,7 @@ subset_glance <- function(glance_df, focus){ #' #' @importFrom reshape2 melt #' @importFrom ggplot2 aes facet_wrap geom_histogram theme_bw theme ggtitle -#' +#' @importFrom rlang .data #' @export #' #' @examples @@ -59,7 +59,7 @@ metrics_plot <- function(list_tmb, focus = NULL) { } long_glance_df <- reshape2::melt(glance_df, variable.name = "metric") p <- ggplot2::ggplot(long_glance_df) + - ggplot2::geom_histogram(ggplot2::aes(x = value, col = metric, fill = metric)) + + ggplot2::geom_histogram(ggplot2::aes(x = .data$value, col = .data$metric, fill = .data$metric)) + ggplot2::facet_wrap(~metric, scales = "free") + ggplot2::theme_bw() + ggplot2::theme(legend.position = 'null') + diff --git a/R/roc_plot.R b/R/roc_plot.R index 1745b02c525c19df2162389dbfb41c08a1eb0788..2b9e063243992d7a60c517e369f37bba7d00a1ad 100644 --- a/R/roc_plot.R +++ b/R/roc_plot.R @@ -48,7 +48,7 @@ getLabelExpected <- function(comparison_df, coeff_threshold, alt_hypothesis) { #' @return A ggplot object representing the ROC curve plot. #' @importFrom plotROC geom_roc #' @importFrom ggplot2 ggtitle theme_bw aes sym xlab ylab -#' +#' @importFrom rlang .data #' @examples #' comparison_data <- data.frame( #' geneID = c("gene1", "gene2", "gene3"), @@ -72,7 +72,7 @@ roc_plot <- function(comparison_df, ...) { args <- lapply(list(...), function(x) if (!is.null(x)) ggplot2::sym(x)) #comparison_df$isDE <- factor(comparison_df$isDE, levels= c(TRUE, FALSE)) - p <- ggplot2::ggplot(comparison_df, ggplot2::aes(d = !isDE , m = p.adj, !!!args )) + + p <- ggplot2::ggplot(comparison_df, ggplot2::aes(d = !.data$isDE , m = .data$p.adj, !!!args )) + plotROC::geom_roc(n.cuts = 0, labels = FALSE) + ggplot2::theme_bw() + ggplot2::ggtitle("ROC curve") + diff --git a/dev/flat_full.Rmd b/dev/flat_full.Rmd index d634a4984f9c3a37a88321c196bf9979c0b81492..0cd25064ec59cfea270aea87dc56d6531d124c4f 100644 --- a/dev/flat_full.Rmd +++ b/dev/flat_full.Rmd @@ -3763,7 +3763,7 @@ subset_glance <- function(glance_df, focus){ #' #' @importFrom reshape2 melt #' @importFrom ggplot2 aes facet_wrap geom_histogram theme_bw theme ggtitle -#' +#' @importFrom rlang .data #' @export #' #' @examples @@ -3778,7 +3778,7 @@ metrics_plot <- function(list_tmb, focus = NULL) { } long_glance_df <- reshape2::melt(glance_df, variable.name = "metric") p <- ggplot2::ggplot(long_glance_df) + - ggplot2::geom_histogram(ggplot2::aes(x = value, col = metric, fill = metric)) + + ggplot2::geom_histogram(ggplot2::aes(x = .data$value, col = .data$metric, fill = .data$metric)) + ggplot2::facet_wrap(~metric, scales = "free") + ggplot2::theme_bw() + ggplot2::theme(legend.position = 'null') + @@ -3936,6 +3936,7 @@ extract_tmbDispersion <- function(list_tmb) { #' @param eval_dispersion A data frame containing actual and inferred dispersion values. #' @param ... Additional arguments to be passed to the ggplot2::aes function. #' @importFrom ggplot2 ggplot geom_point aes geom_abline theme_bw ggtitle scale_x_log10 scale_y_log10 +#' @importFrom rlang .data #' @return A ggplot2 scatter plot. #' #' @export @@ -3950,7 +3951,7 @@ dispersion_plot <- function(eval_dispersion, ...) { args <- lapply(list(...), function(x) if (!is.null(x)) ggplot2::sym(x)) p <- ggplot2::ggplot(eval_dispersion) + - ggplot2::geom_point(ggplot2::aes(x = actual_dispersion, y = inferred_dispersion, !!!args), size = 3, alpha = 0.6) + + ggplot2::geom_point(ggplot2::aes(x = .data$actual_dispersion, y = .data$inferred_dispersion, !!!args), size = 3, alpha = 0.6) + ggplot2::geom_abline(intercept = 0, slope = 1, lty = 3, col = 'red', linewidth = 1) + ggplot2::theme_bw() + ggplot2::ggtitle("Dispersion evaluation") + @@ -5658,7 +5659,7 @@ getLabelExpected <- function(comparison_df, coeff_threshold, alt_hypothesis) { #' @return A ggplot object representing the ROC curve plot. #' @importFrom plotROC geom_roc #' @importFrom ggplot2 ggtitle theme_bw aes sym xlab ylab -#' +#' @importFrom rlang .data #' @examples #' comparison_data <- data.frame( #' geneID = c("gene1", "gene2", "gene3"), @@ -5682,7 +5683,7 @@ roc_plot <- function(comparison_df, ...) { args <- lapply(list(...), function(x) if (!is.null(x)) ggplot2::sym(x)) #comparison_df$isDE <- factor(comparison_df$isDE, levels= c(TRUE, FALSE)) - p <- ggplot2::ggplot(comparison_df, ggplot2::aes(d = !isDE , m = p.adj, !!!args )) + + p <- ggplot2::ggplot(comparison_df, ggplot2::aes(d = !.data$isDE , m = .data$p.adj, !!!args )) + plotROC::geom_roc(n.cuts = 0, labels = FALSE) + ggplot2::theme_bw() + ggplot2::ggtitle("ROC curve") + @@ -5822,6 +5823,7 @@ test_that("Counts plot is generated correctly", { #' @return A ggplot2 identity plot. #' #' @importFrom ggplot2 sym aes geom_point geom_abline facet_wrap theme_bw ggtitle scale_x_log10 scale_y_log10 +#' @importFrom rlang .data #' @export #' @examples #' comparison_data <- data.frame( @@ -5836,7 +5838,7 @@ identity_plot <- function(comparison_df, ...){ ggplot2::ggplot(comparison_df) + - ggplot2::geom_point(ggplot2::aes(x = actual, y = estimate, !!!args), alpha = 0.6, size = 2) + + ggplot2::geom_point(ggplot2::aes(x = .data$actual, y = .data$estimate, !!!args), alpha = 0.6, size = 2) + ggplot2::geom_abline(intercept = 0, slope = 1, lty = 3, col = 'red', linewidth = 1) + ggplot2::facet_wrap(~description, scales = "free") + ggplot2::theme_bw() +