function to run HMRF model
doHMRF_V2(HMRF_init_obj, betas = NULL)
initialization object list returned from initHMRF() function
beta value of the HMRF model, controlling the smoothness of clustering. NULL value of beta will provide default values based on feature numbers, otherwise, a vector of three values: initial beta, beta increment, and number of betas
HMRF model
This function will run a HMRF model after initialization of HMRF. Of note is the beta parameter, the smoothing parameter. If the users are interested in selecting results from different smoothness, we recommend running a range of betas, hence betas specify what this range is. For example, betas=c(0,10,5) will run for the following betas: 0, 10, 20, 30, 40. betas=c(0,5,2) will run for betas: 0, 5, 10. Setting the beta can use the following guideline: If number of features N is 10<N<50, set betas=c(0, 1, 20) For 50<N<100, set betas=c(0, 2, 25) For 100<N<500, set betas=c(0, 5, 20) If user didn't specify the number or sequence of beta, the function will provide a default value based on the number of features. Returns a list of results for betas, spat_unit and feat_type. Result for each beta is a list with probability(normalized or non-normalized), class, and model log-likelihood value.
g <- GiottoData::loadGiottoMini("visium")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> python already initialized in this session
#> active environment : '/usr/bin/python3'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
g <- binSpect(g, return_gobject = TRUE)
#>
#> This is the single parameter version of binSpect
#>
#> 1. matrix binarization complete
#>
#> 2. spatial enrichment test completed
#>
#> 3. (optional) average expression of high
#> expressing cells calculated
#>
#> 4. (optional) number of high expressing cells
#> calculated
HMRF_init_obj <- initHMRF_V2(gobject = g, cl.method = "km")
#>
#> If used in published research, please cite:
#> Q Zhu, S Shah, R Dries, L Cai, GC Yuan.
#> 'Identification of spatially associated subpopulations by combining
#> scRNAseq and sequential fluorescence in situ hybridization data'
#> Nature biotechnology 36 (12), 1183-1190. 2018
#> Error: packages 'smfishHmrf', 'graphcoloring' are not yet installed
#>
#> To install:
#> devtools::install_bitbucket("qzhudfci/smfishHmrf-r")
#> devtools::install_bitbucket("qzhudfci/graphcoloring")
doHMRF_V2(HMRF_init_obj = HMRF_init_obj, betas = c(0, 5, 2))
#>
#> If used in published research, please cite:
#> Q Zhu, S Shah, R Dries, L Cai, GC Yuan.
#> 'Identification of spatially associated subpopulations by combining
#> scRNAseq and sequential fluorescence in situ hybridization data'
#> Nature biotechnology 36 (12), 1183-1190. 2018
#>
#> Please find more explanation and instruction of the HMRF function
#> on
#> https://bitbucket.org/qzhudfci/smfishhmrf-r/src/master/TRANSITION.md
#> Error: object 'HMRF_init_obj' not found