Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit a338712

Browse files
committed
Merge branch 'master' of github.com:stemangiola/CuratedAtlasQueryR
Conflicts: DESCRIPTION
2 parents 338c973 + fe5c738 commit a338712

File tree

6 files changed

+153
-63
lines changed

6 files changed

+153
-63
lines changed

.github/workflows/check-bioc.yml

Lines changed: 113 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ env:
3838
run_covr: 'false'
3939
run_pkgdown: 'true'
4040
has_RUnit: 'false'
41-
cache-version: 'cache-v2'
41+
cache-version: 'cache-v1'
42+
run_docker: 'false'
4243

4344
jobs:
4445
build-check:
@@ -48,12 +49,14 @@ jobs:
4849
## Environment variables unique to this job.
4950

5051
strategy:
51-
fail-fast: true
52+
fail-fast: false
5253
matrix:
5354
config:
54-
- { os: ubuntu-latest, r: '4.2', bioc: '3.16', cont: "bioconductor/bioconductor_docker:RELEASE_3_16", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
55-
- { os: macOS-latest, r: '4.2', bioc: '3.16'}
56-
- { os: windows-latest, r: '4.2', bioc: '3.16'}
55+
- { os: ubuntu-latest, r: '4.3', bioc: '3.19', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
56+
- { os: macOS-latest, r: '4.3', bioc: '3.18'}
57+
- { os: windows-latest, r: '4.3', bioc: '3.18'}
58+
## Check https://github.com/r-lib/actions/tree/master/examples
59+
## for examples using the http-user-agent
5760
env:
5861
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
5962
RSPM: ${{ matrix.config.rspm }}
@@ -76,14 +79,15 @@ jobs:
7679
## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
7780
## If they update their steps, we will also need to update ours.
7881
- name: Checkout Repository
79-
uses: actions/checkout@v2
82+
uses: actions/checkout@v3
8083

8184
## R is already included in the Bioconductor docker images
8285
- name: Setup R from r-lib
8386
if: runner.os != 'Linux'
8487
uses: r-lib/actions/setup-r@v2
8588
with:
8689
r-version: ${{ matrix.config.r }}
90+
http-user-agent: ${{ matrix.config.http-user-agent }}
8791

8892
## pandoc is already included in the Bioconductor docker images
8993
- name: Setup pandoc from r-lib
@@ -96,26 +100,28 @@ jobs:
96100
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
97101
shell: Rscript {0}
98102

99-
- name: Cache R packages
103+
- name: Restore R package cache
100104
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'"
101-
uses: actions/cache@v2
105+
uses: actions/cache@v3
102106
with:
103107
path: ${{ env.R_LIBS_USER }}
104-
key: "${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_${{ matrix.config.bioc }}r-{{ matrix.config.r }}"
108+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.3-${{ hashFiles('.github/depends.Rds') }}
109+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.3-
105110

106111
- name: Cache R packages on Linux
107112
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
108-
uses: actions/cache@v2
113+
uses: actions/cache@v3
109114
with:
110115
path: /home/runner/work/_temp/Library
111-
key: "${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_${{ matrix.config.bioc }}r-{{ matrix.config.r }}"
116+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.3-${{ hashFiles('.github/depends.Rds') }}
117+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.3-
112118

113-
- name: Install Linux system dependencies
114-
if: runner.os == 'Linux'
115-
run: |
116-
sysreqs=$(Rscript -e 'cat("apt-get update -y && apt-get install -y", paste(gsub("apt-get install -y ", "", remotes::system_requirements("ubuntu", "20.04")), collapse = " "))')
117-
echo $sysreqs
118-
sudo -s eval "$sysreqs"
119+
# - name: Install Linux system dependencies
120+
# if: runner.os == 'Linux'
121+
# run: |
122+
# sysreqs=$(Rscript -e 'cat("apt-get update -y && apt-get install -y", paste(gsub("apt-get install -y ", "", remotes::system_requirements("ubuntu", "20.04")), collapse = " "))')
123+
# echo $sysreqs
124+
# sudo -s eval "$sysreqs"
119125

120126
- name: Install macOS system dependencies
121127
if: matrix.config.os == 'macOS-latest'
@@ -133,10 +139,9 @@ jobs:
133139
134140
## For installing usethis's dependency gert
135141
brew install libgit2
136-
137-
## To fix x11/cairo error with tidyHeatmap/Complexheatmap here https://github.com/stemangiola/tidybulk/runs/1388237421?check_suite_focus=true#step:14:2134
138-
## Suggested here https://stackoverflow.com/questions/63648591/how-to-install-x11-before-testing-with-github-actions-for-macos
139-
brew install --cask xquartz
142+
143+
## Required for tcltk
144+
brew install xquartz --cask
140145
141146
- name: Install Windows system dependencies
142147
if: runner.os == 'Windows'
@@ -147,12 +152,12 @@ jobs:
147152
- name: Install BiocManager
148153
run: |
149154
message(paste('****', Sys.time(), 'installing BiocManager ****'))
150-
remotes::install_github("Bioconductor/BiocManager")
155+
remotes::install_cran("BiocManager")
151156
shell: Rscript {0}
152157

153158
- name: Set BiocVersion
154159
run: |
155-
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE)
160+
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE, force = TRUE)
156161
shell: Rscript {0}
157162

