Skip to contents

The function fit.iscmeb is used to fit a iSC.MEB model.

Usage

fit.iscmeb(
  VList,
  AdjList,
  K,
  beta_grid = seq(0, 5, by = 0.2),
  maxIter_ICM = 6,
  maxIter = 25,
  epsLogLik = 1e-05,
  verbose = TRUE,
  int.model = "EEE",
  init.start = 1,
  Sigma_equal = FALSE,
  Sigma_diag = TRUE,
  seed = 1,
  coreNum = 1,
  criteria = c("MBIC", "MAIC", "BIC", "AIC"),
  c_penalty = 1,
  pca.method = "PCA"
)

Arguments

VList

A list of PCs of log-normalized gene expression matrix. The i-th element is a ni * npcs matrtix, where ni is the number of spots of sample i, and npcs is the number of PC. We provide this interface for those users who would like to define the PCs by their own.

AdjList

A list of adjacency matrix with class dgCMatrix. We provide this interface for those users who would like to define the adjacency matrix by their own.

K

An integer or integer vector, specify the candidates of number of clusters.

beta_grid

An optional vector of positive value, the candidate set of the smoothing parameter to be searched by the grid-search optimization approach, defualt as a sequence starts from 0, ends with 5, increase by 0.2.

maxIter_ICM

An optional positive value, represents the maximum iterations of ICM (6 by default).

maxIter

An optional positive value, represents the maximum iterations of EM (25 by default).

epsLogLik

An optional positive vlaue, tolerance vlaue of relative variation rate of the observed pseudo log-loglikelihood value, defualt as '1e-5'.

verbose

An optional logical value, whether output the information of the ICM-EM algorithm.

int.model

An optional string, specify which Gaussian mixture model is used in evaluting the initial values for iSC.MEB, default as "EEE"; and see Mclust for more models' names.

init.start

An optional number of times to calculate the initial value (1 by default). When init.start is larger than 1, initial value will be determined by log likelihood of mclust results.

Sigma_equal

An optional logical value, specify whether Sigmaks are equal, default as FALSE.

Sigma_diag

An optional logical value, specify whether Sigmaks are diagonal matrices, default as TRUE.

seed

An optional integer, the random seed in fitting iSC.MEB model.

coreNum

An optional positive integer, means the number of thread used in parallel computating (1 by default).

criteria

A string, specify the criteria used for selecting the number of clusters, supporting "MBIC", "MAIC", "BIC" and "AIC" ("MBIC" by default).

c_penalty

An optional positive value, the adjusted constant used in the MBIC criteria (1 by default).

pca.method

A string specify the dimension reduction method used to generate VList. "PCA" by default.

Value

Returns a iSCMEBResObj object which contains all model results.

Details

iSCMEBResObj is an object that contains all iSC.MEB solution information. It is the output of function fit.iscmeb, which is the body of our algorithm.

Examples

data(iSCMEBObj_toy)
#> Warning: data set 'iSCMEBObj_toy' not found
library(Seurat)
XList <- lapply(iSCMEBObj_toy@seulist, function(x) Matrix::t(x@assays$RNA@data))
VList <- runPCA(XList)
posList <- lapply(iSCMEBObj_toy@seulist, function(x) x@meta.data[,c("row", "col")])
AdjList <- CreateNeighbors(posList, platform = "Visium")
#> Neighbors were identified for 4222 out of 4222 spots.
#> Neighbors were identified for 4378 out of 4381 spots.
resList <- fit.iscmeb(VList, AdjList, K=7, maxIter=10)
#> Evaluate initial values...
#> fitting ...
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |======================================================================| 100%
#> Fit SC-MEB2...
#> Finish variable initialization 
#> K = 7, iter = 2, loglik= -148583.924112, dloglik=0.999931 
#> K = 7, iter = 3, loglik= -142378.593319, dloglik=0.041763 
#> K = 7, iter = 4, loglik= -138932.559873, dloglik=0.024203 
#> K = 7, iter = 5, loglik= -135452.994625, dloglik=0.025045 
#> K = 7, iter = 6, loglik= -133626.290687, dloglik=0.013486 
#> K = 7, iter = 7, loglik= -132565.279798, dloglik=0.007940 
#> K = 7, iter = 8, loglik= -131780.626891, dloglik=0.005919 
#> K = 7, iter = 9, loglik= -131009.202464, dloglik=0.005854 
#> K = 7, iter = 10, loglik= -130602.705279, dloglik=0.003103