add 更新引用

This commit is contained in:
freefire 2025-01-11 21:56:12 +08:00
parent d3a9e4f691
commit 5a42a4c880

32
main.R
View File

@ -1,28 +1,13 @@
# 列出所需的包 library(grid)
packages <- c("ComplexHeatmap", "circlize", "RColorBrewer", "dendextend", "dendsort", "gridBase") library(ComplexHeatmap)
library(circlize)
# 检查并安装缺失的包 library(RColorBrewer)
install_if_missing <- function(pkg) { library(dendextend)
if (!requireNamespace(pkg, quietly = TRUE)) { library(dendsort)
if (pkg == "ComplexHeatmap") { library(gridBase)
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("ComplexHeatmap")
} else {
install.packages(pkg, dependencies = TRUE)
}
}
}
# 应用函数到每个包
sapply(packages, install_if_missing)
# 加载所有包
lapply(packages, library, character.only = TRUE)
# 加载绘图数据 # 加载绘图数据
data <- read.table(file = 'E:/hui.zhang/Drawpic/1.csv', header = TRUE, row.names = 1, sep = ',') data <- read.table(file = 'D:/code/R/1.csv', header = TRUE, row.names = 1, sep = ',')
# 查看数据 # 查看数据
head(data) head(data)
@ -98,3 +83,4 @@ circos.track(track.index = get.current.track.index(), panel.fun = function(x, y)
}, bg.border = NA) }, bg.border = NA)
circos.clear() circos.clear()