I'm trying to create a heatmap to display mutation distribution for my data using R.
Here's a snapshot of my data
TCGA_ID Gene_Name Effect
TCGA-A5-A0VP FCGR2A splice_donor_variant
TCGA-BG-A18B FCGR2A splice_donor_variant
TCGA-A5-A0VO FCGR2A stop_gained
I want to plot a heatmap at which x-axis is "TCGA_ID" and Y-axis is "Gene_name" and using "Effect" as a filling.
I use this code to create the heatmap
library(ggplot2)
all_data<- read.table("subset.txt", sep= "\t", header = T)
all_data.m <- melt(all_data)
p <- ggplot(all_data.m, aes( x=TCGA_ID , y= Gene_Name)) + geom_tile(aes(TCGA_ID) , colour= "blue")
This is how the plot looks like
My problems are:
1) How to expand the Y-axis so that the labels are not on top of each other
2) How to change the label on X-axis so that they are vertical and hence readable
3) How to change the colours based on different types of "Effect" . Do I need to use something like scale_fill_manual ?
My goal is to create a heatmap that looks like this