Calculates the conditional probability of each cell belong to each cluster given all other cluster assignments

# S3 method for celda_CG
clusterProbability(counts, celda.mod, log = FALSE, ...)

Arguments

counts

Integer matrix. Rows represent features and columns represent cells. This matrix should be the same as the one used to generate `celda.mod`.

celda.mod

Celda object of class "celda_CG".

log

Logical. If FALSE, then the normalized conditional probabilities will be returned. If TRUE, then the unnormalized log probabilities will be returned. Default FALSE.

...

Additional parameters.

Value

A list containging a matrix for the conditional cell and feature cluster probabilities.

Examples

celda.sim = simulateCells("celda_CG") celda.mod = celda_CG(celda.sim$counts, K=celda.sim$K, L=celda.sim$L)
#> --------------------------------------------------------------------
#> Starting Celda_CG: Clustering cells and genes.
#> --------------------------------------------------------------------
#> Thu Sep 06 12:56:34 2018 .. Initializing chain 1 with 'random' (seed=12345)
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 1 | logLik: -1302242.28026966
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 2 | logLik: -1270044.02532694
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 3 | logLik: -1262209.15789703
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 4 | logLik: -1261712.35040107
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 5 | logLik: -1261712.57070977
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 6 | logLik: -1261711.00382116
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 7 | logLik: -1261716.24159949
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 8 | logLik: -1261479.73933942
#> Thu Sep 06 12:56:34 2018 .... Completed iteration: 9 | logLik: -1259874.14368698
#> Thu Sep 06 12:56:34 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:34 2018 .... Cluster 1 was reassigned and cluster 4 was split in two.
#> Thu Sep 06 12:56:34 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:35 2018 .... Cluster 2 was reassigned and cluster 9 was split in two.
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 10 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 11 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 12 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 13 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 14 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 15 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 16 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 17 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 18 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Completed iteration: 19 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:35 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:35 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:35 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:36 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 20 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:36 2018 .. Finished chain 1 with seed 12345
#> Thu Sep 06 12:56:36 2018 .. Initializing chain 2 with 'random' (seed=12346)
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 1 | logLik: -1288484.90567663
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 2 | logLik: -1252316.73202744
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 3 | logLik: -1250339.95568952
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 4 | logLik: -1249564.71677654
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 5 | logLik: -1249563.6294892
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 6 | logLik: -1249564.31589985
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 7 | logLik: -1249563.24732323
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 8 | logLik: -1249563.4198964
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 9 | logLik: -1249563.4198964
#> Thu Sep 06 12:56:36 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:36 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:36 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:36 2018 .... Cluster 1 was reassigned and cluster 5 was split in two.
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 10 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 11 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:36 2018 .... Completed iteration: 12 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 13 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 14 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 15 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 16 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 17 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 18 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 19 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:37 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:37 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:37 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 20 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:37 2018 .. Finished chain 2 with seed 12346
#> Thu Sep 06 12:56:37 2018 .. Initializing chain 3 with 'random' (seed=12347)
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 1 | logLik: -1272446.65246189
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 2 | logLik: -1251530.86145074
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 3 | logLik: -1251528.38544994
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 4 | logLik: -1251523.68686302
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 5 | logLik: -1251527.44696783
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 6 | logLik: -1251522.13351871
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 7 | logLik: -1251526.73996701
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 8 | logLik: -1251529.06808316
#> Thu Sep 06 12:56:37 2018 .... Completed iteration: 9 | logLik: -1251527.40248727
#> Thu Sep 06 12:56:37 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:37 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:37 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:38 2018 .... Cluster 1 was reassigned and cluster 5 was split in two.
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 10 | logLik: -1248422.30438372
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 11 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 12 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 13 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 14 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 15 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 16 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 17 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 18 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 19 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:38 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:38 2018 .... Completed iteration: 20 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:38 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:56:38 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:38 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:56:39 2018 .... No additional splitting was performed.
#> Thu Sep 06 12:56:39 2018 .... Completed iteration: 21 | logLik: -1248355.63470669
#> Thu Sep 06 12:56:39 2018 .. Finished chain 3 with seed 12347
#> --------------------------------------------------------------------
#> Completed Celda_CG. Total time: 4.773285 secs
#> --------------------------------------------------------------------
cluster.prob = clusterProbability(celda.sim$counts, celda.mod)