158163
- name: Install dependencies pass 1
@@ -164,6 +169,10 @@ jobs:
164169
## https://github.com/r-lib/remotes/issues/296
165170
## Ideally, all dependencies should get installed in the first pass.
166171
172+
## For running the checks
173+
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
174+
install.packages(c("rcmdcheck", "BiocCheck"), repos = BiocManager::repositories())
175+
167176
## Pass #1 at installing dependencies
168177
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
169178
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE)
@@ -174,21 +183,7 @@ jobs:
174183
run: |
175184
## Pass #2 at installing dependencies
176185
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
177-
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE)
178-
179-
## For running the checks
180-
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
181-
remotes::install_cran("rcmdcheck")
182-
BiocManager::install("BiocCheck")
183-
shell: Rscript {0}
184-
185-
# This is a hack to fix this bug: https://stackoverflow.com/q/73700130/2148718
186-
# Basically the Seurat and SeuratObject binary packages are compiled against an
187-
# older version of Matrix, which causes an error we can fix by re-compiling from source
188-
- name: Fix Matrix on MacOS.
189-
if: matrix.config.os == 'macOS-latest'
190-
run: |
191-
install.packages(c("Seurat", "SeuratObject"), type="source")
186+
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE, force = TRUE)
192187
shell: Rscript {0}
193188

194189
- name: Install BiocGenerics
@@ -199,15 +194,15 @@ jobs:
199194
shell: Rscript {0}
200195

201196
- name: Install covr
202-
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
197+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
203198
run: |
204199
remotes::install_cran("covr")
205200
shell: Rscript {0}
206201

207202
- name: Install pkgdown
208-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
203+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
209204
run: |
210-
remotes::install_cran("pkgdown")
205+
remotes::install_github("r-lib/pkgdown")
211206
shell: Rscript {0}
212207

213208
- name: Session info
@@ -220,10 +215,12 @@ jobs:
220215
- name: Run CMD check
221216
env:
222217
_R_CHECK_CRAN_INCOMING_: false
218+
DISPLAY: 99.0
223219
run: |
220+
options(crayon.enabled = TRUE)
224221
rcmdcheck::rcmdcheck(
225-
args = c("--no-manual", "--timings"),
226-
build_args = c("--no-manual", "--no-resave-data"),
222+
args = c("--no-manual", "--no-vignettes", "--timings"),
223+
build_args = c("--no-manual", "--keep-empty-dirs", "--no-resave-data"),
227224
error_on = "warning",
228225
check_dir = "check"
229226
)
@@ -241,45 +238,101 @@ jobs:
241238
shell: Rscript {0}
242239

243240
- name: Run BiocCheck
241+
env:
242+
DISPLAY: 99.0
244243
run: |
245244
BiocCheck::BiocCheck(
246245
dir('check', 'tar.gz$', full.names = TRUE),
247246
`quit-with-status` = TRUE,
248247
`no-check-R-ver` = TRUE,
249-
`no-check-bioc-help` = TRUE,
250-
`new-package` = TRUE
248+
`no-check-bioc-help` = TRUE
251249
)
252250
shell: Rscript {0}
253251

254252
- name: Test coverage
255-
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
253+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
256254
run: |
257255
covr::codecov()
258256
shell: Rscript {0}
259257

260258
- name: Install package
261-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
259+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
262260
run: R CMD INSTALL .
263261

264-
- name: Deploy package
265-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
266-
run: |
267-
## Temporary workaround for https://github.com/actions/checkout/issues/766
268-
git config --global --add safe.directory "$GITHUB_WORKSPACE"
269-
270-
git config --local user.email "[email protected]"
271-
git config --local user.name "GitHub Actions"
272-
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
273-
shell: bash {0}
262+
- name: Build pkgdown site
263+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
264+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
265+
shell: Rscript {0}
274266
## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)
275267
## at least one locally before this will work. This creates the gh-pages
276268
## branch (erasing anything you haven't version controlled!) and
277269
## makes the git history recognizable by pkgdown.
278270

