Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/PoonLab/covizu into iss58
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnielu committed Oct 11, 2022
2 parents 7c8548c + 80a16f7 commit f2aaefd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions js/covizu.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ req.done(async function() {
curr_date.setFullYear(curr_date.getFullYear() - 1);

// Maps id to a cidx
for (i in tips) {
id_to_cidx[i] = 'cidx-' + tips[i].cluster_idx
var all_tips = [...recombinant_tips, ...tips]
for (i in all_tips) {
id_to_cidx[i] = 'cidx-' + all_tips[i].cluster_idx
}

// Maps cidx to an id
Expand Down
10 changes: 5 additions & 5 deletions js/drawtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function draw_cluster_box(rect) {
* Draw time-scaled tree in SVG
* @param {Array} df: data frame
*/
function drawtree(df, redraw=true) {
function drawtree(df, org_df, redraw=true) {

// Sets margin top to align vertical scrollbar with the time-scaled tree
$('#tree-vscroll').css('margin-top', document.getElementById("tree-title").clientHeight + document.getElementById("svg-timetreeaxis").clientHeight + $('#inner-hscroll').height() + 5);
Expand All @@ -123,8 +123,8 @@ function drawtree(df, redraw=true) {
// adjust d3 scales to data frame
if(!redraw) {
xScale.domain([
d3.min(df, xValue)-0.05,
date_to_xaxis(d3.max(df, function(d) {return d.last_date}))
d3.min(org_df, xValue)-0.05,
date_to_xaxis(d3.max(org_df, function(d) {return d.last_date}))
]);
}

Expand Down Expand Up @@ -319,7 +319,7 @@ function draw_clusters(tips, recombinant_tips, redraw=false) {
.attr("height", 10)
.attr("class", "default recombinant")
.attr("cidx", function(d) { return "cidx-" + d.cluster_idx; })
.attr("id", function(d, i) { return "id-" + i; })
.attr("id", function(d, i) { return "id-" + map_cidx_to_id['cidx-' + d.cluster_idx]; })
.on('mouseover', mouseover)
.on("mouseout", function() {
d3.select(this)
Expand Down Expand Up @@ -885,7 +885,7 @@ async function redraw_tree(cutoff_date, redraw=true) {

document.querySelector("#svg-timetree > svg").innerHTML = '';
document.querySelector("#svg-recombinants > svg").innerHTML = '';
drawtree(final_df, redraw=redraw);
drawtree(final_df, df_copy, redraw=redraw);
draw_clusters(filtered_tips, filtered_recomb_tips, redraw);

if(redraw) {
Expand Down
5 changes: 5 additions & 0 deletions js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ async function wrap_search() {
return;
}

// Display recombinants when doing a search
$('#display-option').attr('checked', 'checked');
$(".recombinant-tree-content").show()
$(".recombtitle").show()

var start_date, end_date;
if (start_date_text === "") {
start_date = utcDate("2020-01-01");
Expand Down

0 comments on commit f2aaefd

Please sign in to comment.