This is a test version of Biostars. For the public version, visit https://www.biostars.org.
heat map code not working

hii everyone,

I am trying to create a heatMAP from my RNAseq data but it seems that this code is using ALL of the genes, so I get a heat map that is pretty much impossible to read. Is there a way to filter and only use for example the significant values? Or even select which genes I want to include in the heat map?

library(DESeq2)
library(ggplot2)
library(ComplexHeatmap)

sigs2h <- read.csv("deseq2_analysis/DFE_condition_pri_vs_Control2h.csv")
sigs2h

mat <- counts(dds, normalized = T)

mat.z <- t(apply(mat,1,scale))
colnames(mat.z) <- rownames("samples_round2h.txt")

#mat.z [is.na(mat.z)] = 0 
mat.z[is.na(mat.z)] = 0
Heatmap(mat.z, cluster_rows = T, cluster_columns = T, column_labels = colnames(mat.z), name ="Z=score")
deseq2 rnaseq heatmap complexheatmap

1 answer

  1. Usually, it's better to use the output of vst rather than plotting the counts after scale, it will keep the variance constant.
  2. If you want to select the genes from a list you should subset the matrix, simply run:

    glist <- # A list of genes

    mat.s <- mat[, glist]

    Heatmap(mat.s ...

Log in to answer this question.