From 8f083f6a741a07f424cc80bcd28a686b46ee43ea Mon Sep 17 00:00:00 2001 From: Philipp A Date: Thu, 20 Oct 2022 12:19:10 +0200 Subject: [PATCH 1/6] Fix versions used in workflow (#62) --- .github/workflows/check-bioc.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml index ad6174c..1fe8156 100644 --- a/.github/workflows/check-bioc.yml +++ b/.github/workflows/check-bioc.yml @@ -54,9 +54,9 @@ jobs: fail-fast: false matrix: config: - - { os: ubuntu-latest, r: 'release', bioc: '3.14', cont: "bioconductor/bioconductor_docker:RELEASE_3_14", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } - - { os: macOS-latest, r: 'release', bioc: '3.14' } - - { os: windows-latest, r: 'release', bioc: '3.14' } + - { os: ubuntu-latest, r: '4.2', bioc: '3.15', bioc_release: RELEASE_3_15, cont: "bioconductor/bioconductor_docker:RELEASE_3_15", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } + - { os: macOS-latest, r: '4.2', bioc: '3.15', bioc_release: RELEASE_3_15 } + - { os: windows-latest, r: '4.2', bioc: '3.15', bioc_release: RELEASE_3_15 } ## Check https://github.com/r-lib/actions/tree/master/examples ## for examples using the http-user-agent env: @@ -86,7 +86,7 @@ jobs: ## R is already included in the Bioconductor docker images - name: Setup R from r-lib if: runner.os != 'Linux' - uses: r-lib/actions/setup-r@master + uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} @@ -94,7 +94,7 @@ jobs: ## pandoc is already included in the Bioconductor docker images - name: Setup pandoc from r-lib if: runner.os != 'Linux' - uses: r-lib/actions/setup-pandoc@master + uses: r-lib/actions/setup-pandoc@v2 - name: Query dependencies run: | @@ -107,16 +107,16 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.R_LIBS_USER }} - key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1- + key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc_release }}-r-${{ matrix.config.r }}-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc_release }}-r-${{ matrix.config.r }}- - name: Cache R packages on Linux if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' " uses: actions/cache@v2 with: path: /home/runner/work/_temp/Library - key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1- + key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc_release }}-r-${{ matrix.config.r }}-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc_release }}-r-${{ matrix.config.r }}- - name: Install Linux system dependencies if: runner.os == 'Linux' @@ -293,7 +293,7 @@ jobs: if: failure() uses: actions/upload-artifact@master with: - name: ${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-results + name: ${{ runner.os }}-biocversion-${{ matrix.config.bioc_release }}-r-${{ matrix.config.r }}-results path: check - uses: docker/build-push-action@v1 From 6a3e8ce772ca57728e6ac01a365d6b3158974761 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 28 Dec 2023 12:00:41 +0100 Subject: [PATCH 2/6] Fix sparse matrix cast deprecation --- DESCRIPTION | 2 +- R/diffusionmap.r | 2 +- R/methods-coercion.r | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4efbd04..ef1acce 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -120,4 +120,4 @@ Collate: 'projection-dist.r' 'rankcor.r' 'sigmas-plotting.r' -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 diff --git a/R/diffusionmap.r b/R/diffusionmap.r index 6822213..19be642 100644 --- a/R/diffusionmap.r +++ b/R/diffusionmap.r @@ -412,7 +412,7 @@ no_censoring <- function(dists, sigma, cb = invisible) { exp(-d2@x / (2 * sigma ^ 2)) } else { stopifnot(d2@uplo == 'U') - coords <- as(d2, 'dsTMatrix') + coords <- as(d2, 'TsparseMatrix') i <- coords@i + 1L j <- coords@j + 1L sig2 <- sigma^2 diff --git a/R/methods-coercion.r b/R/methods-coercion.r index 447f763..09492a6 100644 --- a/R/methods-coercion.r +++ b/R/methods-coercion.r @@ -60,7 +60,7 @@ setMethod('as.data.frame', 'DiffusionMap', function(x, row.names = NULL, optiona #' @importFrom Biobase as.data.frame.ExpressionSet #' @importFrom ggplot2 fortify #' @rdname coercions -#' @exportS3Method fortify +#' @exportS3Method fortify DiffusionMap #' @export fortify.DiffusionMap fortify.DiffusionMap <- function(model, data, ...) as.data.frame(model, ...) setAs('DiffusionMap', 'data.frame', function(from) as.data.frame(from)) @@ -83,7 +83,7 @@ setMethod('as.data.frame', 'DPT', function(x, row.names = NULL, optional = FALSE #' @importFrom Biobase as.data.frame.ExpressionSet #' @importFrom ggplot2 fortify #' @rdname coercions -#' @exportS3Method fortify +#' @exportS3Method fortify DPT #' @export fortify.DPT fortify.DPT <- function(model, data, ...) as.data.frame(model, ...) setAs('DPT', 'data.frame', function(from) as.data.frame(from)) From 57cc71cae809412b79bc8d1a651449774eae1d4c Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 28 Dec 2023 12:11:08 +0100 Subject: [PATCH 3/6] update workflow --- .github/workflows/check-bioc.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml index 1fe8156..3f05765 100644 --- a/.github/workflows/check-bioc.yml +++ b/.github/workflows/check-bioc.yml @@ -24,7 +24,6 @@ on: push: branches: [ master, RELEASE_* ] pull_request: - branches: [ master, RELEASE_* ] name: R-CMD-check-bioc @@ -54,9 +53,9 @@ jobs: fail-fast: false matrix: config: - - { os: ubuntu-latest, r: '4.2', bioc: '3.15', bioc_release: RELEASE_3_15, cont: "bioconductor/bioconductor_docker:RELEASE_3_15", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } - - { os: macOS-latest, r: '4.2', bioc: '3.15', bioc_release: RELEASE_3_15 } - - { os: windows-latest, r: '4.2', bioc: '3.15', bioc_release: RELEASE_3_15 } + - { os: ubuntu-latest, r: 'release', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } + - { os: macOS-latest, r: 'release', bioc: '3.18' } + - { os: windows-latest, r: 'release', bioc: '3.18' } ## Check https://github.com/r-lib/actions/tree/master/examples ## for examples using the http-user-agent env: From 4be2d3e88b04292d13120f2a058555fdcef838df Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 28 Dec 2023 12:22:07 +0100 Subject: [PATCH 4/6] concurrency --- .github/workflows/check-bioc.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml index 3f05765..d46e628 100644 --- a/.github/workflows/check-bioc.yml +++ b/.github/workflows/check-bioc.yml @@ -48,6 +48,10 @@ jobs: name: ${{ matrix.config.os }} (${{ matrix.config.r }}) container: ${{ matrix.config.cont }} ## Environment variables unique to this job. + + concurrency: + group: ${{ github.workflow }} ${{ matrix.config.os }} ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} + cancel-in-progress: true strategy: fail-fast: false @@ -58,6 +62,7 @@ jobs: - { os: windows-latest, r: 'release', bioc: '3.18' } ## Check https://github.com/r-lib/actions/tree/master/examples ## for examples using the http-user-agent + env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} From 91728427b34ee029474a16d6aeaac08b897d991b Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 28 Dec 2023 12:59:42 +0100 Subject: [PATCH 5/6] drop aes_string --- NAMESPACE | 4 ++-- R/diffusionmap-plotting.r | 7 ++++--- R/dpt-plotting.r | 5 +++-- R/gene-relevance-plotting-differential-map.r | 13 +++++++------ R/gene-relevance-plotting-gr-map.r | 5 +++-- R/gene-relevance-plotting-rank.r | 7 ++++--- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 433cdd7..8045c87 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -140,7 +140,7 @@ importFrom(SummarizedExperiment,colData) importFrom(VIM,hotdeck) importFrom(ggplot.multistats,stat_summaries_hex) importFrom(ggplot2,aes) -importFrom(ggplot2,aes_string) +importFrom(ggplot2,after_stat) importFrom(ggplot2,element_blank) importFrom(ggplot2,element_line) importFrom(ggplot2,element_rect) @@ -163,7 +163,6 @@ importFrom(ggplot2,scale_fill_identity) importFrom(ggplot2,scale_fill_manual) importFrom(ggplot2,scale_x_continuous) importFrom(ggplot2,scale_y_continuous) -importFrom(ggplot2,stat) importFrom(ggplot2,theme) importFrom(ggplot2,theme_minimal) importFrom(ggthemes,extended_range_breaks) @@ -207,6 +206,7 @@ importFrom(pcaMethods,pca) importFrom(pcaMethods,scores) importFrom(proxy,dist) importFrom(proxy,pr_DB) +importFrom(rlang,.data) importFrom(scales,colour_ramp) importFrom(scales,percent) importFrom(scales,rescale) diff --git a/R/diffusionmap-plotting.r b/R/diffusionmap-plotting.r index fc34f43..0813288 100644 --- a/R/diffusionmap-plotting.r +++ b/R/diffusionmap-plotting.r @@ -47,7 +47,8 @@ NULL #' @importFrom stats setNames #' @importFrom grDevices palette hcl.colors #' @importFrom scatterplot3d scatterplot3d -#' @importFrom ggplot2 ggplot aes aes_string +#' @importFrom rlang .data +#' @importFrom ggplot2 ggplot aes #' @importFrom ggplot2 geom_point #' @importFrom ggplot2 theme theme_minimal element_blank element_line element_text element_rect #' @importFrom ggplot2 scale_fill_identity scale_fill_manual scale_fill_gradientn scale_fill_identity @@ -142,10 +143,10 @@ plot.DiffusionMap <- function( use_mapping <- continuous || is_projection || !is.null(col_by) p <- - ggplot(point_data, aes_string(d1, d2)) + + ggplot(point_data, aes(.data[[d1]], .data[[d2]])) + theme_really_minimal() + geom_point( - aes_string(fill = if (use_mapping) 'Colour' else 'ColourExpl'), + aes(fill = if (use_mapping) .data$Colour else .data$ColourExpl), colour = I('#00000000'), shape = I(21)) diff --git a/R/dpt-plotting.r b/R/dpt-plotting.r index 64aed46..f358442 100644 --- a/R/dpt-plotting.r +++ b/R/dpt-plotting.r @@ -36,7 +36,8 @@ NULL #' @importFrom methods is setMethod #' @importFrom scales colour_ramp rescale #' @importFrom utils capture.output -#' @importFrom ggplot2 aes_string geom_path geom_point scale_colour_identity +#' @importFrom rlang .data +#' @importFrom ggplot2 geom_path geom_point scale_colour_identity #' @export plot.DPT <- function( x, root = NULL, @@ -144,7 +145,7 @@ get_plot_fn <- function(p) { function(p2, dat, type = 'p', col, ...) { xy <- colnames(dat) geom <- switch(type, p = geom_point, l = geom_path, stop) - p2 + geom(aes_string(xy[[1L]], xy[[2L]], colour = 'Path'), data.frame(dat, Path = col)) + p2 + geom(aes(.data[[xy[[1L]]]], .data[[xy[[2L]]]], colour = .data$Path), data.frame(dat, Path = col)) } } else if (is.list(p) && 'points3d' %in% names(p)) {# scatterplot3d function(p2, ...) { diff --git a/R/gene-relevance-plotting-differential-map.r b/R/gene-relevance-plotting-differential-map.r index 4f9d73d..2d3e6dd 100644 --- a/R/gene-relevance-plotting-differential-map.r +++ b/R/gene-relevance-plotting-differential-map.r @@ -66,7 +66,8 @@ differential_map <- function(relevance_map, genes = NULL, dims = 1:2, all = FALS })) } -#' @importFrom ggplot2 ggplot aes aes_string +#' @importFrom rlang .data +#' @importFrom ggplot2 ggplot aes #' @importFrom ggplot2 geom_point geom_spoke #' @importFrom ggplot2 scale_colour_gradientn #' @importFrom ggplot2 ggtitle facet_wrap @@ -80,12 +81,12 @@ plot_differential_map_impl <- function(relevance_map, ..., genes, dims, pal, fac d1 <- colnames(coords)[[1]] d2 <- colnames(coords)[[2]] - gg <- ggplot(dtm, aes_string(d1, d2)) + + gg <- ggplot(dtm, aes(.data[[d1]], .data[[d2]])) + geom_spoke( - aes_string( - angle = 'Angle', radius = 'Magnitude', - alpha = 'PartialsNorm', - colour = 'Expression' + aes( + angle = .data$Angle, radius = .data$Magnitude, + alpha = .data$PartialsNorm, + colour = .data$Expression ), arrow = arrow(length = unit(.01, 'npc')) ) + diff --git a/R/gene-relevance-plotting-gr-map.r b/R/gene-relevance-plotting-gr-map.r index 5e16076..b90e82d 100644 --- a/R/gene-relevance-plotting-gr-map.r +++ b/R/gene-relevance-plotting-gr-map.r @@ -22,7 +22,8 @@ setMethod('plot_gene_relevance', c('GeneRelevance', 'missing'), function(coords, plot_gene_relevance_impl(coords, iter_smooth = iter_smooth, n_top = n_top, genes = genes, dims = dims, pal = pal, col_na = col_na, limit = limit, ...) }) -#' @importFrom ggplot2 ggplot aes_string +#' @importFrom rlang .data +#' @importFrom ggplot2 ggplot #' @importFrom ggplot2 geom_point #' @importFrom ggplot2 scale_color_manual #' @importFrom ggplot2 ggtitle @@ -109,7 +110,7 @@ plot_gene_relevance_impl <- function(relevance_map, ..., iter_smooth, n_top, gen d1 <- colnames(coords)[[1]] d2 <- colnames(coords)[[2]] - rel_map <- ggplot(rel_map_data, aes_string(x = d1, y = d2, colour = 'Gene', text = 'TopN')) + + rel_map <- ggplot(rel_map_data, aes(x = .data[[d1]], y = .data[[d2]], colour = .data$Gene, text = .data$TopN)) + geom_point(alpha = .8) + geom_rangeframe(colour = par('col')) + scale_color_manual(values = pal, na.value = col_na) + diff --git a/R/gene-relevance-plotting-rank.r b/R/gene-relevance-plotting-rank.r index 544bd48..18d442a 100644 --- a/R/gene-relevance-plotting-rank.r +++ b/R/gene-relevance-plotting-rank.r @@ -25,7 +25,8 @@ setMethod('plot_gene_relevance_rank', c('GeneRelevance', 'missing'), function(co #' @importFrom tidyr gather #' @importFrom tidyselect one_of #' @importFrom scales percent -#' @importFrom ggplot2 ggplot aes_string stat +#' @importFrom rlang .data +#' @importFrom ggplot2 ggplot after_stat #' @importFrom ggplot2 scale_fill_gradientn scale_alpha_continuous #' @importFrom ggplot.multistats stat_summaries_hex plot_gene_relevance_rank_impl <- function(relevance_map, ..., genes, dims, n_top, pal, bins, faceter) { @@ -49,9 +50,9 @@ plot_gene_relevance_rank_impl <- function(relevance_map, ..., genes, dims, n_top d1 <- colnames(coords)[[1]] d2 <- colnames(coords)[[2]] - gg <- ggplot(d, aes_string(d1, d2, z = 'Rank')) + + gg <- ggplot(d, aes(.data[[d1]], .data[[d2]], z = .data$Rank)) + stat_summaries_hex( - aes_string(fill = 'stat(top10)', alpha = 'stat(size)'), + aes(fill = after_stat(.data$top10), alpha = after_stat(.data$size)), funs = list(top10 = top10, size = 'length', 'median'), bins = bins ) + From 1941107bb9f02af736ee47f056bf7aa83cf4db37 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 28 Dec 2023 13:10:13 +0100 Subject: [PATCH 6/6] mark rlang as imported --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 73e80dd..9d1cc2c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,6 +41,7 @@ Imports: SingleCellExperiment, ggplot2, ggplot.multistats, + rlang, tidyr, tidyselect, ggthemes,