How to colour points in cnetplot of clustprofiler?
Entering edit mode
10 weeks ago
DN99 • 0

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, '', 'ENTREZID')
kegg_genes <- kegg[,]

gene_list_scores <- df$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:

enter image description here

clusterprofiler cnetplot R • 201 views
Entering edit mode

Probably you need to enable colorEdge = TRUE.

Follow this link for detailed syntax.

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!


Login before adding your answer.

Traffic: 1655 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6