Cluster: Clustering of samples

Description Usage Arguments Details Value Examples

View source: R/clustering.R

Description

Performs clustering on sampled cells and Post-hoc Cluster Assignment.

Usage

1
2
3
Cluster(object, use.subsamples = TRUE, method = "louvian",
  use.reduced.dims = NULL, k_nn = 10, conf = 0.75,
  use.previous = FALSE, ...)

Arguments

object

A SingleCellExperiment object containing normalized expression values in "normcounts".

use.subsamples

uses the indices obtained from the sampling method.

method

character, one of c("default", "hclust", "kmeans")., In the default mode, louvain based partition is used. When hclust, hierarchical clustering is used.

use.reduced.dims

optional, when used, the name of the reducedDim() table to be used for clustering. method = "hclust".

k_nn

integers, specifies number of nearest neighbours, defaults to 10.

conf

numeric [0-1], defines the expected confidence of majority for a consensus. Cells remain unassigned when majority is below conf.

use.previous

optional, when TRUE, the clustering step is skipped and only the post-hoc clusering is repeated with the new conf.

...

For the kmeans method option, the argument center must be passed which specifies the number of clusters. Arguments specific to cutreeDynamic function may be passed when method = "hclust"; for reference, the default values of minClusterSize and deepSplit are set to 20 and 1 respectively.

Details

Clustering is carried out in two alternate approaches on the sampled cells. For the default setting or quick identification of the existing broad clusters, a Louvain based partition is employed. Otherwise for fine-tuned clustering with outliers, hierarchical clustering is used with cutreeDynamic for dendrogram cut. Also, Assigns cluster membership to unsampled cells by using cluster membership information of the nearest neighbours. An approximate nearest neighbour graph is constructed out of the samples population using the find_ann() module. Some cells are left un-assigned when its neighbour's cluster membership doesn't form a majority as specified by the conf parameter. Unassigned cells (NA) are excluded in the plot or further downstream analysis.

Value

List of:

  1. cluster.ident vector cluster identifiers ranging from 1 to the number of clusters for respective data points.

  2. nn.ids matrix, each row corresponds to a cell, whose columns depict cluster membership of its neighbours; as returned by the find_ann() module.

Unassigned samples are represented byNA values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(SingleCellExperiment)
ncells <- 1000
ngenes <- 2000
x <- matrix(rpois(ncells*ngenes, lambda = 10), ncol=ncells, nrow=ngenes, byrow=TRUE)
rownames(x) <- paste0("Gene", seq_len(ngenes))
colnames(x) <- paste0("Cell", seq_len(ncells))
sce <- SingleCellExperiment(list(counts=x))
sce <- CountNormalize(sce)
sce <- RankGenes(sce)
sce <- Cluster(sce,  use.subsamples=FALSE, conf=0.1)

debsin/dropClust documentation built on Nov. 4, 2019, 10:22 a.m.