Run tf-idf on a metadata table.

tfidf(
  clusts,
  label_var = "dataset",
  cluster_var = "seurat_clusters",
  terms_per_cluster = 1,
  replace_regex = "[.]|[_]|[-]",
  force_new = F
)

Arguments

clusts

data.frame/data.table with the per-cell meteadata and cluster assignments.

label_var

Which cell metadata column to input to tf-idf enrichment analysis.

cluster_var

Which cell metadata column to use to identify which cluster each cell is assigned to.

terms_per_cluster

The number of top significantly enriched terms to include per cluster.

replace_regex

Characters by which to split label_var into terms (i.e. tokens) for tf-idf enrichment analysis.

force_new

If tf-idf results are already detected the metadata, set force_new=T to replace them with new results.