Skip to content

Commit

Permalink
Fix whole genome view for variant track
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Aug 2, 2024
1 parent 588c899 commit a034b7b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/variant/variantTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,16 @@ class VariantTrack extends TrackBase {

// Loop through variants. A variant == a row in a VCF file
for (let v of features) {
const variant = v._f || v // Unwrap whole gnom
if (variant.end < bpStart) continue
if (variant.start > bpEnd) break
if (v.end < bpStart) continue
if (v.start > bpEnd) break

const variantHeight = ("SQUISHED" === this.displayMode) ? this.squishedVariantHeight : this.expandedVariantHeight
const y = TOP_MARGIN + ("COLLAPSED" === this.displayMode ? 0 : variant.row * (variantHeight + vGap))
const y = TOP_MARGIN + ("COLLAPSED" === this.displayMode ? 0 : v.row * (variantHeight + vGap))
const h = variantHeight

// Compute pixel width. Minimum width is 3 pixels, if > 5 pixels create gap between variants
let x = (variant.start - bpStart) / bpPerPixel
let x1 = (variant.end - bpStart) / bpPerPixel
let x = (v.start - bpStart) / bpPerPixel
let x1 = (v.end - bpStart) / bpPerPixel

let w = Math.max(1, x1 - x)
if (w < 3) {
Expand All @@ -317,6 +316,7 @@ class VariantTrack extends TrackBase {
w -= 2
}

const variant = v._f || v // True variant record, used for whole genome view and SV mate records
let af
try {
af = variant.alleleFreq()
Expand Down

0 comments on commit a034b7b

Please sign in to comment.