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

Commit 0b54987

Browse files
authored
Merge pull request #63 from stemangiola/reuse-connection
Reuse connection
2 parents 6a9cfa7 + 2dd936b commit 0b54987

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Imports:
3636
methods,
3737
rlang,
3838
stats,
39-
RSQLite,
4039
S4Vectors,
4140
tibble,
4241
utils,

R/query.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ assay_map <- c(
1212

1313
#' Used in a pipeline to run one or more expressions with side effects, but
1414
#' return the input value as the output value unaffected
15+
#' @noRd
16+
#' @param x The value to return
17+
#' @param ... Expressions to evaluate
1518
aside <- function(x, ...) {
1619
# Courtesy of Hadley: https://fosstodon.org/@hadleywickham/109558265769090930
1720
list(...)

vignettes/Introduction.Rmd

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ knitr::opts_chunk$set(
2121
```
2222

2323
```{r, echo=FALSE, out.height = "139px", out.width = "120px"}
24-
knitr::include_graphics("inst/logo.png")
24+
system.file("logo.png", package="CuratedAtlasQueryR") |>
25+
knitr::include_graphics()
2526
```
2627

2728
## Load the package
@@ -37,13 +38,15 @@ library(stringr)
3738
### Load the metadata
3839

3940
```{r}
40-
get_metadata()
41+
meta <- get_metadata()
4142
```
4243

44+
The `meta` variable can then be re-used for all subsequent queries.
45+
4346
### Explore the tissue
4447

4548
```{r, eval=FALSE}
46-
get_metadata() |>
49+
meta |>
4750
dplyr::distinct(tissue, file_id)
4851
```
4952

@@ -74,7 +77,7 @@ get_metadata() |>
7477
```{r}
7578
7679
single_cell_counts =
77-
get_metadata() |>
80+
meta |>
7881
dplyr::filter(
7982
ethnicity == "African" &
8083
stringr::str_like(assay, "%10x%") &
@@ -92,7 +95,7 @@ This is helpful if just few genes are of interest, as they can be compared acros
9295

9396
```{r}
9497
single_cell_counts =
95-
get_metadata() |>
98+
meta |>
9699
dplyr::filter(
97100
ethnicity == "African" &
98101
stringr::str_like(assay, "%10x%") &
@@ -108,7 +111,7 @@ single_cell_counts
108111

109112
```{r}
110113
single_cell_counts =
111-
get_metadata() |>
114+
meta |>
112115
dplyr::filter(
113116
ethnicity == "African" &
114117
stringr::str_like(assay, "%10x%") &
@@ -127,7 +130,7 @@ This convert the H5 SingleCellExperiment to Seurat so it might take long time an
127130

128131
```{r}
129132
single_cell_counts =
130-
get_metadata() |>
133+
meta |>
131134
dplyr::filter(
132135
ethnicity == "African" &
133136
stringr::str_like(assay, "%10x%") &
@@ -147,7 +150,7 @@ We can gather all natural killer cells and plot the distribution of CD56 (NCAM1)
147150
library(tidySingleCellExperiment)
148151
library(ggplot2)
149152
150-
get_metadata() |>
153+
meta |>
151154
152155
# Filter and subset
153156
filter(cell_type_harmonised=="nk") |>
@@ -172,7 +175,8 @@ get_metadata() |>
172175
```
173176

174177
```{r, echo=FALSE, message=FALSE, warning=FALSE}
175-
knitr::include_graphics("inst/NCAM1_figure.png")
178+
system.file("NCAM1_figure.png", package="CuratedAtlasQueryR") |>
179+
knitr::include_graphics()
176180
```
177181

178182
# Cell metadata

0 commit comments

Comments
 (0)