Single-cell Entropic Clustering (scEC) provides an entropy based approach to normalisation, feature selection, differential expression analysis and unsupervised clustering of single-cell RNA-sequencing data. Pre-print is avaialble at https://www.biorxiv.org/content/10.1101/2020.10.01.322255v4.
You can install the the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("mjcasy/scEC")
Note that the package has two python dependencies: Numpy and Scipy. You can download both via the reticulate package using py_install(“numpy”) and py_install(“scipy”).
The basic workflow is demonstrated on the Tian et al 2018, single-cell mixology data set, a mixture of three cancerous cell lines (https://github.com/LuyiTian/sc_mixology).
library(scEC)
#>
#> Attaching package: 'scEC'
#> The following object is masked from 'package:base':
#>
#> Map
library(Matrix)
#> Warning: package 'Matrix' was built under R version 4.1.2
load(paste0(Path, "CountsMatrix"))
CountsMatrix <- CountsMatrix[rowSums(CountsMatrix) >= 100,]
PopHet <- Population(CountsMatrix)
Mean <- log10(rowMeans(CountsMatrix))
N <- ncol(CountsMatrix)
plot(Mean, PopHet, ylim = c(0, log(N)))
GOI <- FeatureSelection(CountsMatrix)
CountsMatrix <- CountsMatrix[GOI,]
Mean <- Mean[GOI]
Clustering <- scEC::Cluster(CountsMatrix, numClus = 3)
InterCluster <- DifferentialExpression(CountsMatrix, Clustering)
plot(Mean, InterCluster)
A novel count matrix can be mapped onto a previously clustered, reference counts matrix. Such mapping is useful in clustering samples from tissues for which cell atlases have already been generated.
Tian et al 2018 also included an expanded data set, covering five cancerous cell lines, inclusive of the three cell lines cluster above. The above clustering can be repeated as a mapping, where each cell is mapped to a cellular identity in the reference data set.
First, the genes names of each data set must be aligned: the five cell line data set uses gene symbols whereas the three line data set uses ENSEMBL IDs.
library("org.Hs.eg.db")
#> Warning: package 'S4Vectors' was built under R version 4.1.1
load(paste0(Path, "CountsMatrix"))
MapCountsMatrix <- CountsMatrix
load(paste0(Path, "Identity"))
MapID <- Identity
load(paste0(Path2, "CountsMatrix"))
ReferenceCountsMatrix <- CountsMatrix
load(paste0(Path2, "Identity"))
ReferenceID <- Identity
symbols <- mapIds(org.Hs.eg.db,
keys = rownames(MapCountsMatrix),
keytype="ENSEMBL",
column = "SYMBOL")
syms <- symbols[!is.na(symbols)]
MapCountsMatrix <- MapCountsMatrix[names(syms),]
MapCountsMatrix@Dimnames[[1]] <- unname(syms)
RefGenes <- row.names(ReferenceCountsMatrix)
MapGenes <- row.names(MapCountsMatrix)
CommonGenes <- intersect(RefGenes, MapGenes)
ReferenceCountsMatrix <- ReferenceCountsMatrix[CommonGenes,]
MapCountsMatrix <- MapCountsMatrix[CommonGenes,]
The gene-matched data sets can then be mapped.
Ident <- scEC::Map(MapCountsMatrix = MapCountsMatrix,
ReferenceCountsMatrix = ReferenceCountsMatrix,
ReferenceID = ReferenceID)
knitr::kable(table(Ident, MapID))
H1975 | H2228 | HCC827 | |
---|---|---|---|
A549 | 29 | 5 | 15 |
H1975 | 276 | 2 | 0 |
H2228 | 0 | 308 | 1 |
H838 | 8 | 0 | 0 |
HCC827 | 0 | 0 | 258 |