add 更新ui和R脚本

This commit is contained in:
freefire 2025-01-12 03:27:50 +08:00
parent de88c928c4
commit 21d4e89975
3 changed files with 18 additions and 19 deletions

Binary file not shown.

View File

@ -2,10 +2,10 @@ import win.ui;
/*DSG{{*/
mainForm = win.form(text="CircosHeatmap-aardio";right=800;bottom=600)
mainForm.add(
editConsole={cls="edit";left=10;top=120;right=780;bottom=580;db=1;dl=1;dr=1;dt=1;edge=1;multiline=1;z=1},
inputFile={cls="edit";left=10;top=10;right=600;bottom=40;edge=1;z=2},
btnSelectFile={cls="button";text="选择输入文件";left=610;top=10;right=730;bottom=40;z=3},
btnRun={cls="button";text="运行";left=740;top=10;right=780;bottom=40;z=4}
btnRun={cls="button";text="运行";left=740;top=10;right=780;bottom=40;z=4};
btnSelectFile={cls="button";text="选择输入文件";left=607;top=11;right=727;bottom=41;z=3};
editConsole={cls="edit";left=10;top=120;right=780;bottom=580;db=1;dl=1;dr=1;dt=1;edge=1;multiline=1;z=1};
inputFile={cls="edit";left=10;top=10;right=600;bottom=40;edge=1;z=2}
)
/*}}*/
@ -41,8 +41,7 @@ mainForm.btnRun.oncommand = function(id, event) {
// 将 R 脚本的输出显示在控制台中
mainForm.editConsole.print(out);
console.log("Circos热图已成功保存至: " + outputFilePath);
mainForm.editConsole.print("Circos热图已成功保存至: " + outputFilePath);
}
// 显示主窗口

View File

@ -8,7 +8,7 @@ suppressPackageStartupMessages(library(dendsort))
suppressPackageStartupMessages(library(gridBase))
# Get arguments from the command line
args=commandArgs(T);
args <- commandArgs(T)
# Check the number of arguments
if (length(args) != 2) {
@ -71,7 +71,7 @@ message("Drawing the circular heatmap with adjusted and beautified dendrogram...
circos.par(gap.after = c(30))
circos.heatmap(cir1, col = mycol, dend.side = "inside",
rownames.side = "outside",
track.height = 0.28,
track.height = 0.35,
rownames.col = "black",
rownames.cex = 1.3,
rownames.font = 1.3,
@ -80,29 +80,29 @@ circos.heatmap(cir1, col = mycol, dend.side = "inside",
dend.callback = function(dend, m, si) {
color_branches(dend, k = 15, col = 1:15)
})
circos.clear()
# Add legend labels
message("Adding legend labels...")
lg <- Legend(title = "Exp", col_fun = mycol,
direction = c("vertical"))
grid.draw(lg)
# Add column names
message("Adding column names...")
# 添加列名
circos.track(track.index = get.current.track.index(), panel.fun = function(x, y) {
if (CELL_META$sector.numeric.index == 1) {
cn <- colnames(cir1)
n <- length(cn)
# Adjust the x and y positions
circos.text(rep(CELL_META$cell.xlim[2], n) + convert_x(0.5, "mm"),
1:n + 5,
1:n + 2.5,
cn, cex = 0.6, adj = c(0, 0.5), facing = "inside")
}
}, bg.border = NA)
# 添加图例
message("Adding legend labels...")
lg <- Legend(title = "Exp", col_fun = mycol, direction = "vertical")
message("The heatmap has been successfully saved to: ", output_pdf)
grid.draw(lg)
# 清除环形图
circos.clear()
# Close the PDF device
dev.off()
message("The heatmap has been successfully saved to: ", output_pdf)
message("The heatmap has been successfully saved to: ", output_pdf)