knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(dplyr) library(scmisc) library(Seurat) set.seed(1)
This toy dataset contains 493 cells from mice in a SingleCellExperiment object.
x <- as.Seurat(sce) x
x <- NormalizeData(x, verbose = FALSE) x <- FindVariableFeatures(x, verbose = FALSE) x <- ScaleData(x, verbose = FALSE) x <- RunPCA(x, verbose = FALSE) x <- RunUMAP(x, dims = 1:10, verbose = FALSE) x <- FindNeighbors(x, verbose = FALSE) x <- FindClusters(x, verbose = FALSE) DimPlot(x, label = TRUE) + NoLegend()
deg <- FindAllMarkers(x, verbose = FALSE) head(deg)
db <- org.Mm.eg.db::org.Mm.eg.db deg <- deg |> mutate(entrezgene = AnnotationDbi::mapIds(db, deg$gene, "ENTREZID", "SYMBOL"))
res <- run_enrichment(deg, type = "kegg", org = "Mm") head(res)
res |> filter(adj.P.Up < 0.01) |> arrange(desc(Up)) res |> filter(adj.P.Down < 0.01) |> arrange(desc(Down))
plot_enrichment_barplot(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.