noriakis / ggkegg

Analyzing and visualizing KEGG information using the grammar of graphics
https://noriakis.github.io/software/ggkegg
MIT License
201 stars 16 forks source link

Issue Annotating Raw KEGG Map #11

Closed Ramirj closed 7 months ago

Ramirj commented 7 months ago

Hi @noriakis,

I'm trying to highlight specific gene nodes on raw KEGG maps using ggkegg but for some reason it isn't working for me. Is it possible to achieve this using this package? This is the code that I tried to use:

reaction <- c("rn:R00756") g <- pathway("dosa00010") |> mutate(mod=highlight_set_nodes(reaction, how="all")) ggraph(g, layout="manual", x=x, y=y)+ geom_node_rect(fill="grey",aes(filter=type == "ortholog"))+ overlay_raw_map("dosa00010")+ geom_node_point(aes(filter=type == "reaction"), shape=21, fill="blue", color="black", size=2)+ ggfx::with_outer_glow( geom_node_point(aes(filter=mod, x=x, y=y), color="red",size=2), colour="yellow",expand=5 )+ theme_void()

And this is the resulting plot:

Screenshot 2023-11-30 at 4 11 40 PM

I didn't receive any error messages or anything, but the gene node that I wanted to highlight was not highlighted. If you could provide some insight that would be great. Thank you!

noriakis commented 7 months ago

Hi, highlight_set_nodes searches for the name column in node data by default as described in the manual. You should change name argument to reaction if you search for the reaction column, like:

highlight_set_nodes(highlight_reaction, name="reaction", how="all")

I think raising the warning or the message could be useful if none of the nodes is highlighted. I will update the feature in dev.

noriakis commented 7 months ago

In highlight_set_nodes of the devel branch, the message will be shown when there are no nodes highlighted (or all nodes are highlighted). Feel free to reopen the issue if you encounter the other issue.

commit 12587f486db195a2ca5056081744bddb34922b31