<p>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 <a href="https://i.sstatic.net/3uypv.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3uypv.jpg" alt="pathway"></a></p>

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

<p>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 .</p>

<p>My data </p>

<pre><code>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", 
"S-adenosylmethionine-dependent methyltransferase activity", 
"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")
</code></pre>

<p>My code</p>

<pre><code>p &lt;- ggplot(aes(x=Function, y=variable, fill=value), data=plot.data)
fig &lt;- 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
</code></pre>

<p><a href="https://i.sstatic.net/I42lS.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/I42lS.jpg" alt="I would like to replicate something like the middle one "></a></p>

<p>Any help or suggestion or help would be highly appreciated </p>

CC BY-SA 4.0
2019-01-11T15:15:18.127Z
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
CC BY-SA 4.0
2019-01-11T16:11:29.873Z
"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
CC BY-SA 4.0
2019-01-11T16:16:40.313Z
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](https://bioinformatics.stackexchange.com/q/254/48) of mine and the solutions proposed
llrs
CC BY-SA 4.0
2019-01-11T16:17:09.650Z
Possible duplicate of [How to select the most representative pathways from a gene enrichment analysis?](https://bioinformatics.stackexchange.com/questions/254/how-to-select-the-most-representative-pathways-from-a-gene-enrichment-analysis)
llrs
CC BY-SA 4.0
2019-01-11T16:31:30.497Z
okay let me check , not sure about the duplicate but again let me go though it
kcm
CC BY-SA 4.0
2019-01-11T16:36:56.783Z
looks like its not a simple visualization problem of FDR and pathway i have find out first the overlapping gene it seems there was a similar solution proposed on biostar which i had used where genes along with the pathway were plot , but this looks the second fig2 more simpler in terms of providing information overall .
kcm
CC BY-SA 4.0
2019-01-11T16:42:28.937Z
Oh, you refer to the dendrogram clustering the GO terms! Yes, you can calculate the similarity of the pathways: you can use [BioCor](https://bioconductor.org/packages/BioCor) (which I am the author) for that. Afterwards order them according to their similarity
llrs
CC BY-SA 4.0
2019-01-11T17:33:26.657Z
okay cool to know will try it out
kcm
<r><visualization>
Ploting FDR along with the pathway as heatmap any simple way
# Ploting FDR along with the pathway as heatmap any simple way

(Asked by: username_0 on 2019-01-11)

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", 
"S-adenosylmethionine-dependent methyltransferase activity", 
"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

**Tags:** r, visualization
> **Comments:**
> **username_1**: 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)  
> **username_0**: "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  
> **username_1**: 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](https://bioinformatics.stackexchange.com/q/254/48) of mine and the solutions proposed  
> **username_1**: Possible duplicate of [How to select the most representative pathways from a gene enrichment analysis?](https://bioinformatics.stackexchange.com/questions/254/how-to-select-the-most-representative-pathways-from-a-gene-enrichment-analysis)  
> **username_0**: okay let me check , not sure about the duplicate but again let me go though it  
> **username_0**: looks like its not a simple visualization problem of FDR and pathway i have find out first the overlapping gene it seems there was a similar solution proposed on biostar which i had used where genes along with the pathway were plot , but this looks the second fig2 more simpler in terms of providing information overall .  
> **username_1**: Oh, you refer to the dendrogram clustering the GO terms! Yes, you can calculate the similarity of the pathways: you can use [BioCor](https://bioconductor.org/packages/BioCor) (which I am the author) for that. Afterwards order them according to their similarity  
> **username_0**: okay cool to know will try it out  

---

## 0 answers

