Skip to content

Commit 90af66d

Browse files
author
Alyssa Morrow
committed
fixed genotype track to not display 0,0 calls
1 parent 8f31921 commit 90af66d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/viz/GenotypeTrack.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ function renderGenotypes(ctx: DataCanvasRenderingContext2D,
7474
var width = Math.max(1, Math.round(scale(variant.position + 1) - scale(variant.position)));
7575
vc.calls.forEach(call => {
7676
var y = yForRow(callSetNames.indexOf(call.callSetName));
77-
ctx.fillStyle = call.genotype.reduce((a, b) => a + b, 0) == 1 ? style.GENOTYPE_FILL_HET : style.GENOTYPE_FILL_HOM;
78-
ctx.strokeStyle = ctx.fillStyle;
79-
ctx.fillRect(x - 0.2, y, width, style.GENOTYPE_HEIGHT);
80-
ctx.strokeRect(x - 0.2, y, width, style.GENOTYPE_HEIGHT);
77+
var callSum = call.genotype.reduce((a, b) => a + b, 0);
78+
// do not display 0,0 calls
79+
if (callSum > 0) {
80+
ctx.fillStyle = callSum == 1 ? style.GENOTYPE_FILL_HET : style.GENOTYPE_FILL_HOM;
81+
ctx.strokeStyle = ctx.fillStyle;
82+
ctx.fillRect(x - 0.2, y, width, style.GENOTYPE_HEIGHT);
83+
ctx.strokeRect(x - 0.2, y, width, style.GENOTYPE_HEIGHT);
84+
}
8185
});
8286
ctx.popObject();
8387
});

0 commit comments

Comments
 (0)