Run k-means clustering algorithm

cluster_kmeans(fsce, expt = "rnaseq", k, method = "PCA",
  n_dims = NULL, seed = NULL, ...)

Arguments

fsce

An object of class FunctionalSingleCellExperiment

expt

Data to use for calculating variable features (default is rnaseq). Must be present in names(fsce).

k

number of classes

method

dimensionality reduction method for clustering (defaults to PCA)

n_dims

specify the number of dimensions from "dr" to use for clustering, defaults to all dimensions

seed

seed for reproducible result

...

additional arguments to pass to stats::kmeans()

Value

fsce with k_cluster in expt colData.

See also

Other clustering functions: cluster_leiden

Examples

# calculate PCA for k-means default method fsce <- calc_pca(fsce_small)
#> scaling data
#> calculating pcs
fsce <- cluster_kmeans(fsce, k = 6) SingleCellExperiment::colData(fsce[["rnaseq"]], "k_cluster")
#> DataFrame with 250 rows and 4 columns #> cell_id k_cluster leiden_cluster cell_cycle #> <character> <character> <character> <character> #> TGCGGGTGTAGAGTGC TGCGGGTGTAGAGTGC 2 2 S #> TGGTTCCCATCTATGG TGGTTCCCATCTATGG 5 4 S #> CATATTCCACGTCAGC CATATTCCACGTCAGC 2 2 G2M #> TCACAAGTCCTGCTTG TCACAAGTCCTGCTTG 4 3 G1 #> GGAATAATCCAGGGCT GGAATAATCCAGGGCT 5 4 G1 #> ... ... ... ... ... #> CTACGTCCACCACGTG CTACGTCCACCACGTG 5 4 G1 #> TGTGGTAAGGTGCTTT TGTGGTAAGGTGCTTT 6 6 G1 #> AGCGTCGGTCGAGTTT AGCGTCGGTCGAGTTT 2 6 G1 #> CTCGAAAAGTTCGATC CTCGAAAAGTTCGATC 5 5 G2M #> TGACAACGTCGCATAT TGACAACGTCGCATAT 5 4 S