From 9ad5fde62f59be87b777f75663f0c4ba103afde8 Mon Sep 17 00:00:00 2001 From: ArtPoon Date: Tue, 7 May 2024 13:25:59 -0400 Subject: [PATCH] fixes #497 and #524 --- index-es.html | 2 +- index-fr.html | 2 +- index-zh.html | 4 ++-- index.html | 2 +- js/covizu.js | 15 +++++++++++++-- js/drawtree.js | 4 ++-- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/index-es.html b/index-es.html index fcb8b1b..b7d7a64 100644 --- a/index-es.html +++ b/index-es.html @@ -39,7 +39,7 @@ sample_legend: "Tamaño de la muestra (log10)", coldate_legend: "Colección mas reciente", diverge_legend: "Divergencia (reloj molecular estricto)", - infections_legend: "Infecciones previstas (en aumento)", + infections_legend: "Infecciones previstas (log10, en aumento)", infections_tooltip: "Infecciones previstas", total: "Total", sampled: "Muestreadas", diff --git a/index-fr.html b/index-fr.html index 6e52651..71f8e2f 100644 --- a/index-fr.html +++ b/index-fr.html @@ -39,7 +39,7 @@ sample_legend: "Taille de l'échantillon (log10)", coldate_legend: "Date des échantillons les plus récents", diverge_legend: "Divergence (prédiction par horloge moléculaire stricte)", - infections_legend: "Infections prévues (en augmentation)", + infections_legend: "Infections prévues (log10, en augmentation)", infections_tooltip: "Infections prévues", total: "Total", sampled: "Échantillonné", diff --git a/index-zh.html b/index-zh.html index 1d03d37..986fbe8 100644 --- a/index-zh.html +++ b/index-zh.html @@ -37,10 +37,10 @@ "Oceania": "大洋洲", "South America": "南美" }, - sample_legend: "样本大小 (log10)", + sample_legend: "样本大小 (常用对数)", coldate_legend: "最后收集日期", diverge_legend: "趋异 (严格分子钟)", - infections_legend: "预测感染病例(增加中)", + infections_legend: "预测感染病例(常用对数, 增加中)", infections_tooltip: "预测感染病例", total: "总计", sampled: "采样", diff --git a/index.html b/index.html index 141594a..8f4b539 100644 --- a/index.html +++ b/index.html @@ -39,7 +39,7 @@ sample_legend: "Sample size (log10)", coldate_legend: "Last collection date", diverge_legend: "Divergence (strict molecular clock)", - infections_legend: "Predicted infections (increasing)", + infections_legend: "Predicted infections (log10, increasing)", infections_tooltip: "Predicted infections", total: "Total", sampled: "Sampled", diff --git a/js/covizu.js b/js/covizu.js index 6a9f3c0..9817013 100644 --- a/js/covizu.js +++ b/js/covizu.js @@ -1018,11 +1018,22 @@ function export_csv() { var all_tips = [...tips, ...recombinant_tips, ...df_xbb]; // write lineage-level information to CSV file for download - var csvFile = 'lineage,mean.diffs,clock.residual,num.cases,num.variants,min.coldate,max.coldate,mean.coldate'; + var csvFile = 'lineage,mean.diffs,clock.residual,num.cases,num.variants,min.coldate,max.coldate,' + + 'mean.coldate,pred.cases'; var lineage_info = [] for (tip of all_tips) { if (tip.isTip === undefined || tip.isTip) - lineage_info.push([`${tip.thisLabel === undefined ? tip.label1 : tip.thisLabel},${Math.round(100*tip.mean_ndiffs)/100.},${Math.round(100*tip.residual)/100.},${tip.nsamples},${tip.varcount},${formatDate(tip.first_date)},${formatDate(tip.last_date)},${formatDate(tip.mcoldate)}`]); + lineage_info.push([ + tip.thisLabel === undefined ? tip.label1 : tip.thisLabel, + Math.round(100*tip.mean_ndiffs)/100., + Math.round(100*tip.residual)/100., + tip.nsamples, + tip.varcount, + formatDate(tip.first_date), + formatDate(tip.last_date), + formatDate(tip.mcoldate), + Math.round(tip.infections) + ]); } csvFile = csvFile + "\n" + lineage_info.join("\n"); blob = new Blob([csvFile], {type: "text/csv"}); diff --git a/js/drawtree.js b/js/drawtree.js index 03a4aa3..52fa274 100644 --- a/js/drawtree.js +++ b/js/drawtree.js @@ -418,7 +418,7 @@ function draw_clusters(tips, filtered_recombinant_tips, redraw=false) { diverge_pal = d3.scaleSequential(d3.interpolatePlasma) .domain(d3.extent(tip_obj, function(d) { return d.residual; })); infections_pal = d3.scaleSequential(d3.interpolateViridis) - .domain([0, d3.max(tip_obj, function(d) { return d.infections; })]); + .domain([0, d3.max(tip_obj, function(d) { return Math.log10(d.infections); })]); generate_legends(); changeTreeColour(); @@ -521,7 +521,7 @@ function changeTreeColour() { } else if (opt === "Infections") { $("div#svg-infections-legend").show(); - if (d.infections > 0) return infections_pal(d.infections); + if (d.infections > 0) return infections_pal(Math.log10(d.infections)); else if (d.infections == 0) return null_infections_colour; else return dsc_infections_colour; }