I have 31 samples,and get 31 type of samples, such "a","b","c","d",but when i draw heatmap,it say the subscript out.I have check the columns of the matrix is 31 ,which is the same as the number of types.
ha1 = HeatmapAnnotation( bar = c("b","d","d","b","b","c","b","a","b"
,"b","a","d","b","b","c","c","a","b"
,"d","c","c","d","b","b","b","d","a"
,"c","c","b","c"),
col = list(bar = c("a" = "red", "b" = "green", "c" = "blue","d"="black"))
)
ha = rowAnnotation(foo = anno_mark(at = seq(0,7000,1000), labels = seq(0,7000,1000)))
hist_major <- Heatmap(major,
column_title = "Statistics for a list of SNP.Frequency.major",
column_title_gp = gpar(fontsize = 15, fontface = "bold"),
column_names_gp = gpar(fontsize = 10),
row_title = "Genome Postion(bp)",
row_title_gp = gpar(fontsize = 10),
name = "Variant.Frequency",
cluster_rows = FALSE,
column_order=order(as.numeric(gsub("SAMN041259", "", colnames(major)))),
show_column_dend = FALSE,
right_annotation = ha,
bottom_annotation = ha1,
show_row_names = FALSE,
use_raster= TRUE,
raster_resize_mat = max,
col = cols,
border_gp = gpar(col = "black", lty = 2)
)
