celda Cell Clustering Model

celda_C(counts, sample.label = NULL, K, alpha = 1, beta = 1,
  algorithm = c("EM", "Gibbs"), stop.iter = 10, max.iter = 200,
  split.on.iter = 10, split.on.last = TRUE, seed = 12345, nchains = 3,
  initialize = c("random", "split"), count.checksum = NULL, z.init = NULL,
  logfile = NULL, verbose = TRUE)

Arguments

counts

Integer matrix. Rows represent features and columns represent cells.

sample.label

Vector or factor. Denotes the sample label for each cell (column) in the count matrix.

K

Integer. Number of cell populations.

alpha

Numeric. Concentration parameter for Theta. Adds a pseudocount to each cell population in each sample. Default 1.

beta

Numeric. Concentration parameter for Phi. Adds a pseudocount to each feature in each cell population. Default 1.

algorithm

String. Algorithm to use for clustering cell subpopulations. One of 'EM' or 'Gibbs'. Default 'EM'.

stop.iter

Integer. Number of iterations without improvement in the log likelihood to stop inference. Default 10.

max.iter

Integer. Maximum number of iterations of Gibbs sampling to perform. Default 200.

split.on.iter

Integer. On every `split.on.iter` iteration, a heuristic will be applied to determine if a cell population should be reassigned and another cell population should be split into two clusters. To disable splitting, set to -1. Default 10.

split.on.last

Integer. After the the chain has converged, according to `stop.iter`, a heuristic will be applied to determine if a cell population should be reassigned and another cell population should be split into two clusters. If a split occurs, then 'stop.iter' will be reset. Default TRUE.

seed

Integer. Passed to set.seed(). Default 12345.

nchains

Integer. Number of random cluster initializations. Default 1.

initialize

Chararacter. One of 'random' or 'split'. With 'random', cells are randomly assigned to a clusters. With 'split' cell clusters will be recurssively split into two clusters using `celda_C` until the specified K is reached. Default 'random'.

count.checksum

"Character. An MD5 checksum for the `counts` matrix. Default NULL.

z.init

Integer vector. Sets initial starting values of z. If NULL, starting values for each cell will be randomly sampled from 1:K. 'z.init' can only be used when 'initialize' = "random". Default NULL.

logfile

Character. Messages will be redirected to a file named `logfile`. If NULL, messages will be printed to stdout. Default NULL.

verbose

Logical. Whether to print log messages. Default TRUE.

Value

An object of class celda_C with clustering results and various sampling statistics.

Examples

celda.sim = simulateCells(model="celda_C") celda.mod = celda_C(celda.sim$counts, K=celda.sim$K, sample.label=celda.sim$sample.label)
#> --------------------------------------------------------------------
#> Starting Celda_C: Clustering cells.
#> --------------------------------------------------------------------
#> Thu Sep 06 12:56:24 2018 .. Initializing chain 1 with 'random' (seed=12345)
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 1 | logLik: -1403825.71632611
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 2 | logLik: -1401382.34154703
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 3 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 4 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 5 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 6 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 7 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 8 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Completed iteration: 9 | logLik: -1376953.43762734
#> Thu Sep 06 12:56:24 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:25 2018 .... Cluster 1 was reassigned and cluster 4 was split in two.
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 10 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 11 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 12 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 13 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 14 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 15 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 16 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 17 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 18 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 19 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:25 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 20 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .. Finished chain 1 with seed 12345
#> Thu Sep 06 12:56:25 2018 .. Initializing chain 2 with 'random' (seed=12346)
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 1 | logLik: -1383826.11702744
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 2 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 3 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 4 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 5 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 6 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 7 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 8 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 9 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:25 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 10 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 11 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:25 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 12 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .. Finished chain 2 with seed 12346
#> Thu Sep 06 12:56:25 2018 .. Initializing chain 3 with 'random' (seed=12347)
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 1 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 2 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 3 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 4 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 5 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 6 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 7 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 8 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Completed iteration: 9 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:25 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:26 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:26 2018 .... Completed iteration: 10 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:26 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:26 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:26 2018 .... Completed iteration: 11 | logLik: -1357964.83951765
#> Thu Sep 06 12:56:26 2018 .. Finished chain 3 with seed 12347
#> --------------------------------------------------------------------
#> Completed Celda_C. Total time: 1.502139 secs
#> --------------------------------------------------------------------