# Ploting FDR along with the pathway as heatmap any simple way

I have this data from one of the cluster which show pathway in context of those genes but when i do a bit of filtering i see plenty of pathways with same or similar FDR which are sort of redundancy i suppose in terms of over-representation ,so i came up something like this

may be i need a bit more streamlining into it which as of now i can;t think up.

So few question just as in terms of gene clustering can i cluster those FDR or say same or similar FDR are getting clustered together which might be helpful in a way to concise and precise the result a bit better .

My data

structure(list(Function = c("covalent chromatin modification",
"histone modification", "histone methyltransferase complex",
"SWI/SNF superfamily-type complex", "histone methyltransferase activity",
"N-methyltransferase activity", "methyltransferase complex",
"protein methyltransferase activity", "histone methylation",
"protein alkylation", "protein methylation", "macromolecule methylation",
"methylation", "methyltransferase activity", "transferase activity, transferring one-carbon groups",
"DNA helicase complex", "Ino80 complex", "peptidyl-lysine modification",
"SWI/SNF complex", "protein-DNA complex disassembly", "nucleosome disassembly",
"chromatin remodeling", "chromatin disassembly", "protein-DNA complex subunit organization",
"BAF-type complex", "INO80-type complex", "histone-lysine N-methyltransferase activity",
"histone acetyltransferase complex", "nucleosome organization",
"lysine N-methyltransferase activity", "protein-lysine N-methyltransferase activity"
), variable = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "FDR", class = "factor"),
value = c(1.47992665134053e-13, 1.47992665134053e-13, 7.9468967129082e-09,
7.9468967129082e-09, 1.1841058070482e-08, 1.75996948641137e-08,
1.75996948641137e-08, 4.71690557750932e-08, 9.63620605173175e-08,
3.94626427029223e-07, 4.55323040178062e-07, 4.55323040178062e-07,
4.55323040178062e-07, 8.9471201991238e-07, 1.38187416380405e-06,
2.07900888100729e-06, 2.60629648189489e-05, 2.60629648189489e-05,
2.91531936861022e-05, 3.19327841103331e-05, 5.04466386223372e-05,
5.04466386223372e-05, 5.45938617344686e-05, 5.4956792922593e-05,
5.4956792922593e-05, 5.4956792922593e-05, 8.32575963760242e-05,
0.000287420280100368, 0.000372921199469602, 0.000387140224358431,
0.000447883223319561, 0.000447883223319561)), row.names = c(NA,
-32L), class = "data.frame")


My code

p <- ggplot(aes(x=Function, y=variable, fill=value), data=plot.data)
fig <- p + geom_tile() + scale_fill_gradient2(low="blue", mid="white", high="red") +
#   geom_text(aes(label=stars, color=value), size=8) + scale_colour_gradient(low="grey30", high="white", guide="none") +
#geom_text(aes(label=stars), color="black", size=5) +
#labs(y=NULL, x=NULL, fill="t-value") + geom_vline(xintercept=1.5, size=1.5, color="grey50") +
theme_bw() + theme(axis.text.x=element_text(angle = -45, hjust = 0))
fig


Any help or suggestion or help would be highly appreciated

• Thanks for providing the data and the code to reproduce the upper image. But how it is related to the second image below? The redundancy you refer is that pathways have more or less with the same genes or because they have similar FDR values? (I understand that you want to reduce from 32 pathways to less pathways)
– llrs
Jan 11 '19 at 15:15
• "But how it is related to the second image below" not related perhaps that was the simpler way to convey what im trying to do . "I understand that you want to reduce from 32 pathways to less pathways)" yes that is what my goal is to ,not sure if its conceptually correct but a little search tells me there are very related may be few genes apart. Second image sorry I mean from the second image i would like to do the figure2 the middle image in the second figure where modules are plotted
– kcm
Jan 11 '19 at 16:11
• The modules mean that they separated somehow the genes and still in several grouping the GO terms appear enriched. It is possible to see which pathways are similar. See this question of mine and the solutions proposed
– llrs
Jan 11 '19 at 16:16
• Possible duplicate of How to select the most representative pathways from a gene enrichment analysis?
– llrs
Jan 11 '19 at 16:17
• Oh, you refer to the dendrogram clustering the GO terms! Yes, you can calculate the similarity of the pathways: you can use BioCor (which I am the author) for that. Afterwards order them according to their similarity
– llrs
Jan 11 '19 at 16:42