Skip to content

Commit

Permalink
chore(viz): disable search items which don't have calls for now
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jun 13, 2024
1 parent f5afb0f commit 09eb698
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion strkit/viz/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ def get_loci():

return {
"results": list(map(
lambda x: {"i": x[0], "contig": x[1]["contig"], "start": x[1]["start"], "end": x[1]["end"]},
lambda x: {
"i": x[0],
"contig": x[1]["contig"],
"start": x[1]["start"],
"end": x[1]["end"],
"disabled": x[1]["call"] is None,
},
res)),
}

Expand Down
11 changes: 9 additions & 2 deletions strkit/viz/templates/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@
searchResponses = sr.results;
// noinspection JSUnresolvedVariable
const res = sr.results.map(r =>
`<li onclick="handleSearchResultClick(${r.i})">${r.contig}:${r.start}-${r.end}`).join("");
`<li onclick="${r.disabled ? "" : "handleSearchResultClick(${r.i})"}"
class="${r.disabled ? "disabled" : ""}">${r.contig}:${r.start}-${r.end}`).join("");
searchResponseList.innerHTML = res || "<em>No results found.</em>";
};

Expand Down Expand Up @@ -288,7 +289,7 @@
console.debug("call data", callData);

/** @type number[] */
const cns = Object.values(callData.reads).map(read => read.cn);
const cns = Object.values(callData.reads ?? {}).map(read => read.cn);
const thresholds = Math.min(100, Math.max(...cns) - Math.min(...cns));

// Add histogram
Expand Down Expand Up @@ -669,6 +670,7 @@
position: absolute;
top: 18px;
right: 0;
z-index: 100;
padding: 8px 0;
list-style: none;
min-width: 14em;
Expand All @@ -685,6 +687,11 @@
cursor: pointer;
padding: 4px 8px;
}
#search-responses li.disabled {
cursor: not-allowed;
padding: 4px 8px;
color: #999;
}
#search-responses li:hover {
background-color: #F0F0F0;
}
Expand Down

0 comments on commit 09eb698

Please sign in to comment.