Skip to content

Commit

Permalink
Add "visibility window" to wig track. Useful when using "none" for su…
Browse files Browse the repository at this point in the history
…mmarization with large bigwig files.
  • Loading branch information
jrobinso committed Oct 11, 2024
1 parent 8eaced9 commit d8ae932
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion js/feature/wigTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class WigTrack extends TrackBase {
scaleFactor: undefined,
overflowColor: `rgb(255, 32, 255)`,
baselineColor: 'lightGray',
summarize: true
summarize: true,
visibilityWindow: undefined
}

constructor(config, browser) {
Expand Down Expand Up @@ -69,6 +70,10 @@ class WigTrack extends TrackBase {
if (header) this.setTrackProperties(header)
}

supportsWholeGenome() {
return this.visibilityWindow === undefined || this.visibilityWindow < 0
}

async getFeatures(chr, start, end, bpPerPixel) {

const windowFunction = this.windowFunction
Expand Down
11 changes: 7 additions & 4 deletions js/ui/menuUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {colorPalettes} from "../util/colorPalletes.js"

const colorPickerTrackTypeSet = new Set(['bedtype', 'alignment', 'annotation', 'variant', 'wig', 'interact'])

const vizWindowTypes = new Set(['alignment', 'annotation', 'variant', 'eqtl', 'qtl', 'snp', 'shoebox'])
const vizWindowTypes = new Set(['alignment', 'annotation', 'variant', 'eqtl', 'qtl', 'snp', 'shoebox', 'wig'])

const multiTrackSelectExclusionTypes = new Set(['sequence', 'ruler', 'ideogram'])

Expand Down Expand Up @@ -83,7 +83,7 @@ class MenuUtils {

if (isVisibilityWindowType(trackView)) {
list.push('<hr/>')
list.push(visibilityWindowMenuItem())
list.push(visibilityWindowMenuItem(trackView.track.type))
}

return list
Expand Down Expand Up @@ -166,7 +166,7 @@ function groupAutoScaleMenuItem() {
}


function visibilityWindowMenuItem() {
function visibilityWindowMenuItem(trackType) {

const object = $('<div>')
object.text('Set visibility window')
Expand All @@ -184,9 +184,12 @@ function visibilityWindowMenuItem() {
this.trackView.updateViews()
}

const label = 'wig' === trackType ?
'Visibility window (bp). Enter 0 for whole chromosome, -1 for whole genome.' :
'Visibility window (bp). Enter 0 for whole chromosome.'
const config =
{
label: 'Visibility Window',
label,
value: this.visibilityWindow,
callback
}
Expand Down

0 comments on commit d8ae932

Please sign in to comment.