Generate similarity matrix for input terms.

compute_term_similarities(
  df_terms,
  similarity_function = jaccard,
  max_similarity = 1
)

Arguments

df_terms

Dataframe storing pathway database.

similarity_function

Function to compute similarity between two sets.

max_similarity

Value to fill diagonal with.

Value

Symmetric matrix of similarity scores.

Examples

df_terms <- data.frame(
  term = c("A", "A", "B", "B", "B", "C", "C", "C"),
  gene = c("a", "b", "a", "b", "c", "a", "c", "d")
)
compute_term_similarities(df_terms)
#>           A         B    C
#> A 1.0000000 0.6666667 0.25
#> B 0.6666667 1.0000000 0.50
#> C 0.2500000 0.5000000 1.00