Dot Plot using KEGG
2
0
Entering edit mode
18 months ago

Hi, I´m trying to do a dotplot using data from KEGG. I have my data represented, but I don´t want the species name in the X axis. My comand is:

kegg_gene_list = sort(kegg_gene_list, decreasing = TRUE)
kegg_gene_list = sort(kegg_gene_list, decreasing = TRUE)
kegg_organism = "mmu"
kk2 <- gseKEGG(geneList     = kegg_gene_list,
               organism     = kegg_organism,
               pvalueCutoff = 0.9,
               pAdjustMethod = "none",
               keyType       = "ncbi-geneid")

kk2x <- setReadable(kk2, 'org.Mm.eg.db', 'ENTREZID')
dotplot(kk2x, showCategory=15, font.size=9, label_format= 100, title = "Enriched Pathways" , split=".sign") + facet_grid(.~.sign).

And I get

test

KEGG DotPlot GO • 1.9k views
ADD COMMENT
1
Entering edit mode
18 months ago

If you want to stick with the native clusterProfiler plotting functions you should be able to modify the slot holding pathway names.

kk2x@result$Description <- gsub(kk2x@result$Description, pattern="\\s-\\sMus.+$", replacement="")

It's not ideal to modify slots directly, so the more proper alternative would be to convert it into a data.frame with as.data.frame(kk2x) and manually make the plot with ggplot2. Just know that slot names are not guaranteed to be documented in package updates, so may break in the future.

ADD COMMENT
0
Entering edit mode

Thanks, I tried this and it works.

ADD REPLY
0
Entering edit mode
18 months ago
Trivas ★ 1.8k

If you're able to get the data from this function (some packages use returnData = FALSE by default) then you can easily do this in ggplot and add the following:

kegg_gene_list <- kegg_gene_list %>% str_split(" - ", simplify=TRUE) %>% .[,1]

or

kegg_gene_list <- kegg_gene_list %>% str_replace(" - Mus musculus (house mouse)", "")

The first example is looking for the hyphen and splitting the character vector then selecting the first chunk which corresponds to your pathway. The second is directly replacing the hyphen and species with an empty character. Functionally equivalent, but the latter requires manipulation if you were to change species.

ADD COMMENT
0
Entering edit mode

Thank you, I tried first the other answer (rpolicastro).

ADD REPLY

Login before adding your answer.

Traffic: 2570 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6