k.means.spatial: Clusters spatial omics data with spatial regularization

Description Usage Arguments Value

View source: R/cluster_functions.R

Description

Clusters spatial omics data with spatial regularization

Usage

1
2
3
4
5
6
7
8
k.means.spatial(
  X,
  cell.dists,
  nclust = 3,
  lambda = 0.1,
  metric = matrixStats::colMins,
  max.iter = 100
)

Arguments

X

An n x p matrix with n cells and p features

cell.dists

An n x n matrix with pairwise distances between all cells

nclust

A scalar indicating the number of clusters

lambda

The weight that spatial penalty takes

metric

A column-wise quantile function to determine distance to cluster (eg. colMins, colMedians, colMaxs from matrixStats)

max.iter

Maximum number of iterations before stopping clustering

Value

a list containing mus (the centroid of each cluster), est (cluster membership for each cell), num_it (number of iterations taken to converge)


jeliason/spatialkmeans documentation built on Dec. 20, 2021, 11 p.m.