Skip to content

Commit

Permalink
fixes #497 and #524
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtPoon committed May 7, 2024
1 parent 856d57f commit 9ad5fde
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index-es.html
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion index-fr.html
Original file line number Diff line number Diff line change
Expand Up @@ -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é",
Expand Down
4 changes: 2 additions & 2 deletions index-zh.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"Oceania": "大洋洲",
"South America": "南美"
},
sample_legend: "样本大小 (log10)",
sample_legend: "样本大小 (常用对数)",
coldate_legend: "最后收集日期",
diverge_legend: "趋异 (严格分子钟)",
infections_legend: "预测感染病例(增加中)",
infections_legend: "预测感染病例(常用对数, 增加中)",
infections_tooltip: "预测感染病例",
total: "总计",
sampled: "采样",
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 13 additions & 2 deletions js/covizu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"});
Expand Down
4 changes: 2 additions & 2 deletions js/drawtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9ad5fde

Please sign in to comment.