Skip to content

Commit 7038138

Browse files
committed
Refactor ggplot2 method to simplify compatibility with ggplot2 4.0.0 by removing S7 method registration. Update DESCRIPTION to remove S7 as a suggested dependency and enhance NEWS documentation for clarity.
1 parent 0071478 commit 7038138

File tree

3 files changed

+3
-32
lines changed

3 files changed

+3
-32
lines changed

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ Suggests:
4646
markdown,
4747
rmarkdown,
4848
plotly,
49-
rbibutils,
50-
S7
49+
rbibutils
5150
VignetteBuilder:
5251
knitr
5352
RdMacros:

R/ggplot2_methods.R

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,3 @@ ggplot.SummarizedExperiment <- function(data=NULL, mapping=aes(),
2929
as_tibble() %>%
3030
ggplot2::ggplot(mapping=mapping)
3131
}
32-
33-
# S7 method for ggplot2 4.0.0+ compatibility
34-
register_s7_ggplot_method <- function() {
35-
if (requireNamespace("S7", quietly = TRUE)) {
36-
# Check if ggplot and SummarizedExperiment are S7 classes
37-
is_s7_class <- function(x) inherits(x, "S7_class")
38-
ggplot_s7 <- tryCatch(get("ggplot", envir = asNamespace("ggplot2")), error = function(e) NULL)
39-
se_s7 <- tryCatch(get("SummarizedExperiment", envir = asNamespace("SummarizedExperiment")), error = function(e) NULL)
40-
if (!is.null(ggplot_s7) && !is.null(se_s7) && is_s7_class(ggplot_s7) && is_s7_class(se_s7)) {
41-
# Use S7::method directly for the assignment
42-
S7::method(ggplot_s7, se_s7) <- function(data=NULL, mapping=aes(), ..., environment=parent.frame()) {
43-
.cols <- enquos(..., .ignore_empty="all") %>%
44-
map(~ quo_name(.x)) %>% unlist()
45-
if (is_sample_feature_deprecated_used(data, .cols)) {
46-
data <- ping_old_special_column_into_metadata(data)
47-
}
48-
data %>%
49-
as_tibble() %>%
50-
ggplot2::ggplot(mapping=mapping)
51-
}
52-
}
53-
}
54-
}
55-
56-
.onLoad <- function(libname, pkgname) {
57-
register_s7_ggplot_method()
58-
}

inst/NEWS.rd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
\section{Changes in version 1.16.0, Bioconductor 3.22 Release}{
55
\itemize{
6-
\item Prepared for ggplot2 4.0.0 compatibility with S7 methods.
7-
\item Added conditional S7 method for ggplot while maintaining S3 method for current ggplot2 versions.
8-
\item Added S7 as suggested dependency for future ggplot2 4.0.0 compatibility.
6+
\item Updated documentation to properly reflect S3 method structure.
7+
\item Simplified ggplot2 compatibility - S3 method continues to work with ggplot2 4.0.0.
98
}}
109

1110
\section{Changes in version 1.4.0, Bioconductor 3.14 Release}{

0 commit comments

Comments
 (0)