text: user4595: I have a heatmap
  I see a block of genes for a group of samples
  How I can select a part of heatmap?
  I mean is there any way to export a list of genes from rows of a heatmap in R?
  I have tried which returns nothing
  > library(ComplexHeatmap)
  
  > ht = Heatmap(heat1) 
  > ht[1:35,1:5]
  
  
  user650: You're using ComplexHeatmap, which is pretty easy to subset. Your subset operation creates a subset object of the heatmap, not of the data in the heatmap.
  In case you don't want to run hclust outside of the CH, you can use row_order and column_order to re-order your data in the CH display order.
  library(ComplexHeatmap)
  
  ht = Heatmap(heat1)
  r_o <- row_order(ht)
  c_o <- column_order(ht)
  heat1_reordered <- heat1[r_o, c_o]
  heat1_reordered[1:35,1:5]
  
  CH does say that clustering is oly "fixed" on drawing, so you may want to run this before picking the row and column orders:
  pdf(NULL)
  ht <- draw(ht)
  dev.off()
  
  
original_text: 4595: <p>I have a heatmap</p>
  <p>I see a block of genes for a group of samples</p>
  <p>How I can select a part of heatmap?</p>
  <p>I mean is there any way to export a list of genes from rows of a heatmap in R?<a href="https://i.stack.imgur.com/yTNPp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yTNPp.png" alt="enter image description here" /></a></p>
  <p>I have tried which returns nothing</p>
  <pre><code>&gt; library(ComplexHeatmap)
  
  &gt; ht = Heatmap(heat1) 
  &gt; ht[1:35,1:5]
  </code></pre>
   650: <p>You're using ComplexHeatmap, which is pretty easy to subset. Your subset operation creates a subset object of the heatmap, not of the data in the heatmap.</p>
  <p>In case you don't want to run hclust outside of the CH, you can use <code>row_order</code> and <code>column_order</code> to re-order your data in the CH display order.</p>
  <pre><code>library(ComplexHeatmap)
  
  ht = Heatmap(heat1)
  r_o &lt;- row_order(ht)
  c_o &lt;- column_order(ht)
  heat1_reordered &lt;- heat1[r_o, c_o]
  heat1_reordered[1:35,1:5]
  </code></pre>
  <p>CH does say that clustering is oly &quot;fixed&quot; on <code>draw</code>ing, so you may want to run this before picking the row and column orders:</p>
  <pre><code>pdf(NULL)
  ht &lt;- draw(ht)
  dev.off()
  </code></pre>
  