Perform SNN graph clustering on a
SingleCellExperiment object, with graph
construction by buildSNNGraph
and graph clustering by
"igraph" package.
runScranSNN(
inSCE,
useReducedDim = NULL,
useAssay = NULL,
useAltExp = NULL,
altExpAssay = "counts",
altExpRedDim = NULL,
clusterName = "scranSNN_cluster",
k = 8,
nComp = 10,
weightType = c("rank", "number", "jaccard"),
algorithm = c("louvain", "leiden", "walktrap", "infomap", "fastGreedy", "labelProp",
"leadingEigen"),
BPPARAM = BiocParallel::SerialParam(),
seed = 12345,
...
)
A SingleCellExperiment object.
A single character
, specifying which
low-dimension representation (reducedDim
)
to perform the clustering algorithm on. Default NULL
.
A single character
, specifying which
assay
to perform the clustering algorithm
on. Default NULL
.
A single character
, specifying the assay which
altExp
to perform the clustering
algorithm on. Default NULL
.
A single character
, specifying which
assay
in the chosen
altExp
to work on. Only used when
useAltExp
is set. Default "counts"
.
A single character
, specifying which
reducedDim
within the altExp
specified by
useAltExp
to use. Only used when useAltExp
is set. Default
NULL
.
A single character
, specifying the name to store
the cluster label in colData
. Default
"scranSNN_cluster"
.
An integer
, the number of nearest neighbors used to construct
the graph. Smaller value indicates higher resolution and larger number of
clusters. Default 8
.
An integer
. The number of components to use for graph
construction. Default 10
. See Detail.
A single character
, that specifies the edge weighing
scheme when constructing the Shared Nearest-Neighbor (SNN) graph. Choose from
"rank"
, "number"
, "jaccard"
. Default "rank"
.
A single character
, that specifies the community
detection algorithm to work on the SNN graph. Choose from "leiden"
,
"louvain"
, "walktrap"
, "infomap"
, "fastGreedy"
,
"labelProp"
, "leadingEigen"
. Default "louvain"
. See
Detail.
A BiocParallelParam
object to use
for processing the SNN graph generation step in parallel.
Random seed for reproducibility of results. Default NULL
will use global seed in use by the R environment.
Other optional parameters passed to the igraph
clustering functions. See Details.
The input SingleCellExperiment object with
factor
cluster labeling updated in
colData(inSCE)[[clusterName]]
.
Different graph based clustering algorithms have diverse sets of parameters that users can tweak. The help information can be found here:
for "louvain"
, see function help
cluster_louvain
for "leiden"
, see function help
cluster_leiden
for "walktrap"
, see function help
cluster_walktrap
for "infomap"
, see function help
cluster_infomap
for "fastGreedy"
, see function help
cluster_fast_greedy
for "labelProp"
, see function help
cluster_label_prop
for "leadingEigen"
, see function help
cluster_leading_eigen
The Scran SNN building method can work on specified nComp
components.
When users specify input matrix by useAssay
or useAltExp
+
altExpAssay
, the method will generate nComp
components and use
them all. When specifying useReducedDim
or useAltExp
+
altExpRedDim
, this function will subset the top nComp
components and pass them to the method.
Aaron Lun and et. al., 2016
data("mouseBrainSubsetSCE")
mouseBrainSubsetSCE <- runScranSNN(mouseBrainSubsetSCE,
useReducedDim = "PCA_logcounts")
#> Sat Mar 18 10:31:23 2023 ... Running 'scran SNN clustering' with 'louvain' algorithm
#> Sat Mar 18 10:31:23 2023 ... Identified 2 clusters