spanielPlot {Spaniel} | R Documentation

## Spatial Transcriptomics Plot

### Description

This function overlays information from a Seurat object or SingleCellExperiment object containing barcodes onto a H & E image. There are 4 plots available showing a) the number of genes detected per spot, b) the number of reads detected per spot, c) clustering results, d) the gene expression of a selected gene.

### Usage

    spanielPlot(object, grob, plotType = c("NoGenes",
                                                "CountsPerSpot",
                                                "Cluster",
                                                "Gene"),
                    gene= NULL, clusterRes = NULL, customTitle = NULL,
                    scaleData = TRUE, showFilter = NULL, ptSize = 2,
                    ptSizeMin = 0, ptSizeMax = 5)

### Arguments

`object` | Either a Seurat object (version 3) or a SingleCellExperiment object containing barcode coordinates in the metadata (Seurat) or colData (SingleCellExperiment).
`grob` | an grob to be used as the backgound image see(parseImage)
`plotType` | There are 5 types of plots avaiable: 1) NoGenes - This shows the number of genes per spot and uses information from "nFeature_RNA" column of Seurat object or "detected" from a SingleCellExperiment object. 2) CountsPerSpot - This shows the number of counts per spot. It uses information from "nCount_RNA" column of Seurat object or "sum" from a singleCellExperiment object. 3) Cluster - This plot is designed to show clustering results stored in the meta.data or colData of an object 4) Gene- This plot shows the expression of a single gene. This plot uses scaled/normalised expressin data from the scale.data slot of Seurat object or logcounts of a SingleCellExperiment object. 5) Other - A generic plot to plot any column from the meta.data or colData of an object.
`gene` | Gene to plot
`clusterRes` | which cluster resolution to plot
`customTitle` | Specify plot title (optional)
`scaleData` | Show scaled data on plot (default is TRUE)
`showFilter` | Logical filter showing pass/fail for spots
`ptSize` | Point size used for cluster plot default is 2
`ptSizeMin` | Minimum point size used for QC and Gene Expression plots default is 0
`ptSizeMax` | Maximum point size used for QC and Gene Expression plots default is 5

### Value

A ggplot spatial transcriptomics plot

### Examples

    ## Data is taken from DOI: 10.1126/science.aaf2403
    SeuratObj <- readRDS(file.path(system.file(package = "Spaniel"),
                            "extdata/SeuratData.rds"))
    imgFile <- readRDS(file.path(system.file(package = "Spaniel"),
                            "extdata/image.rds"))

    ## Counts per spot with a QC filter
    minGenes <- 2000
    minUMI <- 300000
    filter <- SeuratObj$nFeature_RNA > minGenes &
                SeuratObj$nCount_RNA > minUMI
    spanielPlot(object = SeuratObj, grob = imgFile,
            plotType = "CountsPerSpot",
            showFilter = filter)

    ## Cluster plot
    spanielPlot(object = SeuratObj, grob = imgFile,
            plotType = "Cluster",
            clusterRes = "cluster_RNA_snn_res.0.6")

    ## Gene plot
    spanielPlot(object = SeuratObj, grob = imgFile,
            plotType = "Gene",
            gene= "Nrgn")

[Package Spaniel version 1.4.0 Index]