Seurat (version 5.0.3)

CustomDistance: Run a custom distance function on an input data matrix

Description

Run a custom distance function on an input data matrix

Usage

CustomDistance(my.mat, my.function, ...)

Value

A distance matrix

Arguments

my.mat

A matrix to calculate distance on

my.function

A function to calculate distance

...

Extra parameters to my.function

Author

Jean Fan

Examples

Run this code
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")
cell.manhattan.dist <- CustomDistance(input.data, manhattan.distance)

Run the code above in your browser using DataLab