Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0: update ggtranscript to work with the latest versions of R, ggplot2 and ggrepel #14

Merged
merged 17 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 7 additions & 82 deletions .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}
Expand All @@ -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: |
Expand All @@ -102,15 +63,15 @@ 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') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_14-r-4.1-

- 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') }}
Expand All @@ -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 ****'))
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions R/geom_intron.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = "+"
Expand Down
20 changes: 10 additions & 10 deletions R/geom_junction.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>%
Expand All @@ -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",
Expand Down Expand Up @@ -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,
Expand All @@ -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)
))
}

Expand Down
6 changes: 3 additions & 3 deletions R/geom_range.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/ggtranscript-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#'
#' @docType package
#' @name ggtranscript
NULL
"_PACKAGE"

#' @importFrom rlang %||%
#' @importFrom magrittr %>%
Expand Down
2 changes: 1 addition & 1 deletion R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ utils::globalVariables(c(
"x_points",
"y_points",
"y",
"y_orig",
"y_original",
"position_nudge_repel",
# add_utr(),
"dummy_group"
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,4 @@ citation("ggtranscript")

## Credits

* `ggtranscript` was developed using `r BiocStyle::Biocpkg("biocthis")`.
* `ggtranscript` was developed using `biocthis`.
Loading
Loading