R包:ggheatmap热图

devtools/2024/9/29 21:58:54/

在这里插入图片描述

加载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.ppmy.cn/devtools/118912.html

相关文章

YOLOv9改进策略【Conv和Transformer】| AssemFormer 结合卷积与 Transformer 优势,弥补传统方法不足

一、本文介绍 本文记录的是利用AssemFormer优化YOLOv9的目标检测网络模型。传统卷积和池化操作会导致信息丢失和压缩缺陷,且传统的注意力机制通常产生固定维度的注意力图,忽略了背景中的丰富上下文信息。本文的利用AssemFormer改进YOLOv9,以在特征传递和融合过程中增加多尺…

ARM64 Linux 找出dts的3种方法

1. 编译完内核如何找出 dts 在编译完 ARM64 内核后&#xff0c;设备树二进制文件&#xff08;DTB&#xff09;通常会被放置在 arch/arm64/boot 目录下。在该目录下&#xff0c;你可以找到与目标硬件平台对应的 DTB 文件。命令如下&#xff1a; $ find arch/arm64/boot/dts/ -…

webshell-HTTP常见特征

一、总体特点 二、蚁剑 数据中可以看到一些明文字符串函数&#xff0c;响应中可以看到响应的明文数据。 ant特征以及对数据base64可以解码 chr类别的会出现大量的chr编码 大量的百分号字符 三、哥斯拉 第一个请求包很大 响应为0 密钥被拆分到数据前后 响应包cookie带&#xf…

Redis哈希类型详解:从基础命令到实际应用

引言 前边介绍了 Redis 中字符串类型&#xff0c;现在接上篇文章继续学习 Redis 哈希类型的命令和实际应用 哈希&#xff08;Hash&#xff09;类型是一种非常实用的数据结构&#xff0c;以字段-值对的形式存储多个键值对。这里将详细介绍 Redis 哈希类型的使用方法、内部编码…

dlinject分析,一种不使用ptrace的linux代码注入

原理是通过直接操作Linux进程的内存&#xff0c;将一个动态链接库&#xff08;.so 文件&#xff09;注入到正在运行的进程中。这种注入过程通常涉及高级的系统编程技巧&#xff0c;涉及到操作系统的低层机制。以下是对该脚本的详细分析&#xff1a; 1. ELF文件解析 ELF&#…

解决 Pandas 中的 XLRDError:处理 “Excel xlsx file; not supported” 错误

解决 Pandas 中的 XLRDError&#xff1a;处理 “Excel xlsx file; not supported” 错误 在处理数据分析任务时&#xff0c;使用 Python 的 Pandas 库来读取 Excel 文件是一种常见的做法。然而&#xff0c;从 Pandas 1.2.0 版本开始&#xff0c;默认使用的 xlrd 库不再支持 .x…

平安养老险肇庆中心支公司开展“2024年金融教育宣传月”活动

为加强消费者金融教育宣传&#xff0c;切实提升社会公众金融素养&#xff0c;有效防范化解金融风险&#xff0c;营造和谐健康金融环境&#xff0c;在肇庆金融监管分局指导下&#xff0c;平安养老险肇庆中心支公司开展金融教育宣传月暨反洗钱宣传月系列活动。 9月11日&#xff…

架构师论文备考-论软件系统架构评估

题目&#xff1a;论软件系统架构评估 对于软件系统&#xff0c;尤其是大规模的复杂软件系统来说&#xff0c;软件的系统架构对于确保最终系统的质量具有十分重要的意义&#xff0c;不恰当的系统架构将给项目开发带来高昂的代价和难以避免的灾难。对一个系统架构进行评估&#x…