Cluster cells using a SNN cluster approach.

doSNNCluster(
  gobject,
  name = "sNN_clus",
  nn_network_to_use = "kNN",
  network_name = "kNN.pca",
  k = 20,
  eps = 4,
  minPts = 16,
  borderPoints = TRUE,
  return_gobject = TRUE,
  set_seed = FALSE,
  seed_number = 1234
)

Arguments

gobject

giotto object

name

name for cluster, default to "sNN_clus"

nn_network_to_use

type of NN network to use (only works on kNN), default to "kNN"

network_name

name of kNN network to use, default to "kNN.pca"

k

Neighborhood size for nearest neighbor sparsification to create the shared NN graph, default = 20

eps

Two objects are only reachable from each other if they share at least eps nearest neighbors, default = 4

minPts

minimum number of points that share at least eps nearest neighbors for a point to be considered a core points, default = 16

borderPoints

should borderPoints be assigned to clusters like in DBSCAN? (default = TRUE)

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 sNNclust from dbscan package

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
#> 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 <- createNearestNetwork(g, type = "kNN")

doSNNCluster(g)
#> An object of class giotto 
#> >Active spat_unit:  cell 
#> >Active feat_type:  rna 
#> dimensions    : 634, 624 (features, cells)
#> [SUBCELLULAR INFO]
#> polygons      : cell 
#> [AGGREGATE INFO]
#> expression -----------------------
#>   [cell][rna] raw normalized scaled
#> spatial locations ----------------
#>   [cell] raw
#> spatial networks -----------------
#>   [cell] Delaunay_network spatial_network
#> spatial enrichments --------------
#>   [cell][rna] cluster_metagene DWLS
#> dim reduction --------------------
#>   [cell][rna] pca custom_pca umap custom_umap tsne
#> nearest neighbor networks --------
#>   [cell][rna] sNN.pca custom_NN kNN.pca
#> attached images ------------------
#> images      : alignment image 
#> 
#> 
#> Use objHistory() to see steps and params used