50 lines
1.6 KiB
Plaintext
50 lines
1.6 KiB
Plaintext
|
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}
|
|||
|
)
|
|||
|
/*}}*/
|
|||
|
|
|||
|
import console;
|
|||
|
import process.r;
|
|||
|
import fsys.dlg;
|
|||
|
|
|||
|
// 选择文件按钮点击事件
|
|||
|
mainForm.btnSelectFile.oncommand = function(id, event) {
|
|||
|
var filePath = fsys.dlg.open("CSV 文件|*.csv||",, "选择输入文件");
|
|||
|
if (filePath) {
|
|||
|
mainForm.inputFile.text = filePath; // 将选择的文件路径显示在输入框中
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 运行按钮点击事件
|
|||
|
mainForm.btnRun.oncommand = function(id, event) {
|
|||
|
var inputFilePath = mainForm.inputFile.text;
|
|||
|
if (!inputFilePath) {
|
|||
|
console.log("请先选择输入文件!");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
// 弹出保存文件对话框,选择PDF保存路径
|
|||
|
var outputFilePath = fsys.dlg.save("PDF 文件|*.pdf||",, "选择保存路径");
|
|||
|
if (!outputFilePath) {
|
|||
|
console.log("请选择PDF文件的保存路径!");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
// 执行 R 脚本
|
|||
|
var out = process.r.exec($"\res\heatmap_script.R", inputFilePath, outputFilePath);
|
|||
|
|
|||
|
// 将 R 脚本的输出显示在控制台中
|
|||
|
mainForm.editConsole.print(out);
|
|||
|
|
|||
|
console.log("Circos热图已成功保存至: " + outputFilePath);
|
|||
|
}
|
|||
|
|
|||
|
// 显示主窗口
|
|||
|
mainForm.show();
|
|||
|
return win.loopMessage();
|