diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml index a6d1a7d..02abeb9 100644 --- a/.github/workflows/check-bioc.yml +++ b/.github/workflows/check-bioc.yml @@ -1,25 +1,3 @@ -## Read more about GitHub actions the features of this GitHub Actions workflow -## at https://lcolladotor.github.io/biocthis/articles/biocthis.html#use_bioc_github_action -## -## For more details, check the biocthis developer notes vignette at -## https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html -## -## You can add this workflow to other packages using: -## > biocthis::use_bioc_github_action() -## -## Using GitHub Actions exposes you to many details about how R packages are -## compiled and installed in several operating system.s -### If you need help, please follow the steps listed at -## https://github.com/r-lib/actions#where-to-find-help -## -## If you found an issue specific to biocthis's GHA workflow, please report it -## with the information that will make it easier for others to help you. -## Thank you! - -## Acronyms: -## * GHA: GitHub Action -## * OS: operating system - on: push: pull_request: @@ -28,35 +6,25 @@ name: R-CMD-check-bioc ## These environment variables control whether to run GHA code later on that is ## specific to testthat, covr, and pkgdown. -## -## If you need to clear the cache of packages, update the number inside -## cache-version as discussed at https://github.com/r-lib/actions/issues/86. -## Note that you can always run a GHA test without the cache by using the word -## "/nocache" in the commit message. env: has_testthat: 'true' run_covr: 'true' run_pkgdown: 'true' has_RUnit: 'false' cache-version: 'cache-v1' - run_docker: 'false' jobs: build-check: runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (${{ matrix.config.r }}) container: ${{ matrix.config.cont }} - ## Environment variables unique to this job. strategy: fail-fast: false matrix: config: - - { os: ubuntu-latest, r: '4.2', bioc: '3.15', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } - - { os: macOS-latest, r: '4.1', bioc: '3.14'} - - { os: windows-latest, r: '4.1', bioc: '3.14'} - ## Check https://github.com/r-lib/actions/tree/master/examples - ## for examples using the http-user-agent + - { os: ubuntu-latest, r: '4.4', bioc: '3.19', cont: "bioconductor/bioconductor_docker:RELEASE_3_19", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } + env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} @@ -67,32 +35,25 @@ jobs: steps: - ## Set the R library to the directory matching the - ## R packages cache step further below when running on Docker (Linux). - name: Set R Library home on Linux if: runner.os == 'Linux' run: | mkdir /__w/_temp/Library echo ".libPaths('/__w/_temp/Library')" > ~/.Rprofile - ## Most of these steps are the same as the ones in - ## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml - ## If they update their steps, we will also need to update ours. - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - ## 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 }} - ## 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: | @@ -102,7 +63,7 @@ jobs: - name: Restore R package cache if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'" - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ env.R_LIBS_USER }} key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-${{ hashFiles('.github/depends.Rds') }} @@ -110,7 +71,7 @@ jobs: - name: Cache R packages on Linux if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' " - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: /home/runner/work/_temp/Library key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-${{ hashFiles('.github/depends.Rds') }} @@ -123,32 +84,6 @@ jobs: echo $sysreqs sudo -s eval "$sysreqs" - - name: Install macOS system dependencies - if: matrix.config.os == 'macOS-latest' - run: | - ## Enable installing XML from source if needed - brew install libxml2 - echo "XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config" >> $GITHUB_ENV - - ## Required to install magick as noted at - ## https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2 - brew install imagemagick@6 - - ## For textshaping, required by ragg, and required by pkgdown - brew install harfbuzz fribidi - - ## For installing usethis's dependency gert - brew install libgit2 - - ## Required for tcltk - brew install xquartz --cask - - - name: Install Windows system dependencies - if: runner.os == 'Windows' - run: | - ## Edit below if you have any Windows system dependencies - shell: Rscript {0} - - name: Install BiocManager run: | message(paste('****', Sys.time(), 'installing BiocManager ****')) @@ -306,13 +241,3 @@ jobs: with: name: ${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-results path: check - - - uses: docker/build-push-action@v1 - if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && runner.os == 'Linux' " - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: dzhang32/ggtranscript - tag_with_ref: true - tag_with_sha: true - tags: latest diff --git a/DESCRIPTION b/DESCRIPTION index 280415e..8a228cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ggtranscript Title: Visualizing Transcript Structure and Annotation using 'ggplot2' -Version: 0.99.9 +Version: 1.0.0 Authors@R: c( person("David", "Zhang", , "dyzhang32@gmail.com", @@ -27,7 +27,7 @@ URL: https://github.com/dzhang32/ggtranscript BugReports: https://github.com/dzhang32/ggtranscript/issues Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.3.2 Suggests: BiocStyle, covr, diff --git a/NEWS.md b/NEWS.md index 6413838..8cada2a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ + +# ggtranscript 1.0.0 + +## Fixes + +* Updates `geom`s to work with the latest version of `ggplot2` and `ggrepel` (R version `4.4`). +* Fixes all unit tests. +* Fixes CI workflow issues and simplifies testing to linux-only. + # ggtranscript 0.99.9 ## NEW FEATURES diff --git a/R/geom_intron.R b/R/geom_intron.R index add308f..4c442ad 100644 --- a/R/geom_intron.R +++ b/R/geom_intron.R @@ -63,7 +63,7 @@ #' # the functionality from the parameters and aesthetics in ggplot2 #' base + geom_intron( #' aes(colour = transcript_name), -#' size = 1 +#' linewidth = 1 #' ) #' #' # together, geom_range() and geom_intron() are designed to visualize @@ -132,7 +132,7 @@ GeomIntron <- ggplot2::ggproto("GeomIntron", ggplot2::GeomSegment, required_aes = c("xstart", "xend", "y"), default_aes = aes( colour = "black", - size = 0.5, + linewidth = 0.5, linetype = 1, alpha = NA, strand = "+" diff --git a/R/geom_junction.R b/R/geom_junction.R index 89df6b3..6288a14 100644 --- a/R/geom_junction.R +++ b/R/geom_junction.R @@ -101,11 +101,11 @@ #' # this can be useful when mapping junction thickness to their counts #' base + geom_junction( #' data = sod1_junctions, -#' aes(size = mean_count), +#' aes(linewidth = mean_count), #' junction.y.max = 0.5, #' colour = "purple" #' ) + -#' scale_size(range = c(0.1, 1)) +#' scale_linewidth(range = c(0.1, 1)) #' #' # it can be useful to combine geom_junction() with geom_half_range() #' sod1_exons %>% @@ -120,12 +120,12 @@ #' ) + #' geom_junction( #' data = sod1_junctions, -#' aes(size = mean_count), +#' aes(linewidth = mean_count), #' junction.y.max = 0.5, #' junction.orientation = "top", #' colour = "purple" #' ) + -#' scale_size(range = c(0.1, 1)) +#' scale_linewidth(range = c(0.1, 1)) geom_junction <- function(mapping = NULL, data = NULL, stat = "identity", @@ -256,7 +256,7 @@ GeomJunction <- ggplot2::ggproto("GeomJunction", ggplot2::GeomLine, junction_curve <- data.frame( x_points = c(x, curve_points$x, xend), y_points = c(y, curve_points$y, y), - y_orig = y + y_original = y ) %>% dplyr::rename( x = x_points, @@ -282,17 +282,17 @@ GeomJunction <- ggplot2::ggproto("GeomJunction", ggplot2::GeomLine, # then divided by the sf, setting the max y if (junction.orientation == "top") { junctions <- junctions %>% dplyr::mutate( - y = ifelse(y == y_orig, y, y_orig + (y / max(y)) / sf) + y = ifelse(y == y_original, y, y_original + (y / max(y)) / sf) ) } else if (junction.orientation == "bottom") { junctions <- junctions %>% dplyr::mutate( - y = ifelse(y == y_orig, y, y_orig - (y / max(y)) / sf) + y = ifelse(y == y_original, y, y_original - (y / max(y)) / sf) ) } else if (junction.orientation == "alternating") { junctions <- junctions %>% dplyr::mutate(y = dplyr::case_when( - y == y_orig ~ y, - junction_index %% 2 == 0 ~ y_orig - (y / max(y) / sf), - junction_index %% 2 == 1 ~ y_orig + (y / max(y) / sf) + y == y_original ~ y, + junction_index %% 2 == 0 ~ y_original - (y / max(y) / sf), + junction_index %% 2 == 1 ~ y_original + (y / max(y) / sf) )) } diff --git a/R/geom_range.R b/R/geom_range.R index 3cbbc9f..813c4fd 100644 --- a/R/geom_range.R +++ b/R/geom_range.R @@ -58,7 +58,7 @@ #' # the functionality from the parameters and aesthetics in ggplot2 #' base + geom_range( #' aes(fill = transcript_name), -#' size = 1 +#' linewidth = 1 #' ) #' #' # together, geom_range() and geom_intron() are designed to visualize @@ -177,7 +177,7 @@ GeomRange <- ggplot2::ggproto("GeomRange", ggplot2::GeomTile, default_aes = aes( fill = "grey", colour = "black", - size = 0.25, + linewidth = 0.25, linetype = 1, alpha = NA, height = NA @@ -220,7 +220,7 @@ GeomRange <- ggplot2::ggproto("GeomRange", ggplot2::GeomTile, gp = grid::gpar( col = coords$colour, fill = ggplot2::alpha(coords$fill, coords$alpha), - lwd = coords$size * ggplot2::.pt, + lwd = coords$linewidth * ggplot2::.pt, lty = coords$linetype, linejoin = linejoin, lineend = lineend diff --git a/R/ggtranscript-package.R b/R/ggtranscript-package.R index 7a0eba4..559ba0d 100644 --- a/R/ggtranscript-package.R +++ b/R/ggtranscript-package.R @@ -12,7 +12,7 @@ #' #' @docType package #' @name ggtranscript -NULL +"_PACKAGE" #' @importFrom rlang %||% #' @importFrom magrittr %>% diff --git a/R/globals.R b/R/globals.R index 4837dbb..1c5fe0f 100644 --- a/R/globals.R +++ b/R/globals.R @@ -41,7 +41,7 @@ utils::globalVariables(c( "x_points", "y_points", "y", - "y_orig", + "y_original", "position_nudge_repel", # add_utr(), "dummy_group" diff --git a/README.Rmd b/README.Rmd index 0f685e6..045ede0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -261,4 +261,4 @@ citation("ggtranscript") ## Credits -* `ggtranscript` was developed using `r BiocStyle::Biocpkg("biocthis")`. +* `ggtranscript` was developed using `biocthis`. diff --git a/README.md b/README.md index 0f7e16f..cae954a 100644 --- a/README.md +++ b/README.md @@ -60,14 +60,15 @@ library(ggtranscript) # ggtranscript includes example transcript annotation sod1_annotation %>% head() #> # A tibble: 6 × 8 -#> seqnames start end strand type gene_name transcript_name transcript_biot… -#> -#> 1 21 3.17e7 3.17e7 + gene SOD1 -#> 2 21 3.17e7 3.17e7 + tran… SOD1 SOD1-202 protein_coding -#> 3 21 3.17e7 3.17e7 + exon SOD1 SOD1-202 protein_coding -#> 4 21 3.17e7 3.17e7 + CDS SOD1 SOD1-202 protein_coding -#> 5 21 3.17e7 3.17e7 + star… SOD1 SOD1-202 protein_coding -#> 6 21 3.17e7 3.17e7 + exon SOD1 SOD1-202 protein_coding +#> seqnames start end strand type gene_name transcript_name +#> +#> 1 21 31659666 31668931 + gene SOD1 +#> 2 21 31659666 31668931 + transcript SOD1 SOD1-202 +#> 3 21 31659666 31659784 + exon SOD1 SOD1-202 +#> 4 21 31659770 31659784 + CDS SOD1 SOD1-202 +#> 5 21 31659770 31659772 + start_codon SOD1 SOD1-202 +#> 6 21 31663790 31663886 + exon SOD1 SOD1-202 +#> # ℹ 1 more variable: transcript_biotype # extract exons sod1_exons <- sod1_annotation %>% dplyr::filter(type == "exon") @@ -96,6 +97,7 @@ allows you to hone in the differences in the exonic structure, which can be particularly useful if the transcript has relatively long introns. ``` r + sod1_rescaled <- shorten_gaps( sod1_exons, to_intron(sod1_exons, "transcript_name"), @@ -160,6 +162,7 @@ bottom of a transcript structure. One use case of `geom_half_range()` is to visualize the differences between transcript structure more clearly. ``` r + # extract exons and cds for the two transcripts to be compared sod1_201_exons <- sod1_exons %>% dplyr::filter(transcript_name == "SOD1-201") sod1_201_cds <- sod1_cds %>% dplyr::filter(transcript_name == "SOD1-201") @@ -207,6 +210,7 @@ and functionality of `ggplot2`. For instance, by leveraging `coord_cartesian()` users can zoom in on regions of interest. ``` r + sod1_201_202_plot + coord_cartesian(xlim = c(31659500, 31660000)) ``` @@ -218,6 +222,7 @@ adds a label to junction curves, which can often be useful to mark junctions with a metric of their usage such as read counts. ``` r + # ggtranscript includes a set of example (unannotated) junctions # originating from GTEx and downloaded via the Bioconductor package snapcount sod1_junctions @@ -270,6 +275,7 @@ addition, by modifying `ggplot2` scales and themes, users can easily create informative, publication-ready plots. ``` r + sod1_201_exons %>% ggplot(aes( xstart = start, @@ -297,6 +303,11 @@ sod1_201_exons %>% xlab("Genomic position (chr21)") + ylab("Transcript name") + theme_bw() +#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0. +#> ℹ Please use `linewidth` instead. +#> This warning is displayed once every 8 hours. +#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was +#> generated. ``` @@ -304,14 +315,16 @@ sod1_201_exons %>% ## Citation ``` r + citation("ggtranscript") +#> To cite package 'ggtranscript' in publications use: #> -#> Gustavsson EK, Zhang D, Reynolds RH, Garcia-Ruiz S, Ryten M (2022). -#> "ggtranscript: an R package for the visualization and interpretation of -#> transcript isoforms using ggplot2." _Bioinformatics_. doi: -#> 10.1093/bioinformatics/btac409 (URL: -#> https://doi.org/10.1093/bioinformatics/btac409), https://academic.oup.com/bioinformatics/article/38/15/3844/6617821>. +#> Gustavsson EK, Zhang D, Reynolds RH, Garcia-Ruiz S, Ryten M (2022). +#> "ggtranscript: an R package for the visualization and interpretation +#> of transcript isoforms using ggplot2." _Bioinformatics_. +#> doi:10.1093/bioinformatics/btac409 +#> , +#> . #> #> A BibTeX entry for LaTeX users is #> @@ -327,5 +340,4 @@ citation("ggtranscript") ## Credits -- `ggtranscript` was developed using - *[biocthis](https://bioconductor.org/packages/3.14/biocthis)*. +- `ggtranscript` was developed using `biocthis`. diff --git a/cran-comments.md b/cran-comments.md deleted file mode 100644 index 144e348..0000000 --- a/cran-comments.md +++ /dev/null @@ -1,9 +0,0 @@ -This is the first CRAN submission of the `ggtranscript` package. - -## R CMD check results - -There were no `ERROR`s, `WARNING`s or `NOTE`s. - -## Downstream dependencies - -There are currently no downstream dependencies for this package. diff --git a/man/figures/README-geom-junction-1.png b/man/figures/README-geom-junction-1.png index e1a4210..b015015 100644 Binary files a/man/figures/README-geom-junction-1.png and b/man/figures/README-geom-junction-1.png differ diff --git a/man/figures/README-geom-range-intron-1.png b/man/figures/README-geom-range-intron-1.png index fcd1268..ef4e0df 100644 Binary files a/man/figures/README-geom-range-intron-1.png and b/man/figures/README-geom-range-intron-1.png differ diff --git a/man/figures/README-shorten-gaps-1.png b/man/figures/README-shorten-gaps-1.png index 4369c32..ff842bc 100644 Binary files a/man/figures/README-shorten-gaps-1.png and b/man/figures/README-shorten-gaps-1.png differ diff --git a/man/geom_intron.Rd b/man/geom_intron.Rd index 1c1fdd7..557533b 100644 --- a/man/geom_intron.Rd +++ b/man/geom_intron.Rd @@ -21,10 +21,10 @@ geom_intron( ) } \arguments{ -\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or -\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the -default), it is combined with the default mapping at the top level of the -plot. You must supply \code{mapping} if there is no plot mapping.} +\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and +\code{inherit.aes = TRUE} (the default), it is combined with the default mapping +at the top level of the plot. You must supply \code{mapping} if there is no plot +mapping.} \item{data}{The data to be displayed in this layer. There are three options: @@ -41,18 +41,61 @@ the plot data. The return value must be a \code{data.frame}, and will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} -\item{stat}{The statistical transformation to use on the data for this -layer, as a string.} - -\item{position}{Position adjustment, either as a string, or the result of -a call to a position adjustment function.} - -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} - -\item{arrow}{specification for arrow heads, as created by arrow().} +\item{stat}{The statistical transformation to use on the data for this layer. +When using a \verb{geom_*()} function to construct a layer, the \code{stat} +argument can be used the override the default coupling between geoms and +stats. The \code{stat} argument accepts the following: +\itemize{ +\item A \code{Stat} ggproto subclass, for example \code{StatCount}. +\item A string naming the stat. To give the stat as a string, strip the +function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, +give the stat as \code{"count"}. +\item For more information and other ways to specify the stat, see the +\link[ggplot2:layer_stats]{layer stat} documentation. +}} + +\item{position}{A position adjustment to use on the data for this layer. This +can be used in various ways, including to prevent overplotting and +improving the display. The \code{position} argument accepts the following: +\itemize{ +\item The result of calling a position function, such as \code{position_jitter()}. +This method allows for passing extra arguments to the position. +\item A string naming the position adjustment. To give the position as a +string, strip the function name of the \code{position_} prefix. For example, +to use \code{position_jitter()}, give the position as \code{"jitter"}. +\item For more information and other ways to specify the position, see the +\link[ggplot2:layer_positions]{layer position} documentation. +}} + +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. Please note that while passing +unmapped aesthetics as vectors is technically possible, the order and +required length is not guaranteed to be parallel to the input data. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} + +\item{arrow}{specification for arrow heads, as created by \code{\link[grid:arrow]{grid::arrow()}}.} \item{arrow.fill}{fill colour to use for the arrow head (if closed). \code{NULL} means use \code{colour} aesthetic.} @@ -137,7 +180,7 @@ base + geom_intron(aes(strand = strand)) # the functionality from the parameters and aesthetics in ggplot2 base + geom_intron( aes(colour = transcript_name), - size = 1 + linewidth = 1 ) # together, geom_range() and geom_intron() are designed to visualize diff --git a/man/geom_junction.Rd b/man/geom_junction.Rd index 994579c..29d2c8c 100644 --- a/man/geom_junction.Rd +++ b/man/geom_junction.Rd @@ -21,10 +21,10 @@ geom_junction( ) } \arguments{ -\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or -\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the -default), it is combined with the default mapping at the top level of the -plot. You must supply \code{mapping} if there is no plot mapping.} +\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and +\code{inherit.aes = TRUE} (the default), it is combined with the default mapping +at the top level of the plot. You must supply \code{mapping} if there is no plot +mapping.} \item{data}{The data to be displayed in this layer. There are three options: @@ -41,11 +41,31 @@ the plot data. The return value must be a \code{data.frame}, and will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} -\item{stat}{The statistical transformation to use on the data for this -layer, as a string.} - -\item{position}{Position adjustment, either as a string, or the result of -a call to a position adjustment function.} +\item{stat}{The statistical transformation to use on the data for this layer. +When using a \verb{geom_*()} function to construct a layer, the \code{stat} +argument can be used the override the default coupling between geoms and +stats. The \code{stat} argument accepts the following: +\itemize{ +\item A \code{Stat} ggproto subclass, for example \code{StatCount}. +\item A string naming the stat. To give the stat as a string, strip the +function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, +give the stat as \code{"count"}. +\item For more information and other ways to specify the stat, see the +\link[ggplot2:layer_stats]{layer stat} documentation. +}} + +\item{position}{A position adjustment to use on the data for this layer. This +can be used in various ways, including to prevent overplotting and +improving the display. The \code{position} argument accepts the following: +\itemize{ +\item The result of calling a position function, such as \code{position_jitter()}. +This method allows for passing extra arguments to the position. +\item A string naming the position adjustment. To give the position as a +string, strip the function name of the \code{position_} prefix. For example, +to use \code{position_jitter()}, give the position as \code{"jitter"}. +\item For more information and other ways to specify the position, see the +\link[ggplot2:layer_positions]{layer position} documentation. +}} \item{junction.orientation}{\code{character()} one of "alternating", "top" or "bottom", specifying where the junctions will be plotted with respect to @@ -83,10 +103,33 @@ rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. Please note that while passing +unmapped aesthetics as vectors is technically possible, the order and +required length is not guaranteed to be parallel to the input data. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} } \value{ the return value of a \verb{geom_*} function is not intended to be @@ -181,11 +224,11 @@ base + geom_junction( # this can be useful when mapping junction thickness to their counts base + geom_junction( data = sod1_junctions, - aes(size = mean_count), + aes(linewidth = mean_count), junction.y.max = 0.5, colour = "purple" ) + - scale_size(range = c(0.1, 1)) + scale_linewidth(range = c(0.1, 1)) # it can be useful to combine geom_junction() with geom_half_range() sod1_exons \%>\% @@ -200,10 +243,10 @@ sod1_exons \%>\% ) + geom_junction( data = sod1_junctions, - aes(size = mean_count), + aes(linewidth = mean_count), junction.y.max = 0.5, junction.orientation = "top", colour = "purple" ) + - scale_size(range = c(0.1, 1)) + scale_linewidth(range = c(0.1, 1)) } diff --git a/man/geom_junction_label_repel.Rd b/man/geom_junction_label_repel.Rd index f61bbd6..cb620a6 100644 --- a/man/geom_junction_label_repel.Rd +++ b/man/geom_junction_label_repel.Rd @@ -122,22 +122,16 @@ Defaults to 0.5.} \item{max.iter}{Maximum number of iterations to try to resolve overlaps. Defaults to 10000.} -\item{max.overlaps}{Exclude text labels that overlap too many things. +\item{max.overlaps}{Exclude text labels when they overlap too many other +things. For each text label, we count how many other text labels or other +data points it overlaps, and exclude the text label if it has too many overlaps. Defaults to 10.} -\item{nudge_x}{Horizontal and vertical adjustments to nudge the +\item{nudge_x, nudge_y}{Horizontal and vertical adjustments to nudge the starting position of each text label. The units for \code{nudge_x} and \code{nudge_y} are the same as for the data units on the x-axis and y-axis.} -\item{nudge_y}{Horizontal and vertical adjustments to nudge the -starting position of each text label. The units for \code{nudge_x} and -\code{nudge_y} are the same as for the data units on the x-axis and y-axis.} - -\item{xlim}{Limits for the x and y axes. Text labels will be constrained -to these limits. By default, text labels are constrained to the entire plot -area.} - -\item{ylim}{Limits for the x and y axes. Text labels will be constrained +\item{xlim, ylim}{Limits for the x and y axes. Text labels will be constrained to these limits. By default, text labels are constrained to the entire plot area.} diff --git a/man/geom_range.Rd b/man/geom_range.Rd index 0acd6f3..31ed3fd 100644 --- a/man/geom_range.Rd +++ b/man/geom_range.Rd @@ -32,10 +32,10 @@ geom_half_range( ) } \arguments{ -\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or -\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the -default), it is combined with the default mapping at the top level of the -plot. You must supply \code{mapping} if there is no plot mapping.} +\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and +\code{inherit.aes = TRUE} (the default), it is combined with the default mapping +at the top level of the plot. You must supply \code{mapping} if there is no plot +mapping.} \item{data}{The data to be displayed in this layer. There are three options: @@ -52,20 +52,62 @@ the plot data. The return value must be a \code{data.frame}, and will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} -\item{stat}{The statistical transformation to use on the data for this -layer, as a string.} - -\item{position}{Position adjustment, either as a string, or the result of -a call to a position adjustment function.} - -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} - -\item{vjust}{horizontal and vertical justification of the grob. Each -justification value should be a number between 0 and 1. Defaults to 0.5 -for both, centering each pixel over its data location.} +\item{stat}{The statistical transformation to use on the data for this layer. +When using a \verb{geom_*()} function to construct a layer, the \code{stat} +argument can be used the override the default coupling between geoms and +stats. The \code{stat} argument accepts the following: +\itemize{ +\item A \code{Stat} ggproto subclass, for example \code{StatCount}. +\item A string naming the stat. To give the stat as a string, strip the +function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, +give the stat as \code{"count"}. +\item For more information and other ways to specify the stat, see the +\link[ggplot2:layer_stats]{layer stat} documentation. +}} + +\item{position}{A position adjustment to use on the data for this layer. This +can be used in various ways, including to prevent overplotting and +improving the display. The \code{position} argument accepts the following: +\itemize{ +\item The result of calling a position function, such as \code{position_jitter()}. +This method allows for passing extra arguments to the position. +\item A string naming the position adjustment. To give the position as a +string, strip the function name of the \code{position_} prefix. For example, +to use \code{position_jitter()}, give the position as \code{"jitter"}. +\item For more information and other ways to specify the position, see the +\link[ggplot2:layer_positions]{layer position} documentation. +}} + +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. Please note that while passing +unmapped aesthetics as vectors is technically possible, the order and +required length is not guaranteed to be parallel to the input data. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} + +\item{vjust}{A numeric vector specifying vertical justification. + If specified, overrides the \code{just} setting.} \item{linejoin}{Line join style (round, mitre, bevel).} @@ -141,7 +183,7 @@ base + geom_half_range(range.orientation = "top") # the functionality from the parameters and aesthetics in ggplot2 base + geom_range( aes(fill = transcript_name), - size = 1 + linewidth = 1 ) # together, geom_range() and geom_intron() are designed to visualize diff --git a/man/ggtranscript.Rd b/man/ggtranscript.Rd index 0f99f36..43815c9 100644 --- a/man/ggtranscript.Rd +++ b/man/ggtranscript.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/ggtranscript-package.R \docType{package} \name{ggtranscript} +\alias{ggtranscript-package} \alias{ggtranscript} \title{\code{ggtranscript}: Visualizing transcript structure and annotation using \code{ggplot2}} @@ -15,3 +16,26 @@ helper functions. As a \code{ggplot2} extension, \code{ggtranscript} inherits aesthetics, parameters, scales etc as well as complement \code{ggtranscript} geoms with existing \code{ggplot2} geoms to create informative, publication-ready plots. } +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/dzhang32/ggtranscript} + \item Report bugs at \url{https://github.com/dzhang32/ggtranscript/issues} +} + +} +\author{ +\strong{Maintainer}: David Zhang \email{dyzhang32@gmail.com} (\href{https://orcid.org/0000-0003-2382-8460}{ORCID}) + +Authors: +\itemize{ + \item Emil Gustavsson \email{e.gustavsson@ucl.ac.uk} (\href{https://orcid.org/0000-0003-0541-7537}{ORCID}) +} + +Other contributors: +\itemize{ + \item Regina Reynolds \email{regina.reynolds.16@ucl.ac.uk} (\href{https://orcid.org/0000-0001-6470-7919}{ORCID}) [contributor] + \item Sonia Ruiz \email{s.ruiz@ucl.ac.uk} [contributor] +} + +} diff --git a/tests/testthat/_snaps/add_utr/test-rescaled-with-utr-plot.svg b/tests/testthat/_snaps/add_utr/test-rescaled-with-utr-plot.svg index ebf8a60..b5c7476 100644 --- a/tests/testthat/_snaps/add_utr/test-rescaled-with-utr-plot.svg +++ b/tests/testthat/_snaps/add_utr/test-rescaled-with-utr-plot.svg @@ -21,321 +21,321 @@ - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -PKNOX1-201 -PKNOX1-203 -PKNOX1-209 - - - - - - -42980000 -43000000 -43020000 -transcript_name +PKNOX1-201 +PKNOX1-203 +PKNOX1-209 + + + + + + +42980000 +43000000 +43020000 +transcript_name - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -PKNOX1-201 -PKNOX1-203 -PKNOX1-209 - - - - - - - -0 -2000 -4000 -6000 -transcript_name +PKNOX1-201 +PKNOX1-203 +PKNOX1-209 + + + + + + + +0 +2000 +4000 +6000 +transcript_name diff --git a/tests/testthat/_snaps/geom_half_range/with-aes-geom-half-range-plot.svg b/tests/testthat/_snaps/geom_half_range/with-aes-geom-half-range-plot.svg index ae50eed..f8cfccc 100644 --- a/tests/testthat/_snaps/geom_half_range/with-aes-geom-half-range-plot.svg +++ b/tests/testthat/_snaps/geom_half_range/with-aes-geom-half-range-plot.svg @@ -48,9 +48,9 @@ tx - + - + A B With aes geom_half_range plot diff --git a/tests/testthat/_snaps/geom_intron/with-aes-geom-intron-plot.svg b/tests/testthat/_snaps/geom_intron/with-aes-geom-intron-plot.svg index df95aba..172e303 100644 --- a/tests/testthat/_snaps/geom_intron/with-aes-geom-intron-plot.svg +++ b/tests/testthat/_snaps/geom_intron/with-aes-geom-intron-plot.svg @@ -51,38 +51,38 @@ 500 600 tx - -c(1L, 2L) + +tx - - + + - - - - - - - - - - - -1.00 -1.25 -1.50 -1.75 -2.00 - -tx + + +A +B + +c(1L, 2L) + + + + + + + + + - - + + - - -A -B + + +1.00 +1.25 +1.50 +1.75 +2.00 With aes geom_intron plot diff --git a/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg b/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg index c29a1a9..e1f1200 100644 --- a/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg +++ b/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg @@ -35,30 +35,24 @@ - - - - - - - - - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 + + + + + + + +2 + +3 + +5 + +6 + +7 + +8 diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg index 6370669..44eedcc 100644 --- a/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg +++ b/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg @@ -35,30 +35,24 @@ - - - - - - - - - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 + + + + + + + +2 + +3 + +5 + +6 + +7 + +8 @@ -81,12 +75,12 @@ transcript_name - -a + +a - -a + +a SOD1-201 SOD1-202 With aes geom_junction_label_repel plot diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg index 184a79c..939dd45 100644 --- a/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg +++ b/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg @@ -32,17 +32,14 @@ - - - + + 2 - -4 - -6 - -8 + +6 + +8 @@ -58,18 +55,15 @@ - - - - - -1 - -3 - -5 - -7 + + + + +3 + +5 + +7 diff --git a/tests/testthat/_snaps/geom_range/with-aes-geom-range-plot.svg b/tests/testthat/_snaps/geom_range/with-aes-geom-range-plot.svg index 2acde06..8cfe2ae 100644 --- a/tests/testthat/_snaps/geom_range/with-aes-geom-range-plot.svg +++ b/tests/testthat/_snaps/geom_range/with-aes-geom-range-plot.svg @@ -48,9 +48,9 @@ tx - + - + A B With aes geom_range plot diff --git a/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx-no-group.svg b/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx-no-group.svg index cc9ab38..10d2331 100644 --- a/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx-no-group.svg +++ b/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx-no-group.svg @@ -21,92 +21,92 @@ - + - + - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + -PKNOX1-202 - - - - -42980000 -42990000 -43000000 -transcript_name +PKNOX1-202 + + + + +42980000 +42990000 +43000000 +transcript_name - + - + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + -PKNOX1-202 - - - - - -0 -200 -400 -600 -transcript_name +PKNOX1-202 + + + + + +0 +200 +400 +600 +transcript_name diff --git a/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx.svg b/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx.svg index cc9ab38..10d2331 100644 --- a/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx.svg +++ b/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot-1-tx.svg @@ -21,92 +21,92 @@ - + - + - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + -PKNOX1-202 - - - - -42980000 -42990000 -43000000 -transcript_name +PKNOX1-202 + + + + +42980000 +42990000 +43000000 +transcript_name - + - + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + -PKNOX1-202 - - - - - -0 -200 -400 -600 -transcript_name +PKNOX1-202 + + + + + +0 +200 +400 +600 +transcript_name diff --git a/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot.svg b/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot.svg index 5108960..35cee54 100644 --- a/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot.svg +++ b/tests/testthat/_snaps/shorten_gaps/pknox1-rescaled-plot.svg @@ -21,472 +21,472 @@ - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -PKNOX1-201 -PKNOX1-202 -PKNOX1-203 -PKNOX1-204 -PKNOX1-205 -PKNOX1-206 -PKNOX1-207 -PKNOX1-208 -PKNOX1-209 -PKNOX1-210 -PKNOX1-211 - - - - - - - - - - - - - - -42980000 -43000000 -43020000 -transcript_name +PKNOX1-201 +PKNOX1-202 +PKNOX1-203 +PKNOX1-204 +PKNOX1-205 +PKNOX1-206 +PKNOX1-207 +PKNOX1-208 +PKNOX1-209 +PKNOX1-210 +PKNOX1-211 + + + + + + + + + + + + + + +42980000 +43000000 +43020000 +transcript_name - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -PKNOX1-201 -PKNOX1-202 -PKNOX1-203 -PKNOX1-204 -PKNOX1-205 -PKNOX1-206 -PKNOX1-207 -PKNOX1-208 -PKNOX1-209 -PKNOX1-210 -PKNOX1-211 - - - - - - - - - - - - - - - -0 -2500 -5000 -7500 -transcript_name +PKNOX1-201 +PKNOX1-202 +PKNOX1-203 +PKNOX1-204 +PKNOX1-205 +PKNOX1-206 +PKNOX1-207 +PKNOX1-208 +PKNOX1-209 +PKNOX1-210 +PKNOX1-211 + + + + + + + + + + + + + + + +0 +2500 +5000 +7500 +transcript_name diff --git a/tests/testthat/_snaps/shorten_gaps/test-exons-rescaled-plot.svg b/tests/testthat/_snaps/shorten_gaps/test-exons-rescaled-plot.svg index 1752083..7a1ebd0 100644 --- a/tests/testthat/_snaps/shorten_gaps/test-exons-rescaled-plot.svg +++ b/tests/testthat/_snaps/shorten_gaps/test-exons-rescaled-plot.svg @@ -30,40 +30,40 @@ - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + -A -B - - - - - -200 -400 -600 -tx +A +B + + + + + +200 +400 +600 +tx @@ -76,38 +76,38 @@ - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + -A -B - - - - - -0 -200 -400 -tx +A +B + + + + + +0 +200 +400 +tx diff --git a/tests/testthat/_snaps/to_diff/multi-tx-diff-plot.svg b/tests/testthat/_snaps/to_diff/multi-tx-diff-plot.svg index 47157b7..ef17154 100644 --- a/tests/testthat/_snaps/to_diff/multi-tx-diff-plot.svg +++ b/tests/testthat/_snaps/to_diff/multi-tx-diff-plot.svg @@ -77,9 +77,9 @@ diff_type - + - + in_ref not_in_ref multi tx diff plot diff --git a/tests/testthat/test-add_utr.R b/tests/testthat/test-add_utr.R index 0c725cc..91e244f 100644 --- a/tests/testthat/test-add_utr.R +++ b/tests/testthat/test-add_utr.R @@ -92,10 +92,10 @@ plot_before_after_rescaled <- function(cds_utr_before, add_labels = FALSE) { before_rescaling <- cds_utr_before %>% dplyr::filter(type == "CDS") %>% - ggplot2::ggplot(ggplot2::aes_string( - xstart = "start", - xend = "end", - y = group_var + ggplot2::ggplot(ggplot2::aes( + xstart = start, + xend = end, + y = .data[[group_var]] )) + geom_range() + geom_range( @@ -109,10 +109,10 @@ plot_before_after_rescaled <- function(cds_utr_before, after_rescaling <- cds_utr_after %>% dplyr::filter(type == "CDS") %>% - ggplot2::ggplot(ggplot2::aes_string( - xstart = "start", - xend = "end", - y = group_var + ggplot2::ggplot(ggplot2::aes( + xstart = start, + xend = end, + y = .data[[group_var]] )) + geom_range() + geom_range( diff --git a/tests/testthat/test-geom_intron.R b/tests/testthat/test-geom_intron.R index 1521ef8..b8cf02b 100644 --- a/tests/testthat/test-geom_intron.R +++ b/tests/testthat/test-geom_intron.R @@ -23,9 +23,9 @@ testthat::test_that( base_geom_intron <- test_introns_plot + geom_intron() w_param_geom_intron <- test_introns_plot + - geom_intron(colour = "blue", size = 2) + geom_intron(colour = "blue", linewidth = 2) w_aes_geom_intron <- test_introns_plot + - geom_intron(aes(colour = tx, size = c(1L, 2L))) + geom_intron(aes(colour = tx, linewidth = c(1L, 2L))) w_facet_geom_intron <- test_introns_plot + geom_intron() + ggplot2::facet_wrap(~tx) diff --git a/tests/testthat/test-geom_junction.R b/tests/testthat/test-geom_junction.R index 5d569f4..288b11f 100644 --- a/tests/testthat/test-geom_junction.R +++ b/tests/testthat/test-geom_junction.R @@ -56,7 +56,7 @@ testthat::test_that( w_aes_param_top_junction.orientation <- test_introns_plot + geom_junction( aes(colour = transcript_name), - size = 1, + linewidth = 1, junction.orientation = "top" ) @@ -83,7 +83,7 @@ testthat::test_that( w_aes_param_junction.y.max_0.5 <- test_introns_plot + geom_junction( aes(colour = transcript_name), - size = 1, + linewidth = 1, junction.y.max = 0.5 ) w_facet_junction.y.max_0.5 <- test_introns_plot + diff --git a/tests/testthat/test-shorten_gaps.R b/tests/testthat/test-shorten_gaps.R index 47306c1..877fe35 100644 --- a/tests/testthat/test-shorten_gaps.R +++ b/tests/testthat/test-shorten_gaps.R @@ -232,10 +232,10 @@ plot_rescaled_tx <- function(exons, group_var, add_labels = FALSE) { before_rescaling <- exons %>% - ggplot2::ggplot(ggplot2::aes_string( - xstart = "start", - xend = "end", - y = group_var + ggplot2::ggplot(ggplot2::aes( + xstart = start, + xend = end, + y = .data[[group_var]] )) + geom_range() + geom_intron( @@ -246,10 +246,10 @@ plot_rescaled_tx <- function(exons, after_rescaling <- rescaled_tx %>% dplyr::filter(type == "exon") %>% - ggplot2::ggplot(ggplot2::aes_string( - xstart = "start", - xend = "end", - y = group_var + ggplot2::ggplot(ggplot2::aes( + xstart = start, + xend = end, + y = .data[[group_var]] )) + geom_range() + geom_intron( @@ -265,12 +265,12 @@ plot_rescaled_tx <- function(exons, for (i in seq_len(length(before_after_list))) { before_after_list[[i]] <- before_after_list[[i]] + ggrepel::geom_label_repel( - ggplot2::aes_string( - x = "end", - y = group_var, - label = "end" + ggplot2::aes( + x = end, + y = .data[[group_var]], + label = end ), - size = 2, + linewidth = 2, min.segment.length = 0 ) }