var checkInput = function() { // 检查后缀名 txt csv excel // upload_file_1数据集 file_id = "upload_file_1" var obj = document.getElementById(file_id); var len = obj.files.length; var full_file_name = ""; for (var i = 0; i < len; i++) { full_file_name = obj.files[i].name; // combined.txt } var index =full_file_name.lastIndexOf("."); // 获取文件名后缀的索引 var suffix = full_file_name.substring(index+1, full_file_name.length); // txt if (suffix != "csv" && suffix != "txt" && suffix != "excel"){ window.alert("Please upload a txt, csv or excel file!"); var draw_form = document.getElementsByClassName("draw_form")[0]; draw_form.focus(); return false; } var annotation = $("input[name='annotation']:checked").val(); if (annotation == "data_with_row_annotation"){ file_id = "upload_file_row" var obj = document.getElementById(file_id); var len = obj.files.length; var full_file_name = ""; for (var i = 0; i < len; i++) { full_file_name = obj.files[i].name; // combined.txt } var index =full_file_name.lastIndexOf("."); // 获取文件名后缀的索引 var suffix = full_file_name.substring(index+1, full_file_name.length); // txt if (suffix != "csv" && suffix != "txt" && suffix != "excel"){ window.alert("Please upload a row annotation file!"); var draw_form = document.getElementsByClassName("draw_form")[0]; draw_form.focus(); return false; } } else if (annotation == "data_with_col_annotation"){ file_id = "upload_file_col" var obj = document.getElementById(file_id); var len = obj.files.length; var full_file_name = ""; for (var i = 0; i < len; i++) { full_file_name = obj.files[i].name; // combined.txt } var index =full_file_name.lastIndexOf("."); // 获取文件名后缀的索引 var suffix = full_file_name.substring(index+1, full_file_name.length); // txt if (suffix != "csv" && suffix != "txt" && suffix != "excel"){ window.alert("Please upload a column annotation file!"); var draw_form = document.getElementsByClassName("draw_form")[0]; draw_form.focus(); return false; } }else if (annotation == "data_with_row_col"){ var files = ["upload_file_col", "upload_file_row"]; for (file_id of files){ var obj = document.getElementById(file_id); var len = obj.files.length; var full_file_name = ""; for (var i = 0; i < len; i++) { full_file_name = obj.files[i].name; // combined.txt } var index =full_file_name.lastIndexOf("."); // 获取文件名后缀的索引 var suffix = full_file_name.substring(index+1, full_file_name.length); // txt if (suffix != "csv" && suffix != "txt" && suffix != "excel"){ window.alert("Please upload row and column annotation files!"); var draw_form = document.getElementsByClassName("draw_form")[0]; draw_form.focus(); return false; } } } // 检查confidence、lr、es是否为空值 var confidence = document.getElementById("confidence").value; if (confidence == ""){ window.alert("Please input confidence level!"); var draw_form = document.getElementsByClassName("draw_form")[0]; draw_form.focus(); return false; } // window.alert('confidence:' + confidence); // window.alert('email') // 检查邮件格式 var email = document.getElementById("email").value; //box var regex = /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i; if (!regex.test(email)) { window.alert("Please submit the correct email address"); // document.getElementById("email").enter.focus(); var process_form = document.getElementsByClassName("draw_form")[0]; process_form.focus(); return false; } // if (email != ""){ // var regex = /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i; // if (!regex.test(email)) { // window.alert("Please submit the correct email address"); // var draw_form = document.getElementsByClassName("draw_form")[0]; // draw_form.focus(); // return false; // } // } return true; } var download_example = function() { const fileUrl = "./example/draw_example/df_gene_cluster_example.txt"; // 文件的实际路径 const fileName = "df_gene_cluster_example.txt"; // 下载时保存的文件名 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM } var Add_row_file = function(){ document.getElementById("row_annotation_file").style.display=""; document.getElementById("col_annotation_file").style.display="none"; document.getElementById("group_div").style.display="none"; } var Add_col_file = function(){ document.getElementById("row_annotation_file").style.display="none"; document.getElementById("col_annotation_file").style.display=""; document.getElementById("group_div").style.display=""; } var Add_row_col_file = function(){ document.getElementById("row_annotation_file").style.display=""; document.getElementById("col_annotation_file").style.display=""; document.getElementById("group_div").style.display=""; } var no_Add_file = function(){ document.getElementById("col_annotation_file").style.display="none"; document.getElementById("row_annotation_file").style.display="none"; document.getElementById("group_div").style.display="none"; } var download_example_row = function(){ const fileUrl = "./example/draw_example/df_gene_cluster_annotation_row.txt"; // 文件的实际路径 const fileName = "df_gene_cluster_annotation_row.txt"; // 下载时保存的文件名 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM } var download_example_col = function(){ const fileUrl = "./example/draw_example/df_gene_cluster_annotation_col.txt"; // 文件的实际路径 const fileName = "df_gene_cluster_annotation_col.txt"; // 下载时保存的文件名 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM } var checkEmail = function() { // 判断email格式是否正确 写的不对 var email = document.getElementById("email").value; //box var regex = /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i; if (email == '' || !regex.test(email)) { window.alert("Please submit the correct email address"); document.getElementById("email").enter.focus(); return false; } else { return true; } }
    Yes   No  
    Yes   No  
    None   Center and scale data in row direction   Center and scale data in column direction  
    No   Add row annotation   Add column annotation   Add both row and column annotations  

img