How to colour points in cnetplot of clustprofiler?
0
0
Entering edit mode
18 months ago
DN99 ▴ 20

I have a cnetplot from running enrichment with kegg using clusterprofiler. I have scores input as the fold change but for each gene in the plot they are not varying in colour to show their difference in the fold change score.

My dataset is genes of entrez IDs and then each gene has a score from 0.5-0.9 (instead of fold change) that I want to be able to see by colour code in the plot, is this possible or does the foldchange parameter only use fold change measures?

For example my data looks like this:

Gene   Score
1234    0.9
5678    0.83
91011  0.89


I am then coding to get the cnetplot with:

kegg_enrich <-  enrichKEGG(gene   = df$Gene, organism = 'hsa', pvalueCutoff = 0.05, pAdjustMethod = 'fdr') kegg <- setReadable(kegg_enrich, 'org.Hs.eg.db', 'ENTREZID') kegg_genes <- kegg[,] gene_list_scores <- df$Scores
gene_list_scores<-na.omit(gene_list_scores)
gene_list_scores = sort(gene_list_scores, decreasing = TRUE)

gene_of_interest <- dplyr::filter(kegg_genes, grepl('PTK2', geneID))
gene_of_interest<- enrichDF2enrichResult(gene_of_interest)

options(ggrepel.max.overlaps = 1000)
pother <- cnetplot(gene_of_interest, foldChange=gene_list_scores)
pother + scale_color_gradientn(name = "Score", colours = c("blue", "red"))


I am expecting the foldChange=gene_list_scores to enable each gene in the plot to be coloured by their score in my data but the plot output looks like:

clusterprofiler cnetplot R • 1.2k views
0
Entering edit mode

Probably you need to enable colorEdge = TRUE.

0
Entering edit mode

Thank you for this, using colorEdge = TRUE alone only makes the lines coloured for some reason, but trying out the code from the link adds a colour scale legend, although still doesn't colour each gene point in - but from this I can see new ways to try out to get the syntax to work, thank you for your help!

0
Entering edit mode

Hi, did you manage to figure this out? I am also stuck due to the same problem, would appreciate any help on figuring this out!