I have made a heatmap based on following script.
#load the library
library(pheatmap)
#set label font
par(cex.lab=1.5) # is for y-axis
par(cex.axis=1.5) # is for x-axis
#Set the working directory
setwd("F:\\User\\OneDrive\\data\\final\\Rcode")
#hedge
#read the expression matrix
hedge <- read.table("hedge.txt",sep="\t",header = TRUE)
#Group the data in the frame
group_df = data.frame(Groups=rep(c("AP","CP","BP"),c(6,42,28)))
#Assign the col name to the matrix
rownames(group_df) = colnames(hedge)[2:ncol(hedge)]
#Assign the rownames
rownames(hedge) = hedge[,1]
#plot the heatmap with specific split
pheatmap(hedge[,-1],cluster_cols=FALSE,
annotation_col=group_df, gaps_col = cumsum(c(6,42,28)))
I got following heatmap from the code:
Now I want to extract and replot a subplot from the main heatmap using gene set of my interest (CD34, CD117, CD38, SHH, GLI1, GLI2, GLI3, BCL2, PTCH1, PTCH2, SMO). How can I do this?