about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-01-05 09:03:46 +0300
committerzsloan2022-01-29 00:42:44 -0600
commit52508bd8104172ed9047859eebf85c476e2ad381 (patch)
tree7ffae83124e25a116c884365eb976d558c3e07f4
parent1d748f1ca93ce568f09c9d95e27b442d5d56fce0 (diff)
downloadgenenetwork2-52508bd8104172ed9047859eebf85c476e2ad381.tar.gz
Fix bug: rho/r not set appropriately
Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi

* The column heading, and the "data-column-heading" values depend on
  the correlation method. The initial idea had been to set these
  values up from the server.

  With the use of Javascript, however, the system defaults to using
  `r`, which is a bug when the method is any of the Spearman's
  methods.
-rw-r--r--wqflask/wqflask/static/new/javascript/partial_correlations.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/wqflask/wqflask/static/new/javascript/partial_correlations.js b/wqflask/wqflask/static/new/javascript/partial_correlations.js
index 1a06c48f..b3a89c5e 100644
--- a/wqflask/wqflask/static/new/javascript/partial_correlations.js
+++ b/wqflask/wqflask/static/new/javascript/partial_correlations.js
@@ -211,10 +211,33 @@ function display_probeset_results(primary, controls, correlations, method) {
     /*table_body.removeChild(template_row);*/
 }
 
+function replace_r_with_rho(method) {
+    /* Mostly utility: Replace `r` with `rho` in the appropriate places */
+    pattern = /\br\b/;
+    if(method == "spearman") {
+        results_div = document.getElementById("partial-correlation-results");
+	headers = results_div.getElementsByTagName("th");
+	for(let header of headers) {
+	    header.innerHTML = header.innerHTML.replace(pattern, "rho");
+	}
+
+	cells = results_div.getElementsByTagName("td");
+	for(let cell of cells) {
+	    cell.setAttribute(
+		"data-column-heading",
+		cell.getAttribute(
+		    "data-column-heading").replace(pattern, "rho"));
+	}
+    }
+}
+
 function display_partial_corr_results(data, status, xhr) {
     progress_indicator = document.getElementById(
 	"partial-correlations-progress-indicator").style.display = "none";
     console.log(data);
+
+    replace_r_with_rho(data["results"]["method"]);
+
     display_functions = {
 	"Publish": display_publish_results,
 	"Geno": display_geno_results,