I am working on a project that studies how gene expression may change across generations with repeated treatment. I have 5 generations that I'm looking at and each generation consists of 3 biological replicates for the control and the treated condition.
So essentially I have:
- 1st generation untreated sample 1-3 , 1st generation treated sample 1-3
- 2nd generation untreated sample 1-3, 2nd generation treated sample 1-3
- etc
I have been making heat maps for each generation separately but ideally I wanted to have all 5 generations on one heat map so that it is easier to see how different gene expression change after each generation. This issue I am running into is that the list of genes on each heatmap is different and so I can't exactly just put the 5 individual heat maps side by side. Is there a way on R to make sure the list of genes stays consistent across all 5 generations?
If you want to keep all genes between all heatmaps, you can use something like
full_join
. If you only want the genes that are represented in each data set, you can use something likeleft_join
. Personally, I find it easier to do everything as a data.frame or tibble then convert to matrix before plotting.What you should do is subset your count matrix using a union of all 5 gene sets. You can then visually separate the generations in ComplexHeatmap using the
column_split
argument.