Closed Ramirj closed 10 months ago
Hi @Ramirj, I have made highlight_entities
accept named numeric vector in devel
and main
branch.
So you can do something like:
vecs <- c(-1, 1) |> setNames(c("CDKN2A","CDC45"))
highlight_entities("hsa04110", vecs, legend_name="interesting")
Make sure you specify which column to search for by name
argument. In you case I think it should be reaction
.
Hi @noriakis,
Thanks for the help, I read through the documentation and was able to figure out a way to visualize LFCs on raw KEGG maps. I just had to add the overlay_raw_map function to my original code. Here's the code I made in case anyone else has a similar issue:
library(ggkegg) library(BiocFileCache)
url <- paste0("https://rest.kegg.jp/link/reaction/ec") bfc <- BiocFileCache() path <- bfcrpath(bfc, url) convert <- data.frame(data.table::fread(path, header = FALSE, sep = "\t")) rntoec <- convert$V1 |> strsplit(":") |> vapply("[", 2, FUN.VALUE = "a") |> setNames(convert$V2)
g <- pathway("dosa00010") |> #change depending on pathway you want to map mutate(ec = rntoec[reaction])
nodes_to_highlight <- reaction
LFC_vector <- LFCs
g <- g %>% mutate(LFC = ifelse(reaction %in% nodes_to_highlight, LFC_vector, NA))
gg <- g |> filter(type %in% c("compound", "gene")) |> ggraph(layout = "manual", x = x, y = y) + geom_node_rect(aes(fill = LFC), size = 5) + scale_fill_viridis_c(option = "viridis", direction = 1, begin = 0.60, end = 1) + # Customize color scale overlay_raw_map("dosa00010")+ theme_void()
gg
ggsave("whatever.png", gg, width = 10, height = 6, units = "in", dpi = 300)
Hi @noriakis,
Is it possible to use this package to visualize LFCs for target genes on raw KEGG Maps? For example, this image:
I already have a list of reaction numbers and corresponding LFCs for the genes I'm interested in, I just don't know how to write a code that can achieve this