This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Heatmap outputs unusual plot

I am not sure where I am making the error

#sort by log2FC
sortedbyLFC <- DESeq2resultsSTARalignment.tabular[order(-DESeq2resultsSTARalignment.tabular$log2.FC.), ]

#create dataframe
sorteddataframe <- data.frame(sortedbyLFC, row.names = "GeneID")
first5000genes <- head(sorteddataframe,5000)
first5000genes

#create heatmap
pheatmap(first5000genes)

The output is below https://imgur.com/MkYgkvo

rna-seq heatmap deseq2

Please see How to add images to a Biostars post to add your images properly. You need the direct link to the image, not the link to the webpage that has the image embedded (which is what you have used here)

that is not the way to draw heatmap. For the first 5000 genes, extract expression values (for each gene across samples) from the expression matrix, then plot heatmap.

1 answer

Either you wish to plot a heatmap of gene expression or you shouldn't really be using a heatmap.

If you are sure you should be using a heatmap (you're plotting gene expression), make sure that the 2D structure (data.frame or matrix) that you're plotting has samples as row names, genes as column names and that the actual columns are only expression values. You're plotting raw DESeq2 output, which has log fold change and p values.

Log in to answer this question.