Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions module-cheatsheets/spatial-cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Spatial Transcriptomics Cheatsheet

#### The tables below consist of valuable functions or commands that will help you through this module.
##### Each table represents a different library/tool and its corresponding commands.
> Please note that these tables are not intended to tell you all the information you need to know about each command.
>
> The hyperlinks found in each piece of code will take you to the documentation for further information on the usage of each command.
> Please be aware that the documentation will generally provide information about the given function's most current version (or a recent version, depending on how often the documentation site is updated).
This will usually (but not always!) match what you have installed on your machine.
If you have a different version of R or other R packages, the documentation may differ from what you have installed.


<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [`SpatialExperiment`](#spatialexperiment)
- [`VisiumIO`](#visiumio)
- [`ggspavis`](#ggspavis)
- [`SpotSweeper`](#spotsweeper)
- [`scuttle`](#scuttle)
- [`patchwork`](#patchwork)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

<div style="page-break-after: always;"></div>


### `SpatialExperiment`


Read the [`SpatialExperiment` package documentation (and e-book)](https://bioconductor.org/books/release/OSTA/) and a [vignette on its usage](https://www.bioconductor.org/packages/release/bioc/vignettes/SpatialExperiment/inst/doc/SpatialExperiment.html).

`SpatialExperiment` objects are based on [`SingleCellExperiment` objects](https://bioconductor.org/books/release/OSCA/).
There are many functions that are shared between the two, with equivalent usage.
See [this `SingleCellExperiment` vignette](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html) for example usage of shared functions.
You can also refer to the Data Lab cheatsheets for our "Introduction to scRNA-seq" (`scRNA-seq-cheatsheet.pdf`) and "Advanced scRNA-seq" (`scRNA-seq-advanced-cheatsheet.pdf`) training modules.



| Library/Package | Piece of Code | What it's called | What it does |
|----------------------|----------------------------|--------------------------------------------|--------------------------------------------------------------|
| `SpatialExperiment` | [`SpatialExperiment()`](https://www.bioconductor.org/packages/release/bioc/vignettes/SpatialExperiment/inst/doc/SpatialExperiment.html) | Spatial Experiment| Creates a `SpatialExperiment` object |
| `SpatialExperiment` | [`spatialCoords()`](https://www.bioconductor.org/packages/release/bioc/vignettes/SpatialExperiment/inst/doc/SpatialExperiment.html#13_spatialCoords) | Spatial Experiment coordinates | Extracts spatial coordinates of spots in the `SpatialExperiment` object |
| `SpatialExperiment` | [`imgData()`](https://www.bioconductor.org/packages/release/bioc/vignettes/SpatialExperiment/inst/doc/SpatialExperiment.html#14_imgData) | Spatial Experiment images | View the image data associated with a `SpatialExperiment` object |




### `VisiumIO`

<!-- TODO: This package has not yet made it to rdrr -->
Read the R package [`VisiumIO` documentation](https://www.bioconductor.org/packages/release/bioc/html/VisiumIO.html) and a [vignette on its usage](https://www.bioconductor.org/packages/release/bioc/vignettes/VisiumIO/inst/doc/VisiumIO.html).

|Library/Package|Piece of Code|What it's called| What it does|
|---------------|-------------|----------------|-------------|
| `VisiumIO` | [`TENxVisium()`](https://www.bioconductor.org/packages/release/bioc/vignettes/VisiumIO/inst/doc/VisiumIO.html#tenxvisium) | 10x Visium | Constructor function for importing 10x Visium data |
| `VisiumIO`| [`import()`](https://www.bioconductor.org/packages/release/bioc/vignettes/VisiumIO/inst/doc/VisiumIO.html#importing-into-spatialexperiment) | Import | Loads 10x Visium data defined with the `TENxVisium()` constructor function |




### `ggspavis`

<!-- TODO: This package has not yet made it to rdrr -->
Read the [`ggspavis` package documentation](https://www.bioconductor.org/packages/release/bioc/html/ggspavis.html) and a [vignette on its usage](https://www.bioconductor.org/packages/release/bioc/vignettes/ggspavis/inst/doc/ggspavis_overview.html).



| Library/Package | Piece of Code | What it's called | What it does |
|----------------------|----------------------------|--------------------------------------------|--------------------------------------------------------------|
| `ggspavis` | [`plotCoords()`](https://www.bioconductor.org/packages/release/bioc/vignettes/ggspavis/inst/doc/ggspavis_overview.html#spot-shape---slide-seq-and-visium) | Plot coordinates | Creates a spot plot showing spatial locations in x/y with options for spot annotation |
| `ggspavis` | [`plotVisium()`](https://www.bioconductor.org/packages/release/bioc/vignettes/ggspavis/inst/doc/ggspavis_overview.html#spot-shape---slide-seq-and-visium) | Plot Visium | Creates a spot plot for Visium data specifically showing spatial locations in x/y with options for spot annotation as well as an option to show the spatial image, e.g., the H&E image |


<div style="page-break-after: always;"></div>



### `SpotSweeper`


<!-- TODO: This package has not yet made it to rdrr -->
Read the [`SpotSweeper` package documentation](https://www.bioconductor.org/packages/release/bioc/html/SpotSweeper.html) and a [vignette on its usage](https://www.bioconductor.org/packages/release/bioc/vignettes/SpotSweeper/inst/doc/getting_started.html).



| Library/Package | Piece of Code | What it's called | What it does |
|----------------------|----------------------------|--------------------------------------------|--------------------------------------------------------------|
| `SpotSweeper` | [`localOutliers()`](https://www.bioconductor.org/packages/release/bioc/vignettes/SpotSweeper/inst/doc/getting_started.html#identifying-local-outliers-using-spotsweeper) | Local outliers | Detect local outlier spots in a `SpatialExperiment` based on a given quality control metric |
| `SpotSweeper`| [`plotQCmetrics()`](https://www.bioconductor.org/packages/release/bioc/vignettes/SpotSweeper/inst/doc/getting_started.html#visualizing-local-outliers)| Plot QC metrics | Create a spot plot highlighting outliers detected with `SpotSweeper::localOutliers()` |




### `scuttle`


Read the [`scuttle` package documentation](https://rdrr.io/bioc/scuttle/), and a [vignette on its usage](https://rdrr.io/bioc/scuttle/f/vignettes/overview.Rmd).


| Library/Package | Piece of Code | What it's called | What it does |
|----------------------|----------------------------|--------------------------------------------|--------------------------------------------------------------|
| `scuttle` | [`computeLibraryFactors()`](https://rdrr.io/bioc/scuttle/man/librarySizeFactors.html) | Compute Library Factors | Returns a numeric vector of computed size factors for each spot (or cell) stored in a `SpatialExperiment` (or `SingleCellExperiment`) object. The size factor is computed as the library size of each spot/cell after scaling them to have a mean of 1 across all spots/cells |
| `scuttle`| [`logNormCounts()`](https://rdrr.io/bioc/scuttle/man/logNormCounts.html)| Normalize log counts | Returns the `SpatialExperiment` (or `SingleCellExperiment`) object with normalized expression values for each spot (cell), using the size factors stored in the object |


### `patchwork`


Read the [`patchwork` package documentation](https://rdrr.io/cran/patchwork), and a [vignette on its usage](https://patchwork.data-imaginist.com/articles/patchwork.html).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to add just a bit about the basic operators like + and /?



| Library/Package | Piece of Code | What it's called | What it does |
|----------------------|----------------------------|--------------------------------------------|--------------------------------------------------------------|
| `patchwork` | [`wrap_plots()`](https://rdrr.io/cran/patchwork/man/wrap_plots.html) | Wrap plots | Wrap multiple `ggplot2` objects into a single multi-panel plot |
| `patchwork` | [`+`](https://rdrr.io/cran/patchwork/man/wrap_plots.html) | Plot arithmetic | Place `ggplot2` objects side-by-side by adding them together with a `+`. The `patchwork` package must be loaded to use this symbol with plots |
| `patchwork` | [`/`](https://rdrr.io/cran/patchwork/man/wrap_plots.html) | Plot arithmetic | Stack `ggplot2` objects on top of one another "dividing" them with a `/`. The `patchwork` package must be loaded to use this symbol with plots |
Binary file added module-cheatsheets/spatial-cheatsheet.pdf
Binary file not shown.
Loading