Skip to content

Commit 77ab18b

Browse files
author
Joe Brown
committed
updates user target select logic
1 parent f89ad08 commit 77ab18b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

templates/covdist.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,16 @@
172172
arr.forEach(function (sample_obj) {
173173
let sample = sample_obj.sample
174174
175-
let x_idx = data[chr][sample_obj.sample]["x"].indexOf(cutoff) || -1
175+
let x_idx = -1
176176
let i = 0
177177
// occasionally x proportions have to be shifted slightly
178178
while (x_idx == -1 && i < 10) {
179+
// .indexOf returns -1 when index not found
179180
x_idx = data[chr][sample_obj.sample]["x"].indexOf(cutoff + i)
180181
i += 1
181182
}
182183
183-
let v;
184-
try {
185-
v = data[chr][sample_obj.sample]["y"][x_idx]
186-
} catch (err) {
187-
v = 0
188-
}
184+
let v = data[chr][sample_obj.sample]["y"][x_idx] || 0
189185
190186
a.push({
191187
sample: sample_obj.sample,

0 commit comments

Comments
 (0)