Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Aug 7, 2024
1 parent 8abb2d6 commit 63420c4
Show file tree
Hide file tree
Showing 12 changed files with 217 additions and 134 deletions.
70 changes: 53 additions & 17 deletions dev/wig/merged.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
</head>

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

<h1>Merged track</h1>

Expand All @@ -22,25 +24,12 @@ <h1>Merged track</h1>

var options =
{
queryParametersSupported: true,
genome: "hg19",
locus: "chr4:40,174,668-40,221,204",
tracks: [
// {
// "type": "wig",
// "format": "bigwig",
// "url": "https://www.encodeproject.org/files/ENCFF000ASJ/@@download/ENCFF000ASJ.bigWig",
// "color": "red",
// "name": "ENCFF000ASJ"
// },
// {
// "type": "wig",
// "format": "bigwig",
// "url": "https://www.encodeproject.org/files/ENCFF351WPV/@@download/ENCFF351WPV.bigWig",
// "color": "green",
// "name": "ENCFF351WPV"
// },
{
name: "Merged - group autoscaled",
name: "Merged - autoscaled",
type: "merged",
autoscale: true,
tracks: [
Expand All @@ -58,6 +47,26 @@ <h1>Merged track</h1>
}
]
},
{
name: "Merged - fixed scale",
type: "merged",
min: 0,
max: 100,
tracks: [
{
"type": "wig",
"format": "bigwig",
"url": "https://www.encodeproject.org/files/ENCFF000ASJ/@@download/ENCFF000ASJ.bigWig",
"color": "red"
},
{
"type": "wig",
"format": "bigwig",
"url": "https://www.encodeproject.org/files/ENCFF351WPV/@@download/ENCFF351WPV.bigWig",
"color": "green"
}
]
},
{
name: "Merged - individual autoscaled",
type: "merged",
Expand All @@ -77,15 +86,42 @@ <h1>Merged track</h1>
"autoscale": true
}
]
}
},
{
name: "Merged - individual fixed scale",
type: "merged",
tracks: [
{
"type": "wig",
"format": "bigwig",
"url": "https://www.encodeproject.org/files/ENCFF000ASJ/@@download/ENCFF000ASJ.bigWig",
"color": "red",
"max": 100
},
{
"type": "wig",
"format": "bigwig",
"url": "https://www.encodeproject.org/files/ENCFF351WPV/@@download/ENCFF351WPV.bigWig",
"color": "green",
"max": 50
}
]
},
]
}

var igvDiv = document.getElementById("igvDiv")

igv.createBrowser(igvDiv, options)
.then(function (browser) {
console.log("Created IGV 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
22 changes: 21 additions & 1 deletion examples/mergedWig.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,27 @@ <h1>Merged track</h1>
"color": "green"
}
]
}
},
{
name: "Merged - individual autoscaled",
type: "merged",
tracks: [
{
"type": "wig",
"format": "bigwig",
"url": "https://www.encodeproject.org/files/ENCFF000ASJ/@@download/ENCFF000ASJ.bigWig",
"color": "red",
"autoscale": true
},
{
"type": "wig",
"format": "bigwig",
"url": "https://www.encodeproject.org/files/ENCFF351WPV/@@download/ENCFF351WPV.bigWig",
"color": "green",
"autoscale": true
}
]
},
]
}

Expand Down
4 changes: 2 additions & 2 deletions examples/spliceJunctions.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>Splice junctions</h1>

<script type="module">

import igv from "../js/index.js";
import igv from "../dist/igv.esm.min.js"

const tracks = [
{
Expand Down Expand Up @@ -47,7 +47,7 @@ <h1>Splice junctions</h1>
},
{
type: 'merged',
name: 'Splice Junctions',
name: 'Junctions + Coverage',
height: 150,
tracks: [
{
Expand Down
1 change: 1 addition & 0 deletions js/bam/coverageTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class CoverageTrack {


constructor(config, parent) {
this.featureType = 'numeric'
this.parent = parent
this.featureSource = parent.featureSource

Expand Down
4 changes: 2 additions & 2 deletions js/cnvpytor/cnvpytorTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ class CNVPytorTrack extends TrackBase {
if (this.signals.includes(signal_name)) {
let tconf = {}
tconf.type = "wig"
tconf.isMergedTrack = true
tconf.features = wig
tconf.name = signal_name
tconf.color = this.signal_colors.filter(x => x.singal_name === signal_name).map(x => x.color)
const t = await this.browser.createTrack(tconf)
if (t) {
t.isMergedTrack = true
t.autoscale = false // Scaling done from merged track
this.tracks.push(t)
} else {
Expand Down Expand Up @@ -328,12 +328,12 @@ class CNVPytorTrack extends TrackBase {
if (this.signals.includes(signal_name)) {
let tconf = {}
tconf.type = "wig"
tconf.isMergedTrack = true
tconf.features = wig
tconf.name = signal_name
tconf.color = this.signal_colors.filter(x => x.singal_name === signal_name).map(x => x.color)
const t = await this.browser.createTrack(tconf)
if (t) {
t.isMergedTrack = true
t.autoscale = false // Scaling done from merged track
this.tracks.push(t)
} else {
Expand Down
2 changes: 1 addition & 1 deletion js/feature/featureTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class FeatureTrack extends TrackBase {
}


if (!this.config.isMergedTrack) {
if (!this.isMergedTrack) {
IGVGraphics.fillRect(context, 0, options.pixelTop, pixelWidth, pixelHeight, {'fillStyle': "rgb(255, 255, 255)"})
}

Expand Down
Loading

0 comments on commit 63420c4

Please sign in to comment.