Skip to content

Commit

Permalink
wig track heatmap fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Nov 21, 2024
1 parent 3555019 commit 1eb0438
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
14 changes: 14 additions & 0 deletions dev/wig/wigs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

<body>

<button id="log-state">Log Session</button>
<button id="bookmark">Bookmark</button>

<div id="myDiv" style="padding-top: 50px;padding-bottom: 20px; height: auto">

</div>
Expand All @@ -19,6 +22,7 @@

const div = document.getElementById("myDiv");
const options = {
queryParametersSupported: true,
locus: '19:49301000-49305700',
genome: "hg19",
tracks: [
Expand Down Expand Up @@ -76,6 +80,16 @@
};

igv.createBrowser(div, options).then(function (browser) {

document.getElementById("log-state").addEventListener("click", () => console.log(browser.toJSON()))

document.getElementById('bookmark').addEventListener('click', () => {
const path = window.location.href.slice()
const idx = path.indexOf("?")
const url = (idx > 0 ? path.substring(0, idx) : path) + "?sessionURL=blob:" + browser.compressedSession()
window.history.pushState({}, "IGV", url)
})

});


Expand Down
2 changes: 1 addition & 1 deletion js/feature/wigTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class WigTrack extends TrackBase {

function clickHandler() {
this.graphType = gt
this.trackView.updateViews()
this.trackView.repaintViews()
}

menuItems.push({object, click: clickHandler})
Expand Down
4 changes: 2 additions & 2 deletions js/trackBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ class TrackBase {

const menuItems = []

menuItems.push('<hr/>')

// Data range or color scale

if ("heatmap" !== this.graphType && this.colorScale) {

menuItems.push('<hr/>')

function dialogPresentationHandler() {

if (this.trackView.track.selected) {
Expand Down
2 changes: 1 addition & 1 deletion js/ui/components/colorScaleEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ColorScaleEditor {
label: "Max color",
value: newColorScale.highColor,
onchange: (v) => {
newColorScale.maxColor = v
newColorScale.highColor = v
paintLegend(legend, newColorScale)
}
})
Expand Down
19 changes: 8 additions & 11 deletions js/util/colorScale.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,9 @@ class GradientColorScale {

class DivergingGradientScale {

constructor({lowColor, midColor, highColor, low, mid, high}) {
constructor(json) {
this.type = 'diverging'
this.setProperties({lowColor, midColor, highColor, low, mid, high})
}

setProperties({lowColor, midColor, highColor, low, mid, high}) {

const {lowColor, midColor, highColor, low, mid, high} = json
this.lowGradientScale = new GradientColorScale({
lowColor: lowColor,
highColor: midColor,
Expand Down Expand Up @@ -221,17 +217,18 @@ class DivergingGradientScale {
toJson() {
return {
type: this.type,
low: this.lowGradientScale.low,
low: this.low,
mid: this.mid,
high: this.highGradientScale.high,
lowColor: this.lowGradientScale.lowColor,
high: this.high,
lowColor: this.lowColor,
midColor: this.midColor,
highColor: this.highGradientScale.highColor
highColor: this.highColor
}
}

clone() {
return new DivergingGradientScale(this.toJson())
const json = this.toJson()
return new DivergingGradientScale(json)
}
}

Expand Down

0 comments on commit 1eb0438

Please sign in to comment.