runScanpyFindClusters Computes the clusters from the input sce object and stores them back in sce object

runScanpyFindClusters(
  inSCE,
  useAssay = "scanpyScaledData",
  useReducedDim = "scanpyPCA",
  nNeighbors = 10,
  dims = 40,
  method = c("leiden", "louvain"),
  colDataName = NULL,
  resolution = 1,
  niterations = -1,
  flavor = "vtraag",
  use_weights = FALSE,
  cor_method = "pearson",
  inplace = TRUE,
  externalReduction = NULL,
  seed = 12345
)

Arguments

inSCE

(sce) object from which clusters should be computed and stored in

useAssay

Assay containing scaled counts to use for clustering.

useReducedDim

Reduction method to use for computing clusters. Default "scanpyPCA".

nNeighbors

The size of local neighborhood (in terms of number of neighboring data points) used for manifold approximation. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. Default 10.

dims

numeric value of how many components to use for computing clusters. Default 40.

method

selected method to compute clusters. One of "louvain", and "leiden". Default louvain.

colDataName

Specify the name to give to this clustering result. Default is NULL that will generate a meaningful name automatically.

resolution

A parameter value controlling the coarseness of the clustering. Higher values lead to more clusters Default 1.

niterations

How many iterations of the Leiden clustering method to perform. Positive values above 2 define the total number of iterations to perform, -1 has the method run until it reaches its optimal clustering. Default -1.

flavor

Choose between to packages for computing the clustering. Default vtraag

use_weights

Boolean. Use weights from knn graph. Default FALSE

cor_method

correlation method to use. Options are ‘pearson’, ‘kendall’, and ‘spearman’. Default pearson.

inplace

If True, adds dendrogram information to annData object, else this function returns the information. Default TRUE

externalReduction

Pass DimReduce object if PCA computed through other libraries. Default NULL.

seed

Specify numeric value to set as a seed. Default 12345.

Value

Updated sce object which now contains the computed clusters

Examples

data(scExample, package = "singleCellTK")
if (FALSE) {
sce <- runScanpyNormalizeData(sce, useAssay = "counts")
sce <- runScanpyFindHVG(sce, useAssay = "scanpyNormData", method = "seurat")
sce <- runScanpyScaleData(sce, useAssay = "scanpyNormData")
sce <- runScanpyPCA(sce, useAssay = "scanpyScaledData")
sce <- runScanpyFindClusters(sce, useReducedDim = "scanpyPCA")
}