library(here)
library(Seurat)
library(singleCellHaystack)

knitr::opts_chunk$set(
  fig.path="figures/a05-",
    fig.align="center",
    fig.width=8,
    fig.height=6,
    message=FALSE,
    warning=TRUE
)

set.seed(1)

Load data

Here we apply haystack to 100k cells from the Mouse Organogenesis Cell Atlas (MOCA). The sparse matrix data was downloaded from the MOCA website. The data was converted into a Seurat object and processed following the standard pipeline.

library(here)
library(Seurat)
library(singleCellHaystack)
x <- readRDS(here("data-raw/data/moca_100k.rds"))
x
DimPlot(x, label = TRUE) + NoLegend() + NoAxes()

Haystack

We run haystack using PCA coordinates with 50 PCs.

system.time({
  res <- haystack(x, coord="pca")
})
r <- system.time({
  res <- haystack(x, coord="pca")
})
r

It takes around r format(unname(r)[3] / 60, digits=1) minutes to complete in a standard personal computer. Here we show the top 10 genes selected by haystack.

top <- show_result_haystack(res)
head(top, n=10)

And here we plot the expression of the top 4 genes.

FeaturePlot(x, head(rownames(top), 4), order=TRUE) & NoAxes()


alexisvdb/singleCellHaystack documentation built on Jan. 17, 2024, 10:45 a.m.