This function will re-code _feature_ cluster labels based off of a mapping provided by the user, for all fields on a celda object involving cluster labels. e.g. if Y (feature cluster) values range from 1-4 and the user would like all 3's switched to 1's and vice versa, this function can be useful. NOTE: it is recommended that this function's results aren't used to overwrite the original celda model object provided, in the event of a mis-mapping.

recodeClusterY(celda.mod, from, to)

Arguments

celda.mod

Celda object of class "celda_G" or "celda_CG".

from

Numeric vector. Unique values in the range of 1:L that correspond to the original cluster labels in `celda.mod`.

to

Numeric vector. Unique values in the range of 1:L that correspond to the new cluster labels.

Value

Celda object with recoded feature clusters, with class corresponding to that of `celda.mod`.

Examples

celda.mod = celda_CG(pbmc_select, K=10, L=50, max.iter=2, nchains=1)
#> --------------------------------------------------------------------
#> Starting Celda_CG: Clustering cells and genes.
#> --------------------------------------------------------------------
#> Thu Sep 06 12:59:29 2018 .. Initializing chain 1 with 'random' (seed=12345)
#> Thu Sep 06 12:59:31 2018 .... Completed iteration: 1 | logLik: -30130978.8463905
#> Thu Sep 06 12:59:34 2018 .... Determining if any cell clusters should be split.
#> Thu Sep 06 12:59:36 2018 .... Cluster 4 was reassigned and cluster 5 was split in two.
#> Thu Sep 06 12:59:36 2018 .... Determining if any gene clusters should be split.
#> Thu Sep 06 12:59:44 2018 .... Cluster 33 was reassigned and cluster 8 was split in two.
#> Thu Sep 06 12:59:44 2018 .... Completed iteration: 2 | logLik: -30006086.6991995
#> Thu Sep 06 12:59:44 2018 .. Finished chain 1 with seed 12345
#> --------------------------------------------------------------------
#> Completed Celda_CG. Total time: 16.31065 secs
#> --------------------------------------------------------------------
celda.mod.reordered.y = recodeClusterY(celda.mod, c(1, 3), c(3, 1))