Get startedGet started for free

Heat map

Before moving on to the details of the ChIP-seq workflow in the next chapter, you have the opportunity here to preview some of the results of the analysis.

In this exercise, you will be looking at how to visualize differences between samples using heat maps. The data has already been loaded and is formatted to allow plotting with the heatmap() function.

The sample correlation matrix is available as sample_cor and normalized read counts for each peak are stored in the read_counts object. In both cases, the first two samples are from primary tumors, the final two are treatment resistant.

You can pass a vector of group labels to the ColSideColors and RowSideColors arguments in the heatmap() function to highlight which samples belong to the same group.

This exercise is part of the course

ChIP-seq with Bioconductor in R

View Course

Exercise instructions

  • Create a vector of color names that can be used to label groups in the plot.
  • Plot the sample correlation matrix sample_cor as a heat map.
  • Create a heat map of peak read counts.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a vector of colors to label groups (there are 2 samples per group)
group <- c(primary = rep("blue", ___), TURP = rep("red", ___))

# Plot the sample correlation matrix `sample_cor` as a heat map
# Use the group colors to label the rows and columns of the heat map
heatmap(___, ColSideColors = ___, RowSideColors = ___, 
        cexCol = 0.75, cexRow = 0.75, symm = TRUE)

# Create a heat map of peak read counts
# Use the group colors to label the columns of the heat map
___(___, ColSideColors = ___, labRow = "", cexCol = 0.75)
Edit and Run Code