text: user2531: I am analysing RNA-Seq data for a set of genes from different human brain regions using data from the Allen Brain Atlas. I have made a heatmap using GraphPad Prism. In this heatmap, I show the average RPKM value for each gene of interest for each brain region (the average is taken as there are multiple samples for each brain region).
  I am new to creating heatmaps but I know that you can use different methods to cluster the heatmap so that the data is more easy to interpret. I want to cluster the heatmap so that the brain regions which have the highest level of gene expression overall are grouped together.
  I have seen online that R can also be used to create a heatmap, and I have had previous experience with R. Does anyone have any recommendations on any good tutorials (that are not too difficult) on creating heat-maps in R as well as clustering the data?
  
  user-1: For visualization of expression values it usually makes sense to standardize the data first. The problem with plain expression values is that they differ a lot between genes and as such highly-expressed genes dominate the color scale. As you see in your heatmap, the first and last rows barely show any difference because the color scale is dominated by a single gene CHL1. Therefore the clustering would be due to expression level and not due to differences between columns. For this we standardize the data. Assuming your expression matrix had RPKMs (or similar values) we first log2-transform it and then standardize:
  
  mat_log2 <- log2(mat+1)
  
  #/ standardize (Z = Z-scored)
  mat_Z <- t(scale(t(mat_log2)))
  
  #/ cluster rows:
  hclust_row <- hclust(dist(mat_Z), method="ward.D2")
  
  #/ cluster columns (optional)
  hclust_col <- hclust(dist(t(mat_Z)), method="ward.D2")
  
  #/ plot heatmap:
  library(ComplexHeatmap)
  
  hm <- 
    Heatmap(matrix=mat_Z,
            cluster_rows=hclust_row, 
            cluster_columns=hclust_col,
            name="relative expression")
  draw(hm)
  
  
  See the ComplexHeatmap documentation for details on the package itself, it is very powerful but also monolithic. This is just an example, any other heatmap package will do fine as well.
  Important is to standardize data to put emphasis on differences between columns rather than on absolute expression levels.
  
original_text: 2531: <p>I am analysing RNA-Seq data for a set of genes from different human brain regions using data from the Allen Brain Atlas. I have made a heatmap using <a href="https://www.graphpad.com/scientific-software/prism/" rel="nofollow noreferrer"><strong>GraphPad Prism</strong></a>. In this heatmap, I show the average RPKM value for each gene of interest for each brain region (the average is taken as there are multiple samples for each brain region).</p>
  <p>I am new to creating heatmaps but I know that you can use different methods to cluster the heatmap so that the data is more easy to interpret. I want to cluster the heatmap so that the brain regions which have the highest level of gene expression overall are grouped together.</p>
  <p>I have seen online that <code>R</code> can also be used to create a heatmap, and I have had previous experience with <code>R</code>. Does anyone have any recommendations on any good tutorials (that are not too difficult) on creating heat-maps in <code>R</code> as well as clustering the data?</p>
   -1: <p>For visualization of expression values it usually makes sense to standardize the data first. The problem with plain expression values is that they differ a lot between genes and as such highly-expressed genes dominate the color scale. As you see in your heatmap, the first and last rows barely show any difference because the color scale is dominated by a single gene CHL1. Therefore the clustering would be due to expression level and not due to differences between columns. For this we standardize the data. Assuming your expression matrix had RPKMs (or similar values) we first log2-transform it and then standardize:</p>
  <pre class="lang-r prettyprint-override"><code>
  mat_log2 &lt;- log2(mat+1)
  
  #/ standardize (Z = Z-scored)
  mat_Z &lt;- t(scale(t(mat_log2)))
  
  #/ cluster rows:
  hclust_row &lt;- hclust(dist(mat_Z), method=&quot;ward.D2&quot;)
  
  #/ cluster columns (optional)
  hclust_col &lt;- hclust(dist(t(mat_Z)), method=&quot;ward.D2&quot;)
  
  #/ plot heatmap:
  library(ComplexHeatmap)
  
  hm &lt;- 
    Heatmap(matrix=mat_Z,
            cluster_rows=hclust_row, 
            cluster_columns=hclust_col,
            name=&quot;relative expression&quot;)
  draw(hm)
  
  </code></pre>
  <p>See the <a href="https://jokergoo.github.io/ComplexHeatmap-reference/book/" rel="nofollow noreferrer">ComplexHeatmap</a> documentation for details on the package itself, it is very powerful but also monolithic. This is just an example, any other heatmap package will do fine as well.</p>
  <p>Important is to standardize data to put emphasis on differences between columns rather than on absolute expression levels.</p>
  