Run a custom distance function on an input data matrix
CustomDistance(my.mat, my.function, ...)
A distance matrix
data("pbmc_small")
# Define custom distance matrix
manhattan.distance <- function(x, y) return(sum(abs(x-y)))
input.data <- GetAssayData(pbmc_small, assay.type = "RNA", slot = "scale.data")
#> Warning: The following arguments are not used: assay.type
#> Warning: The `slot` argument of `GetAssayData()` is deprecated as of SeuratObject 5.0.0.
#> ℹ Please use the `layer` argument instead.
cell.manhattan.dist <- CustomDistance(input.data, manhattan.distance)