Skip to content

Commit

Permalink
Account for display mode when displaying popup text for vcf track. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Apr 22, 2022
1 parent c1d8231 commit 99d300c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/variant/variantTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ class VariantTrack extends TrackBase {
IGVGraphics.fillRect(context, 0, pixelTop, pixelWidth, pixelHeight, {'fillStyle': "rgb(255, 255, 255)"})

const vGap = ("SQUISHED" === this.displayMode) ? this.squishedVGap : this.expandedVGap
const rc = ("COLLAPSED" === this.displayMode) ? 1 : this.nVariantRows
const rowCount = ("COLLAPSED" === this.displayMode) ? 1 : this.nVariantRows
const variantHeight = ("SQUISHED" === this.displayMode) ? this.squishedVariantHeight : this.expandedVariantHeight
this.variantBandHeight = TOP_MARGIN + rc * (variantHeight + vGap)
this.variantBandHeight = TOP_MARGIN + rowCount * (variantHeight + vGap)

const callSets = this.callSets
const nCalls = this.getCallsetsLength()
Expand Down Expand Up @@ -323,15 +323,17 @@ class VariantTrack extends TrackBase {
if (yOffset <= this.variantBandHeight) {
// Variant
const variantHeight = ("SQUISHED" === this.displayMode) ? this.squishedVariantHeight : this.expandedVariantHeight
const variantRow = (Math.floor)((yOffset - TOP_MARGIN) / (variantHeight + vGap))
featureList = featureList.filter(f => f.row === variantRow)
const variantRow = Math.floor((yOffset - TOP_MARGIN) / (variantHeight + vGap))
if("COLLAPSED" !== this.displayMode) {
featureList = featureList.filter(f => f.row === variantRow)
}
} else if (this.callSets) {
const callSets = this.callSets
const sampleY = yOffset - this.variantBandHeight
const sampleRow = Math.floor(sampleY / this.sampleHeight)
if (sampleRow >= 0 && sampleRow < callSets.length) {
const variantRow = Math.floor((sampleY - sampleRow * this.sampleHeight) / callHeight)
const variants = featureList.filter(f => f.row === variantRow)
const variants = "COLLAPSED" === this.displayMode ? featureList : featureList.filter(f => f.row === variantRow)
const cs = callSets[sampleRow]
featureList = variants.map(v => {
const call = v.calls[cs.id]
Expand Down

0 comments on commit 99d300c

Please sign in to comment.