最后发布时间:2024-02-12 22:01:57
heatmap <- function(count,diff){
sig_res <- arrange(diff,pvalue ) # filter( diff, pvalue < 0.5 )
if(nrow(sig_res) >= 30){
sig_res <- sig_res[1:30,]
}else{
sig_res <- sig_res[1:nrow(sig_res),]
}
sig_count_df <- count[rownames(sig_res),]
group <- c("darkred","darkblue")
names(group) <- contrast
annoCol<-list(group=group)
p <- pheatmap(sig_count_df,
scale = "row",
cluster_cols = F,
color = colorRampPalette(c("darkred", "#FFFFFF","darkblue"))(255),
# gaps_col = 5,
# gaps_row = c(8, 9),
# cutree_rows = 2,
angle_col = 45,
# cutree_cols = 2,
annotation_col=dplyr::select(metadata,"group"),annotation_colors = annoCol)
print(p)
}