Calculates the pairwise distance between genes in an expression matrix using various metrics.

CalculateGeneDistance(dat, method)

Arguments

dat

matrix; the expression data with genes as rows and cells as columns.

method

character; the metric for measuring gene-gene distance. Possible values are "pearson", "euclidean", "KL", "jaccard", and "spearman".

  • "pearson": Calculates Pearson correlation distance (1 - correlation).

  • "euclidean": Calculates Euclidean distance.

  • "KL": Calculates Kullback-Leibler divergence.

  • "jaccard": Calculates Jaccard distance.

  • "spearman": Calculates Spearman correlation distance (1 - correlation).

Value

A distance object representing the pairwise distances between genes.

Examples

expression_matrix <- matrix(runif(100), nrow=10)
rownames(expression_matrix) <- paste0("Gene", 1:10)
colnames(expression_matrix) <- paste0("Sample", 1:10)
dist <- CalculateGeneDistance(expression_matrix, method="pearson")