runScranSNN: Get clustering with SNN graph

View source: R/runCluster.R

runScranSNNR Documentation

Get clustering with SNN graph

Description

Perform SNN graph clustering on a SingleCellExperiment object, with graph construction by buildSNNGraph and graph clustering by "igraph" package.

Usage

runScranSNN(
  inSCE,
  useReducedDim = "PCA",
  useAssay = NULL,
  useAltExp = NULL,
  altExpAssay = "counts",
  altExpRedDim = NULL,
  clusterName = "cluster",
  k = 14,
  nComp = 10,
  weightType = "jaccard",
  algorithm = c("louvain", "leiden", "walktrap", "infomap", "fastGreedy", "labelProp",
    "leadingEigen"),
  BPPARAM = BiocParallel::SerialParam(),
  seed = 12345,
  ...
)

Arguments

inSCE

A SingleCellExperiment object.

useReducedDim

A single character, specifying which low-dimension representation (reducedDim) to perform the clustering algorithm on. Default "PCA".

useAssay

A single character, specifying which assay to perform the clustering algorithm on. Default NULL.

useAltExp

A single character, specifying the assay which altExp to perform the clustering algorithm on. Default NULL.

altExpAssay

A single character, specifying which assay in the chosen altExp to work on. Only used when useAltExp is set. Default "counts".

altExpRedDim

A single character, specifying which reducedDim within the altExp specified by useAltExp to use. Only used when useAltExp is set. Default NULL.

clusterName

A single character, specifying the name to store the cluster label in colData. Default "cluster".

k

An integer, the number of nearest neighbors used to construct the graph. Smaller value indicates higher resolution and larger number of clusters. Default 14.

nComp

An integer. The number of components to use for graph construction. Default 10. See Detail.

weightType

A single character, that specifies the edge weighing scheme when constructing the Shared Nearest-Neighbor (SNN) graph. Choose from "rank", "number", "jaccard". Default "jaccard".

algorithm

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.

BPPARAM

A BiocParallelParam object to use for processing the SNN graph generation step in parallel.

seed

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.

Details

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.

Value

The input SingleCellExperiment object with factor cluster labeling updated in colData(inSCE)[[clusterName]].

References

Aaron Lun and et. al., 2016

Examples

data("mouseBrainSubsetSCE")
mouseBrainSubsetSCE <- runScranSNN(mouseBrainSubsetSCE,
                                   useReducedDim = "PCA_logcounts")

compbiomed/singleCellTK documentation built on Oct. 27, 2024, 3:26 a.m.