Run HMRF

doHMRF(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  expression_values = c("normalized", "scaled", "custom"),
  spatial_network_name = "Delaunay_network",
  spat_loc_name = "raw",
  spatial_genes = NULL,
  spatial_dimensions = c("sdimx", "sdimy", "sdimz"),
  dim_reduction_to_use = NULL,
  dim_reduction_name = "pca",
  dimensions_to_use = 1:10,
  seed = 100,
  name = "test",
  k = 10,
  betas = c(0, 2, 50),
  tolerance = 1e-10,
  zscore = c("none", "rowcol", "colrow"),
  numinit = 100,
  python_path = NULL,
  output_folder = NULL,
  overwrite_output = TRUE
)

Arguments

gobject

giotto object

spat_unit

spatial unit

feat_type

feature type

expression_values

expression values to use

spatial_network_name

name of spatial network to use for HMRF

spat_loc_name

name of spatial locations

spatial_genes

spatial genes to use for HMRF

spatial_dimensions

select spatial dimensions to use, default is all possible dimensions

dim_reduction_to_use

use another dimension reduction set as input

dim_reduction_name

name of dimension reduction set to use

dimensions_to_use

number of dimensions to use as input

seed

seed to fix random number generator (for creating initialization of HMRF) (-1 if no fixing)

name

name of HMRF run

k

number of HMRF domains

betas

betas to test for. three numbers: start_beta, beta_increment, num_betas e.g. c(0, 2.0, 50)

tolerance

tolerance

zscore

zscore

numinit

number of initializations

python_path

python path to use

output_folder

output folder to save results

overwrite_output

overwrite output folder

Value

Creates a directory with results that can be viewed with viewHMRFresults

Details

Description of HMRF parameters ...

Examples

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
#> cell_spatInfo_spatVector.shp
#> cell
#> 
#> 3.2 read Giotto spatial centroid information
#> cell
#> 
#> 3.3 read Giotto spatial overlap information
#> No overlaps were found, overlap loading will be
#>  skipped
#> 
#> 4. read Giotto image information
#> a giotto python environment was found
#> Using python path:
#>  "/Users/yuanlab/Library/r-miniconda/envs/giotto_env/bin/pythonw"
spat_genes <- binSpect(g)
#> 
#> 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

doHMRF(g, spatial_genes = spat_genes[seq_len(10)]$feats,
output_folder = tempdir())
#> Warning: this matrix will be converted to a dense and memory intensive
#>                 base matrix ...
#> expression_matrix.txt already exists at this location, will be
#>                 overwritten
#> spatial_genes.txt already exists at this location, will be
#>                 overwritten
#> spatial_network.txt already exists at this location, will be
#>                 overwritten
#> spatial_cell_locations.txt already exists at this location,
#>                 will be overwritten
#> [1] "/Users/yuanlab/Library/r-miniconda/envs/giotto_env/bin/pythonw /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/Giotto/python/reader2.py -l \"/var/folders/wl/055wx0m919n1wvp5t1tl_r2c0000gp/T//RtmpRCiCyr/spatial_cell_locations.txt\" -g \"/var/folders/wl/055wx0m919n1wvp5t1tl_r2c0000gp/T//RtmpRCiCyr/spatial_genes.txt\" -n \"/var/folders/wl/055wx0m919n1wvp5t1tl_r2c0000gp/T//RtmpRCiCyr/spatial_network.txt\" -e \"/var/folders/wl/055wx0m919n1wvp5t1tl_r2c0000gp/T//RtmpRCiCyr/expression_matrix.txt\" -o \"/var/folders/wl/055wx0m919n1wvp5t1tl_r2c0000gp/T//RtmpRCiCyr/result.spatial.zscore\" -a test -k 10 -b 0 2 50 -t 1e-10 -z none -s 100 -i 100"
#> $name
#> [1] "test"
#> 
#> $feat_type
#> [1] "rna"
#> 
#> $output_data
#> [1] "\"/var/folders/wl/055wx0m919n1wvp5t1tl_r2c0000gp/T//RtmpRCiCyr/result.spatial.zscore\""
#> 
#> $k
#> [1] 10
#> 
#> $betas
#> [1]  0  2 50
#> 
#> $python_path
#> [1] "/Users/yuanlab/Library/r-miniconda/envs/giotto_env/bin/pythonw"
#> 
#> attr(,"class")
#> [1] "list"       "HMRFoutput"