library(tidyverse) library(ComplexHeatmap) library(circlize) library(GGally) library(pareg) data(pathway_similarities, package = "pareg") set.seed(42)
Pathway similarities describe how similar two pathways are (you're welcome). For example, when interpreting pathways as gene sets, one could count how many genes are shared between two sets. Many more sophisticated methods, such as the Jaccard index, exist [@simplifyEnrichment].
pareg
provides various pre-computed similarity measures (r names(pathway_similarities[[1]])
) for selected pathway databases (r names(pathway_similarities)
) in matrix form.
mat <- pathway_similarities$`C2@CP:KEGG`$jaccard %>% as_dense_sim() mat[1:3, 1:3] Heatmap( mat, name = "similarity", col = colorRamp2(c(0, 1), c("white", "black")), show_row_names = FALSE, show_column_names = FALSE )
On the Gene Ontology's Biological Process subcategory, we can observe how much pathway similarity measures can differ from each other.
df_sim <- pathway_similarities$`C5@GO:BP` %>% map_dfr(function(mat) { if (is.null(mat)) { return(NULL) } mat %>% as_dense_sim() %>% as.data.frame %>% rownames_to_column() %>% pivot_longer(-rowname) }, .id = "measure") %>% filter(value > 0) %>% pivot_wider(names_from = measure, values_from = value) %>% select(-rowname, -name) ggpairs(df_sim) + theme_minimal()
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.