Skip to content

Commit e529d02

Browse files
committed
Add an example of spe_add_info() in a vignette
1 parent 27964d6 commit e529d02

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

R/spe_add_info.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
#' @return A [SpatialExperiment-class][SpatialExperiment::SpatialExperiment-class]
1313
#' object with gene info, SpaceRanger analysis results, and other information
1414
#' attached.
15+
#'
16+
#' @examples
17+
#' ## See 'Using spatialLIBD with 10x Genomics public datasets' for
18+
#' ## a full example using this function.
19+
#' if (interactive()) {
20+
#' browseVignettes(package = "spatialLIBD")
21+
#' }
1522
spe_add_info <- function(
1623
spe,
1724
samples,

man/spe_add_info.Rd

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

vignettes/TenX_data_download.Rmd

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ list.files(docs_path)
452452

453453
# Wrapper functions
454454

455+
## read10xVisiumWrapper
456+
455457
To facilitate reading in the data and preparing it to visualize it interactively using `spatialLIBD::run_app()`, we implemented `read10xVisiumWrapper()` which expands `SpatialExperiment::read10xVisium()` and performs the steps described in this vignette. In this example, we'll load all four images created by SpaceRanger: lowres, hires, detected, and aligned. That way we can toggle between them on the web application.
456458

457459
```{r wrapper_functions}
@@ -483,6 +485,32 @@ if (interactive()) {
483485
}
484486
```
485487

488+
## spe_add_info
489+
490+
Alternatively, you may already have a `SpatialExperiment` object, and simply
491+
want to prepare it for `spatialLIBD::run_app()`. In this case, you may use
492+
`spatialLIBD::spe_add_info()`, which wraps around the preparation steps
493+
discussed above.
494+
495+
```{r spe_add_info}
496+
## Read in as a SpatialExperiment object. You may also consider something like
497+
## VisiumIO::TENxVisiumList() and VisiumIO::import()
498+
spe_wrapper2 <- read10xVisium(
499+
samples = file.path(tempdir(), "outs"),
500+
sample_id = "lymph",
501+
type = "sparse", data = "filtered",
502+
images = c("lowres", "hires", "detected", "aligned"), load = TRUE
503+
)
504+
505+
## Here we add the additional info needed by spatialLIBD::run_app()
506+
spe_wrapper2 <- spe_add_info(
507+
spe_wrapper2,
508+
samples = file.path(tempdir(), "outs"),
509+
sample_id = "lymph",
510+
reference_gtf = gtf_cache
511+
)
512+
```
513+
486514
# Publishing your web application
487515

488516
Now we have have our `spe_wrapper` object and have verified that the web application works, we can share it with others through [shinyapps.io](https://www.shinyapps.io/) by RStudio if our data is small enough. To do, you will need to:

0 commit comments

Comments
 (0)