jmw86069 / multienrichjam

Analysis and Visualization of Multiple Gene Set Enrichments
24 stars 4 forks source link

Disable gene name in cnetplotJam #5

Closed nickhir closed 3 years ago

nickhir commented 3 years ago

Quick question: Is it possible to disable the display of the gene name in the cnetplotJam() function? E.g. only the nodes should be annotated with the category name. The result would look similar to cnetplot(edox, node_label="category") from the enrichplot. I looked through the internet and tried didn't settings, but I didn't manage.

Thanks!

jmw86069 commented 3 years ago

Hi, sorry I didn't see this issue sooner!

I think the answer is yes, if I understand correctly.

I do quite a bit of manipulating the Cnet plot figures also. I notice that in my work I usually add a node attribute "nodeType" that helps describe Gene and Set nodes. I updated the package to include this attribute, which will help determine which nodes are genes.

The output of cnetplotJam() is an igraph object, which when plotted uses node labels with either V(g)$label, or if that does not exist it usesV(g)$name.

If you update the multienrichjam package (version 0.0.39.900 or higher), the code below should work to change gene labels to "" thus hiding them in the figure.

g <- cnetplotJam(...)
V(g)$label <- ifelse(
   V(g)$nodeType %in% "Set",
   V(g)$name,
   "")
plot(g)

Hopefully this works for what you're trying to do, otherwise let me know and I'll adjust.