aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-12-21 13:28:02 +0300
committerzsloan2022-01-29 00:42:44 -0600
commitea728239a571e1991530d17d48d7b93b939b3b11 (patch)
treefab932c6e215ee9547491e490dd30666a46cec9b
parent81355831321642f09f2dc606f0670e6b7ded79c9 (diff)
downloadgenenetwork2-ea728239a571e1991530d17d48d7b93b939b3b11.tar.gz
Display results for Geno and ProbeSet tables
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add function to display the results for the **Geno** and **ProbeSet** tables.
-rw-r--r--wqflask/wqflask/static/new/javascript/partial_correlations.js92
1 files changed, 90 insertions, 2 deletions
diff --git a/wqflask/wqflask/static/new/javascript/partial_correlations.js b/wqflask/wqflask/static/new/javascript/partial_correlations.js
index fdba247f..a6a07558 100644
--- a/wqflask/wqflask/static/new/javascript/partial_correlations.js
+++ b/wqflask/wqflask/static/new/javascript/partial_correlations.js
@@ -116,8 +116,96 @@ function display_publish_results(primary, controls, correlations, method) {
table_body.removeChild(template_row);
}
-function display_geno_results(primary, controls, correlations) {}
-function display_probeset_results(primary, controls, correlations) {}
+function display_geno_results(primary, controls, correlations) {
+ table = document.getElementById("part-corr-results-geno");
+ table.setAttribute("style", "display: block;");
+ table_body = document.querySelector("#part-corr-results-geno tbody");
+ template_row = document.querySelector(
+ "#part-corr-results-geno tr.template-geno-results-row");
+ correlations.forEach(function(item, index, arr) {
+ new_row = template_row.cloneNode(true);
+ new_row.setAttribute("class", "results-row");
+ new_row.querySelector(
+ 'td[data-column-heading="Chr"]').innerHTML = item["chr"];
+ new_row.querySelector(
+ 'td[data-column-heading="Megabase"]').innerHTML = item["mb"];
+ new_row.querySelector(
+ 'td[data-column-heading="N"]').innerHTML = item["noverlap"];
+ new_row.querySelector(
+ `td[data-column-heading="Partial ${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["partial_corr"]);
+ new_row.querySelector(
+ `td[data-column-heading="p(partial ${rho_or_r(method)})"]`
+ ).innerHTML = format_number(item["partial_corr_p_value"]);
+ new_row.querySelector(
+ `td[data-column-heading="${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["corr"]);
+ new_row.querySelector(
+ `td[data-column-heading="p(${rho_or_r(method)})"]`
+ ).innerHTML = format_number(item["corr_p_value"]);
+ new_row.querySelector(
+ `td[data-column-heading="delta ${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["delta"]);
+ table_body.appendChild(new_row);
+ });
+ table_body.removeChild(template_row);
+}
+
+function display_probeset_results(primary, controls, correlations) {
+ table = document.getElementById("part-corr-results-probeset");
+ table.setAttribute("style", "display: block;");
+ table_body = document.querySelector("#part-corr-results-probeset tbody");
+ template_row = document.querySelector(
+ "#part-corr-results-probeset tr.template-probeset-results-row");
+ correlations.forEach(function(item, index, arr) {
+ new_row = template_row.cloneNode(true);
+ new_row.setAttribute("class", "results-row");
+ new_row.querySelector(
+ 'td[data-column-heading="Record"]').innerHTML = item["trait_name"];
+ new_row.querySelector(
+ 'td[data-column-heading="Gene ID"]').innerHTML = item["geneid"];
+ new_row.querySelector(
+ 'td[data-column-heading="Homologene ID"]').innerHTML = item["homologeneid"];
+ new_row.querySelector(
+ 'td[data-column-heading="Symbol"]').innerHTML = item["symbol"];
+ new_row.querySelector(
+ 'td[data-column-heading="Description"]').innerHTML = item["description"];
+ new_row.querySelector(
+ 'td[data-column-heading="Chr"]').innerHTML = item["chr"];
+ new_row.querySelector(
+ 'td[data-column-heading="Megabase"]').innerHTML = item["mb"];
+ new_row.querySelector(
+ 'td[data-column-heading="Mean Expr"]').innerHTML = item["mean_expr"];
+ new_row.querySelector(
+ 'td[data-column-heading="N"]').innerHTML = item["noverlap"];
+ new_row.querySelector(
+ `td[data-column-heading="Sample Partial ${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["partial_corr"]);
+ new_row.querySelector(
+ `td[data-column-heading="Sample p(partial ${rho_or_r(method)})"]`
+ ).innerHTML = format_number(item["partial_corr_p_value"]);
+ new_row.querySelector(
+ `td[data-column-heading="Sample ${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["corr"]);
+ new_row.querySelector(
+ `td[data-column-heading="Sample p(${rho_or_r(method)})"]`
+ ).innerHTML = format_number(item["corr_p_value"]);
+ new_row.querySelector(
+ `td[data-column-heading="delta ${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["delta"]);
+ new_row.querySelector(
+ `td[data-column-heading="Lit Corr"]`
+ ).innerHTML = format_number(item["l_corr"]);
+ new_row.querySelector(
+ `td[data-column-heading="Tissue ${rho_or_r(method)}"]`
+ ).innerHTML = format_number(item["tissue_corr"]);
+ new_row.querySelector(
+ `td[data-column-heading="Tissue p(${rho_or_r(method)})"]`
+ ).innerHTML = format_number(item["tissue_p_value"]);
+ table_body.appendChild(new_row);
+ });
+ table_body.removeChild(template_row);
+}
function display_partial_corr_results(data, status, xhr) {
progress_indicator = document.getElementById(