knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
You can view an example script for this workflow by running the following command
file.show(system.file(package = 'easybio', 'example-single-cell.R'))
The example marker data from pbmc3k datasets:
library(easybio) head(pbmc.markers)
(marker <- matchCellMarker2(marker = pbmc.markers, n = 50, spc = 'Human')[, head(.SD, 2), by=cluster])
plotPossibleCell(marker)
Explanation:
The function matches the top 50 genes in each cluster with the CellMarker2 database.
It then calculates the cell count for each matched cell type and prints the result, helping you identify possible cell types for the cluster.
To annotate, you can simply use the top-matched cell type:
cl2cell <- marker[, head(.SD, 1), by = .(cluster)] cl2cell <- setNames(cl2cell[["cell_name"]], cl2cell[["cluster"]]) cl2cell
Visualize marker dot plots for similar clusters:
cls <- list( c(1, 5, 7), c(8), c(3), c(0,2, 4, 6) ) dotplotList <- plotSeuratDot(seuratObject, cls, marker = pbmc.markers, n = 50, spc = 'Human', topcellN = 2)
Explanation:
This function searches for potential cell markers from the result of matchCellMarker2
.
It then uses Seurat::DotPlot
to generate corresponding dot plots for similar clusters.
Construct a named vector for annotation:
cl2cell <- finsert( expression( c(1, 5) == "Monocyte", c(7) == "DC", c(8) == "megakaryocyte", c(3) == "B.cell", c(0, 2) == "Naive.CD8.T.cell", c(4) == "Cytotoxic.T.Cell", c(6) == "Natural.killer.cell", ), len = 9) cl2cell
You can also directly retrieve markers:
get_marker(spc = 'Human', cell = c('Monocyte', 'Neutrophil'), number = 5, min.count = 1)
or Check the distribution of the marker directly:
plotMarkerDistribution(mkr = "CD68")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.