当前位置: 首页 > news >正文

R包:ggheatmap热图

在这里插入图片描述

加载R包

# devtools::install_github("XiaoLuo-boy/ggheatmap")library(ggheatmap)
library(tidyr)

数据

set.seed(123)
df <- matrix(runif(225,0,10),ncol = 15)
colnames(df) <- paste("sample",1:15,sep = "")
rownames(df) <- sapply(1:15, function(x)paste(sample(LETTERS,3,replace = F),collapse = ""))
df[1:4,1:4]row_metaData <- data.frame(exprtype=sample(c("Up","Down"),15,replace = T),genetype=sample(c("Metabolism","Immune","None"),15,replace = T))
rownames(row_metaData) <- rownames(df)
col_metaData <- data.frame(tissue=sample(c("Normal","Tumor"),15,replace = T),risklevel=sample(c("High","Low"),15,replace = T))
rownames(col_metaData) <- colnames(df)
exprcol <- c("#EE0000FF","#008B45FF" )
names(exprcol) <- c("Up","Down")
genecol <- c("#EE7E30","#5D9AD3","#D0DFE6FF")
names(genecol) <- c("Metabolism","Immune","None")
tissuecol <- c("#98D352","#FF7F0E")
names(tissuecol) <- c("Normal","Tumor")
riskcol <- c("#EEA236FF","#46B8DAFF")
names(riskcol) <- c("High","Low")
col <- list(exprtype=exprcol,genetype=genecol,tissue=tissuecol,risklevel=riskcol)
text_rows <- sample(rownames(df),3)

图1

p<- ggheatmap(df,cluster_rows = T,cluster_cols = T,scale = "row",text_show_rows = text_rows,cluster_num = c(3,3),tree_color_rows = c("#008B45FF","#631879FF","#008280FF"),tree_color_cols = c("#1F77B4FF","#FF7F0EFF","#2CA02CFF"),annotation_rows = row_metaData,annotation_cols = col_metaData,annotation_color = col
)
p

在这里插入图片描述

图2

p%>%ggheatmap_theme(1:5,theme =list(theme(axis.text.x = element_text(angle = 90,face = "bold",size = 10),axis.text.y = element_text(colour = "red",face = "bold")),theme(legend.title = element_text(face = "bold")),theme(legend.title = element_text(face = "bold")),theme(legend.title = element_text(face = "bold")),theme(legend.title = element_text(face = "bold"))))

在这里插入图片描述

图3

ggheatmap(df,cluster_rows = T,cluster_cols = T,scale = "row",text_show_rows = text_rows,border = "grey",cluster_num = c(3,3),tree_color_rows = c("#008B45FF","#631879FF","#008280FF"),tree_color_cols = c("#1F77B4FF","#FF7F0EFF","#2CA02CFF"),annotation_rows = row_metaData,annotation_cols = col_metaData,annotation_color = col
)%>%ggheatmap_theme(1,theme =list(theme(axis.text.x = element_text(angle = 90,face = "bold",size = 10),axis.text.y = element_text(colour = "red",face = "bold"))))

在这里插入图片描述

图4

ggheatmap(df,cluster_rows = T,cluster_cols = T,scale = "row",text_show_rows = text_rows,border = "grey",shape = "circle",cluster_num = c(3,3),tree_color_rows = c("#008B45FF","#631879FF","#008280FF"),tree_color_cols = c("#1F77B4FF","#FF7F0EFF","#2CA02CFF"),annotation_rows = row_metaData,annotation_cols = col_metaData,annotation_color = col
)%>%ggheatmap_theme(1,theme =list(theme(axis.text.x = element_text(angle = 90,face = "bold",size = 10),axis.text.y = element_text(colour = "red",face = "bold"))))

在这里插入图片描述

图5

ggheatmap(df,cluster_rows = T,cluster_cols = T,scale = "row",text_show_rows = text_rows,border = "grey",cluster_num = c(3,3),tree_color_rows = c("#008B45FF","#631879FF","#008280FF"),tree_color_cols = c("#1F77B4FF","#FF7F0EFF","#2CA02CFF"),annotation_rows = row_metaData,annotation_cols = col_metaData,annotation_color = col,text_position_rows = "left",text_position_cols = "top",tree_position_rows = "right",tree_position_cols = "bottom",annotation_position_rows = "right",annotation_position_cols = "bottom")%>%ggheatmap_theme(1,theme =list(theme(axis.text.x = element_text(angle = 90,face = "bold",size = 10),axis.text.y = element_text(colour = "red",face = "bold"))))

在这里插入图片描述

参考

  • https://github.com/XiaoLuo-boy/ggheatmap
http://www.lryc.cn/news/446703.html

相关文章:

  • springboot实战学习(7)(JWT令牌的组成、JWT令牌的使用与验证)
  • 如何使用numpy反转数组
  • Linux·进程概念(上)
  • Javax Validation 自定义注解校验(身份证号校验)
  • nid修改orac库和实例名为jyc
  • 无人机之模拟图传篇
  • Ubuntu 20.04安装pycharm2022及配置快捷方式
  • uni-app - - - - - 实现锚点定位和滚动监听功能(滚动监听功能暂未添加,待后续更新)
  • wordpress迁移到别的服务器
  • cefsharp新版本OnBeforeResourceLoad 禁止http自动跳转https显示404错误解决办法 含代码
  • RK 方案如何做到上电关机
  • 基于量子通讯进行安全认证
  • C语言贪吃蛇小游戏演示和说明
  • C++三大特性——继承性(超万字详解)
  • electron使用npm install出现下载失败的问题
  • HT513 2.8W I2S 输入单声道D类音频功率放大器
  • [PICO VR]Unity如何往PICO VR眼镜里写持久化数据txt/json文本
  • zico2打靶记录
  • pick你的第一个人形机器人——青龙强化学习环境测试
  • 了解主机及进程资源占用情况、性能情况、性能瓶颈,TOP命令输出解释
  • 计算机网络-小型综合网络的搭建涉及到无线路由交换安全
  • CleanClip For Mac 強大的剪貼簿助手Paste替代工具 v2.2.1
  • python全栈学习记录(十八)re、os和sys、subprocess
  • GO Fsnotify学习与使用
  • 除了递归算法,要如何优化实现文件搜索功能
  • 【AI算法岗面试八股面经【超全整理】——NLP】
  • Unity 设计模式 之 创建型模式 -【单例模式】【原型模式】 【建造者模式】
  • CSS中的字体样式、文本样式、列表样式以及背景和渐变
  • 教你如何在Java中操作Redis
  • nsight-system教程