clusterPurity: Evaluate cluster purity

Description Usage Arguments Value Author(s) See Also Examples

Description

Determine whether cells are surrounded by neighbors that are assigned to the same cluster. This function has now been deprecated in favor of neighborPurity from the bluster package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
clusterPurity(x, ...)

## S4 method for signature 'ANY'
clusterPurity(x, ..., transposed = FALSE, subset.row = NULL)

## S4 method for signature 'SummarizedExperiment'
clusterPurity(x, ..., assay.type = "logcounts")

## S4 method for signature 'SingleCellExperiment'
clusterPurity(
  x,
  clusters = colLabels(x, onAbsence = "error"),
  ...,
  assay.type = "logcounts",
  use.dimred = NULL
)

Arguments

x

A matrix-like object containing expression values for each gene (row) in each cell (column). These dimensions can be transposed if transposed=TRUE.

Alternatively, a SummarizedExperiment or SingleCellExperiment containing such an expression matrix. If x is a SingleCellExperiment and use.dimred is set, its reducedDims will be used instead.

...

For the generic, arguments to pass to specific methods.

For the ANY method, arguments to pass to neighborPurity.

For the SummarizedExperiment method, arguments to pass to the ANY method.

For the SingleCellExperiment method, arguments to pass to the SummarizedExperiment method.

transposed

A logical scalar indicating whether x is transposed (i.e., rows are cells).

subset.row

See ?"scran-gene-selection". Only used when transposed=FALSE.

assay.type

A string specifying which assay values to use.

clusters

A vector or factor of cluster IDs to pass to neighborPurity.

use.dimred

A string specifying whether existing values in reducedDims(x) should be used.

Value

A DataFrame of purity statistics where each row corresponds to a cell in x, see ?neighborPurity for details.

Author(s)

Aaron Lun

See Also

approxSilhouette, for another method of evaluating cluster separation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(scuttle)
sce <- mockSCE()
sce <- logNormCounts(sce)

g <- buildSNNGraph(sce)
clusters <- igraph::cluster_walktrap(g)$membership
out <- clusterPurity(sce, clusters)
boxplot(split(out$purity, clusters))

# Mocking up a stronger example:
ngenes <- 1000
centers <- matrix(rnorm(ngenes*3), ncol=3)
clusters <- sample(1:3, ncol(sce), replace=TRUE)

y <- centers[,clusters]
y <- y + rnorm(length(y))

out2 <- clusterPurity(y, clusters)
boxplot(split(out2$purity, clusters))

scran documentation built on April 17, 2021, 6:09 p.m.