Cluster cells using a random walk approach.

doRandomWalkCluster(
  gobject,
  name = "random_walk_clus",
  nn_network_to_use = "sNN",
  network_name = "sNN.pca",
  walk_steps = 4,
  walk_clusters = 10,
  walk_weights = NA,
  return_gobject = TRUE,
  set_seed = FALSE,
  seed_number = 1234
)

Arguments

gobject

giotto object

name

name for cluster, default to "random_walk_clus"

nn_network_to_use

type of NN network to use (kNN vs sNN), default to "sNN"

network_name

name of NN network to use, default to "sNN.pca"

walk_steps

number of walking steps, default = 4

walk_clusters

number of final clusters, default = 10

walk_weights

cluster column defining the walk weights

return_gobject

boolean: return giotto object (default = TRUE)

set_seed

set seed (default = FALSE)

seed_number

number for seed

Value

giotto object with new clusters appended to cell metadata

Details

See cluster_walktrap function from the igraph package in R for more information.

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
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> 
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#>  "/usr/bin/python3"

g <- doRandomWalkCluster(g)
pDataDT(g)
#>                 cell_ID in_tissue nr_feats perc_feats total_expr leiden_clus
#>                  <char>     <int>    <int>      <num>      <num>       <num>
#>   1: AACTCGATGGCGCAGT-1         1      265   41.79811  1057.9308           2
#>   2: GGCTGGCTAGCTTAAA-1         1      279   44.00631  1064.7493           5
#>   3: GACGCCTGTTGCAGGG-1         1      219   34.54259   964.9294           2
#>   4: GAGGGCATCGCGTATC-1         1      294   46.37224  1142.7664           2
#>   5: TCAACACATTGGGTAA-1         1      261   41.16719  1063.3517           2
#>  ---                                                                        
#> 620: GGTAGTGCTCGCACCA-1         1      179   28.23344   768.4749           5
#> 621: AAGCTCGTGCCAAGTC-1         1      195   30.75710   756.0675           5
#> 622: TATTCAATTCTAATCC-1         1      247   38.95899   921.8264           5
#> 623: TTCAAAGTCTCTAGCC-1         1      384   60.56782   916.5929           6
#> 624: TTGAATATGGACTTTC-1         1      380   59.93691   912.3051           6
#>      custom_leiden random_walk_clus
#>              <num>           <fctr>
#>   1:             4                2
#>   2:             3                2
#>   3:             3                5
#>   4:             3                2
#>   5:             3                5
#>  ---                               
#> 620:             4                2
#> 621:             4                2
#> 622:             4                2
#> 623:             7                2
#> 624:             4                2