---
title: "ggspavis overview"
author: 
  - name: Lukas M. Weber
    affiliation: "Johns Hopkins Bloomberg School of Public Health, Baltimore, USA"
  - name: Helena L. Crowell
    affiliation: "University of Zurich, Zurich, Switzerland"
package: ggspavis
output: 
  BiocStyle::html_document
vignette: >
  %\VignetteIndexEntry{ggspavis overview}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


# Introduction

The `ggspavis` package contains a set of visualization functions for spatially resolved transcriptomics data, designed to work with the [SpatialExperiment](https://bioconductor.org/packages/SpatialExperiment) Bioconductor object class.

These plotting functions are used in our online book [OSTA](https://lmweber.org/OSTA-book/) and other work.


# Examples

Load some example datasets from the [STexampleData](https://bioconductor.org/packages/STexampleData) package and create some example plots.

```{r, message=FALSE}
library(SpatialExperiment)
library(STexampleData)
library(ggspavis)
```


## 10x Genomics Visium: mouse coronal brain section

```{r, message=FALSE}
# load data in SpatialExperiment format
spe <- Visium_mouseCoronal()
```

```{r, message=FALSE, out.width="60%"}
# add some values in 'colData' to annotate spots
colData(spe)$sum <- colSums(counts(spe))

# example plots
plotSpots(spe, annotate = "sum")
plotVisium(spe, fill = "sum", trans = "log", highlight = "in_tissue")
```


## 10x Genomics Visium: human brain (DLPFC)

```{r, message=FALSE}
# load data in SpatialExperiment format
spe <- Visium_humanDLPFC()
```

```{r, message=FALSE, out.width="60%"}
# example plots
plotSpots(spe, annotate = "ground_truth", palette = "libd_layer_colors")
plotVisium(spe, fill = "ground_truth", highlight = "in_tissue")
```


## seqFISH: mouse embryo

```{r, message=FALSE}
# load data in SpatialExperiment format
spe <- seqFISH_mouseEmbryo()
```

```{r, message=FALSE, out.width="60%"}
# example plots
plotMolecules(spe, molecule = "Sox2")
```