271+
- name: Install deploy dependencies
272+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
273+
run: |
274+
apt-get update && apt-get -y install rsync
275+
276+
- name: Deploy pkgdown site to GitHub pages 🚀
277+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
278+
uses: JamesIves/github-pages-deploy-action@releases/v4
279+
with:
280+
clean: false
281+
branch: gh-pages
282+
folder: docs
283+
279284
- name: Upload check results
280285
if: failure()
281-
uses: actions/upload-artifact@v2
286+
uses: actions/upload-artifact@master
282287
with:
283-
name: ${{ runner.os }}-biocversion-RELEASE_3_15-r-4.2-results
288+
name: ${{ runner.os }}-biocversion-devel-r-4.3-results
284289
path: check
285-
290+
291+
292+
## Code adapted from
293+
## https://github.com/waldronlab/cBioPortalData/blob/e0440a4445f0cc731e426363a76faa22ee5e0f9d/.github/workflows/devel_check_dock.yml#L65-L92
294+
docker-build-and-push:
295+
runs-on: ubuntu-latest
296+
needs: build-check
297+
steps:
298+
- name: Checkout Repository
299+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
300+
uses: actions/checkout@v3
301+
302+
- name: Register repo name
303+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
304+
id: reg_repo_name
305+
run: |
306+
echo CONT_IMG_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
307+
308+
- name: Set up QEMU
309+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
310+
uses: docker/setup-qemu-action@v2
311+
312+
- name: Set up Docker Buildx
313+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
314+
uses: docker/setup-buildx-action@v2
315+
316+
- name: Login to Docker Hub
317+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
318+
uses: docker/login-action@v2
319+
with:
320+
username: ${{ secrets.DOCKERHUB_USERNAME }}
321+
password: ${{ secrets.DOCKERHUB_TOKEN }}
322+
## Note that DOCKERHUB_TOKEN is really a token for your dockerhub
323+
## account, not your actual dockerhub account password. You can get it
324+
## from https://hub.docker.com/settings/security.
325+
## Check https://github.com/docker/build-push-action/tree/v4.0.0
326+
## for more details.
327+
## Alternatively, try checking
328+
## https://seandavi.github.io/BuildABiocWorkshop/articles/HOWTO_BUILD_WORKSHOP.html.
329+
330+
- name: Build and Push Docker
331+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel' && success()"
332+
uses: docker/build-push-action@v4
333+
with:
334+
context: .
335+
push: true
336+
tags: >
337+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:latest,
338+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:devel

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ importFrom(cli,cli_alert_success)
3030
importFrom(cli,cli_alert_warning)
3131
importFrom(cli,hash_sha256)
3232
importFrom(dbplyr,remote_con)
33+
importFrom(dbplyr,sql)
3334
importFrom(dplyr,as_tibble)
3435
importFrom(dplyr,collect)
3536
importFrom(dplyr,filter)

R/metadata.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ SAMPLE_DATABASE_URL <- single_line_str(
6767
#' @importFrom dplyr tbl
6868
#' @importFrom httr progress
6969
#' @importFrom cli cli_alert_info hash_sha256
70+
#' @importFrom glue glue
7071
#'
7172
#' @details
7273
#'
@@ -162,10 +163,10 @@ get_metadata <- function(
162163
progress(type = "down", con = stderr())
163164
)
164165
}
165-
166+
166167
table <- duckdb() |>
167168
dbConnect(drv = _, read_only = TRUE) |>
168-
tbl(db_path)
169+
read_parquet(db_path)
169170
cache$metadata_table[[hash]] <- table
170171
table
171172
}

R/unharmonised.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ get_unharmonised_dataset <- function(
6464
local_path,
6565
progress(type = "down", con = stderr())
6666
)
67-
tbl(conn, local_path) |>
67+
68+
read_parquet(conn, local_path) |>
6869
filter(.data$cell_ %in% cells)
6970
}
7071

R/utils.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,20 @@ sync_remote_file <- function(full_url, output_file, ...) {
8080
}
8181
invisible(NULL)
8282
}
83+
84+
#' Returns a tibble from a parquet file path
85+
#'
86+
#' Since dbplyr 2.4.0, raw file paths aren't handled very well
87+
#' See: https://github.com/duckdb/duckdb-r/issues/38
88+
#' Hence the need for this method
89+
#' @importFrom glue glue
90+
#' @importFrom dplyr tbl
91+
#' @importFrom dbplyr sql
92+
#' @return An SQL data frame
93+
#' @keywords internal
94+
read_parquet <- function(conn, path){
95+
from_clause <- glue("FROM read_parquet('{path}')") |> sql()
96+
tbl(conn, from_clause)
97+
}
98+
99+

man/read_parquet.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)