**470**wrote:

Hi,

I am bit lost with the heatmap in R.

I have 4 groups of sample, group 1 (untreated) has 5 sample, group2 (treatment1) has 15 samples, group3 (treatment2) has 11 samples and group4 (treatment3) has 21 samples.

The question that I am trying to answer is to generate a heatmap, that can point the DEG across these groups. The values are in log2.

I know, how to do this in R with two samples (Control Vs Treatment) but not with so many samples with different types of treatments.

A figure like this will be helpful https://www.google.be/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwiXq6iO19PJAhVFuBoKHdJQATsQjRwIBw&url=http%3A%2F%2Fwww.mdpi.com%2F1422-0067%2F16%2F10%2F24555%2Fhtm&psig=AFQjCNFUuwoZ-A9VIBWPow7E81Izai33tw&ust=1449918885050234

Or even better representation is welcomed.

Also, How could one find DEG across all groups with some p-value associated with it

Can anyone help?

Thank you

I think you should consider mapping your patients groups to different colours and plotting this alongside your heatmap with ColSideColors option. You can have a look at this post: http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/heatmap/ . If you have more than two groups, you just have to modify this function:

to something like this:

Also, I think most of the tools for DGE handle more than two groups: DESeq2 and edgeR for sure do.

300