The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
OrgHeatmap
是一个用于在人体器官图上可视化数值数据(如基因表达量、生理指标)的工具包。它支持自定义颜色方案、按器官系统过滤数据,以及添加条形图进行定量比较,帮助直观展示数据在人体解剖结构中的分布。
# 从本地安装(替换为你的包文件路径)
install.packages("OrgHeatmap_0.1.0.tar.gz", repos = NULL, type = "source")
# 若已上传到GitHub,可从仓库安装
# devtools::install_github("你的用户名/OrgHeatmap")
# 如果未安装devtools,请先执行:
# install.packages("devtools")
# 安装依赖包(若运行时提示缺失)
install.packages(c("ggpolypath", "patchwork", "dplyr", "stringdist", "ggplot2"))
包内置了示例数据,方便快速上手:
# 加载示例数据
data(example_Data3, package = "OrgHeatmap")
# 验证数据是否加载成功
if (!exists("example_Data3")) {
stop("示例数据加载失败,请检查包是否正确安装。")
}
# 查看数据结构(第一列是器官名称,第二列是数值)
head(example_Data3)
## organ value
##10 lymph_nodes 0.029
##9 lung 0.041
##5 uterus 0.026
##17 adrenal_gland 0.014
##25 tongue 0.038
##18 stomach 0.050
使用核心函数OrgHeatmap()
,传入数据即可生成基础可视化结果:
用system
参数指定要显示的器官系统(如循环系统、呼吸系统):
通过以下参数调整颜色: -
fillcolor_organ
:器官的颜色方案(支持”plasma”、“viridis”等)
- fillcolor_outline
:人体轮廓的填充色 -
direction
:颜色梯度方向(1=默认,-1=反转)
设置organbar = TRUE
可在右侧添加条形图,方便数值对比:
如果数据中的器官名称不规范(如”Heart
Tissue”),可通过organ_name_mapping
映射到标准名称:
# 定义名称映射规则
name_mapping <- c(
"Heart Tissue" = "heart", # "Heart Tissue"映射为"heart"
"Liver Cells" = "liver", # "Liver Cells"映射为"liver"
"Brain Region" = "brain" # "Brain Region"映射为"brain"
)
# 应用映射
mapped_plot <- OrgHeatmap(
data = data.frame(
organ = c("Heart Tissue", "Liver Cells", "Brain Region"),
value = c(12, 18, 9)
),
organ_name_mapping = name_mapping,
title = "器官名称映射示例"
)
当数据中存在重复器官(如多个”heart”条目),用aggregate_method
指定聚合方式:
# 对重复器官进行均值聚合
aggregated_plot <- OrgHeatmap(
data = data.frame(
organ = c("heart", "heart", "liver"), # 重复的"heart"
value = c(10, 20, 15)
),
aggregate_method = "mean", # 可选:"mean"(均值)、"sum"(求和)、"count"(计数)
title = "重复器官数据聚合(均值)"
)
# 查看聚合结果
aggregated_plot$clean_data
## organ value
## 1 heart 15 # 两个heart的均值:(10+20)/2=15
## 2 liver 15
检查器官名称是否正确(参考unique(organ_systems$organ)
中的标准名称)。
用valid_organs
参数过滤无效器官:
organbar
参数未开启。organbar = TRUE
且处理后的clean_data
不为空。OrgHeatmap
简化了人体器官数据的可视化,核心功能对应的参数如下:
功能 | 关键参数 |
---|---|
器官系统过滤 | system |
颜色自定义 | fillcolor_organ 、direction |
条形图配置 | organbar 、organbar_digit |
名称标准化 | organ_name_mapping |
数据聚合 | aggregate_method |
查看完整参数说明:?OrgHeatmap
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.