Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with cnetplot from compareClusterResult #311

Open
guidohooiveld opened this issue Feb 11, 2025 · 0 comments
Open

issues with cnetplot from compareClusterResult #311

guidohooiveld opened this issue Feb 11, 2025 · 0 comments

Comments

@guidohooiveld
Copy link

@GuangchuangYu

I am facing some issues when customizing the cnetplot that is generated from the results from a compareCluster analysis. Specifically, the size of the nodes cannot be increased. See plots below, specifically p4.

For comparison I have also included the output from cnetplot obtained after analyzing a single dataset (p1 - p2); these are all properly generated!

I believe this issue also relates to a similar issue reported for emapplot reported here: #308

Thanks in advance for having a look at this!

> library(clusterProfiler)
> library(enrichplot)
> library(org.Hs.eg.db)
> library(ggtangle)
> 
> ## example list of genes
> data(geneList, package="DOSE")
> genes <- names(geneList)[abs(geneList) > 2]
> 
> res <- enrichKEGG(gene = genes,
+                   organism = "hsa",
+                   keyType = "kegg",
+                   pvalueCutoff = 0.05,
+                   pAdjustMethod = "BH",
+                   minGSSize = 10,
+                   maxGSSize = 500)
Reading KEGG annotation online: "https://rest.kegg.jp/link/hsa/pathway"...
Reading KEGG annotation online: "https://rest.kegg.jp/list/pathway/hsa"...
> ## to increase readability, convert entrezid into symbols
> ## also calculate pairwise similarities (is in essence only applicable
> ## to GO terms, but just to be sure
> 
> res <- setReadable(res, OrgDb = org.Hs.eg.db, keyType="ENTREZID")
> res <- pairwise_termsim(res)
> 
> ## default plot
> p1 <- cnetplot(res,
+                layout = igraph::layout_nicely, ## default layout
+                showCategory = 3,
+                size_category = 1) ## default value
> print(p1)
> 

Image

> ## increase size of 'category' to 4
> ## WORKS!
> p2 <- cnetplot(res,
+                layout = igraph::layout_nicely,
+                showCategory = 3,
+                size_category = 4)
> print(p2)
> 

Image


> ###
> ## repeat, but now use output of compareCluster
> ###
> 
> ## load example input compareCluster 
> data(gcSample, package="clusterProfiler")
> 
> ck <- compareCluster(geneCluster = gcSample,
+                     fun = enrichKEGG,
+                     organism     = 'hsa',
+                     pvalueCutoff = 0.05)
> 
> ck <- setReadable(ck, OrgDb = org.Hs.eg.db, keyType="ENTREZID")
> ck <- pairwise_termsim(ck)
> 
> 
> ## default plot
> p3 <- cnetplot(ck,
+                layout = igraph::layout_nicely, ## default layout
+                showCategory = 1,
+                size_category = 1) ## default value
> print(p3)
Warning messages:
1: Removed 1204 rows containing non-finite outside the scale range (`stat_pie()`). 
2: ggrepel: 39 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
>

Image

> ## increase size of 'category' to 4
> ## DOESN'T WORK! Node are not increased
> p4 <- cnetplot(ck,
+                layout = igraph::layout_nicely,
+                showCategory = 1,
+                size_category = 4)
> print(p4)
Warning messages:
1: Removed 1204 rows containing non-finite outside the scale range (`stat_pie()`). 
2: ggrepel: 37 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
> 

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant