Contents

1 Introduction

hoodscanR is an user-friendly R package providing functions to assist cellular neighborhood analysis of any spatial transcriptomics data with single-cell resolution.

All functions in the package are built based on the SpatialExperiment infrastructure, allowing integration into various spatial transcriptomics-related packages from Bioconductor. The package can result in cell-level neighborhood annotation output, along with funtions to perform neighborhood colocalization analysis and neighborhood-based cell clustering.

2 Installation

if (!require("BiocManager", quietly = TRUE)) {
  install.packages("BiocManager")
}

BiocManager::install("hoodscanR")

The development version of hoodscanR can be installed from GitHub:

devtools::install_github("DavisLaboratory/hoodscanR")

3 Quick start

library(hoodscanR)
library(SpatialExperiment)
library(scico)

4 Data exploration

The readHoodData function can format the spatialExperiment input object as desired for all other functions in the hoodscanR package.

data("spe_test")

spe <- readHoodData(spe, anno_col = "celltypes")
spe
## class: SpatialExperiment 
## dim: 50 2661 
## metadata(1): dummy
## assays(1): counts
## rownames(50): MERTK MRC1 ... SAA2 FZD4
## rowData names(0):
## colnames(2661): Lung9_Rep1_5_5 Lung9_Rep1_5_6 ... Lung9_Rep1_5_4047
##   Lung9_Rep1_5_4052
## colData names(9): orig.ident nCount_RNA ... cell_annotation sample_id
## reducedDimNames(0):
## mainExpName: NULL
## altExpNames(0):
## spatialCoords names(2) : x y
## imgData names(0):
colData(spe)
## DataFrame with 2661 rows and 9 columns
##                   orig.ident nCount_RNA nFeature_RNA       fov      Area
##                     <factor>  <numeric>    <integer> <integer> <integer>
## Lung9_Rep1_5_5         Lung9        182          104         5      4377
## Lung9_Rep1_5_6         Lung9        447          214         5      4678
## Lung9_Rep1_5_7         Lung9        234          148         5      2236
## Lung9_Rep1_5_8         Lung9        118           69         5      4781
## Lung9_Rep1_5_14        Lung9        424          235         5      4385
## ...                      ...        ...          ...       ...       ...
## Lung9_Rep1_5_4040      Lung9         84           65         5      1720
## Lung9_Rep1_5_4041      Lung9        153          105         5      3418
## Lung9_Rep1_5_4045      Lung9         48           42         5      1735
## Lung9_Rep1_5_4047      Lung9         50           41         5      2101
## Lung9_Rep1_5_4052      Lung9         48           42         5       977
##                   AspectRatio       slide cell_annotation   sample_id
##                     <numeric> <character>     <character> <character>
## Lung9_Rep1_5_5           1.15  Lung9_Rep1     Tumor.cells    sample01
## Lung9_Rep1_5_6           0.98  Lung9_Rep1     Tumor.cells    sample01
## Lung9_Rep1_5_7           1.29  Lung9_Rep1     Tumor.cells    sample01
## Lung9_Rep1_5_8           1.74  Lung9_Rep1         Stromal    sample01
## Lung9_Rep1_5_14          1.11  Lung9_Rep1     Tumor.cells    sample01
## ...                       ...         ...             ...         ...
## Lung9_Rep1_5_4040        0.87  Lung9_Rep1 Epithelial.cell    sample01
## Lung9_Rep1_5_4041        2.89  Lung9_Rep1  Dividing.cells    sample01
## Lung9_Rep1_5_4045        1.45  Lung9_Rep1     Tumor.cells    sample01
## Lung9_Rep1_5_4047        2.97  Lung9_Rep1 Epithelial.cell    sample01
## Lung9_Rep1_5_4052        2.22  Lung9_Rep1 Epithelial.cell    sample01

We can have a look at the tissue and cell positions by using the function plotTissue.

The test data is relatively sparse with low-level cell type annotations.

col.pal <- c("red3", "royalblue", "gold", "cyan2", "purple3", "darkgreen")

plotTissue(spe, color = cell_annotation, size = 1.5, alpha = 0.8) +
  scale_color_manual(values = col.pal)