Skip to content

Commit

Permalink
Merge pull request #63 from stemangiola/reuse-connection
Browse files Browse the repository at this point in the history
Reuse connection
  • Loading branch information
stemangiola authored Feb 12, 2023
2 parents 6a9cfa7 + 2dd936b commit 0b54987
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Imports:
methods,
rlang,
stats,
RSQLite,
S4Vectors,
tibble,
utils,
Expand Down
3 changes: 3 additions & 0 deletions R/query.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ assay_map <- c(

#' Used in a pipeline to run one or more expressions with side effects, but
#' return the input value as the output value unaffected
#' @noRd
#' @param x The value to return
#' @param ... Expressions to evaluate
aside <- function(x, ...) {
# Courtesy of Hadley: https://fosstodon.org/@hadleywickham/109558265769090930
list(...)
Expand Down
22 changes: 13 additions & 9 deletions vignettes/Introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ knitr::opts_chunk$set(
```

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

## Load the package
Expand All @@ -37,13 +38,15 @@ library(stringr)
### Load the metadata

```{r}
get_metadata()
meta <- get_metadata()
```

The `meta` variable can then be re-used for all subsequent queries.

### Explore the tissue

```{r, eval=FALSE}
get_metadata() |>
meta |>
dplyr::distinct(tissue, file_id)
```

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

```{r}
single_cell_counts =
get_metadata() |>
meta |>
dplyr::filter(
ethnicity == "African" &
stringr::str_like(assay, "%10x%") &
Expand All @@ -108,7 +111,7 @@ single_cell_counts

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

```{r}
single_cell_counts =
get_metadata() |>
meta |>
dplyr::filter(
ethnicity == "African" &
stringr::str_like(assay, "%10x%") &
Expand All @@ -147,7 +150,7 @@ We can gather all natural killer cells and plot the distribution of CD56 (NCAM1)
library(tidySingleCellExperiment)
library(ggplot2)
get_metadata() |>
meta |>
# Filter and subset
filter(cell_type_harmonised=="nk") |>
Expand All @@ -172,7 +175,8 @@ get_metadata() |>
```

```{r, echo=FALSE, message=FALSE, warning=FALSE}
knitr::include_graphics("inst/NCAM1_figure.png")
system.file("NCAM1_figure.png", package="CuratedAtlasQueryR") |>
knitr::include_graphics()
```

# Cell metadata
Expand Down

0 comments on commit 0b54987

Please sign in to comment.